CPD Results

The following document contains the results of PMD's CPD 3.7.

Duplications

FileLine
edu\wisc\my\webproxy\portlet\WebProxyPortlet.java396
edu\wisc\my\webproxy\portlet\WebProxyPortlet.java964
                    final String sPostInterceptor = ConfigUtils.checkEmptyNullString(pp.getValue(GeneralConfigImpl.POST_INTERCEPTOR_CLASS, null), null);
                    if (sPostInterceptor != null) {
                        try {
                            final Class postInterceptorClass = Class.forName(sPostInterceptor);
                            PostInterceptor myPostInterceptor = (PostInterceptor)postInterceptorClass.newInstance();
                            myPostInterceptor.intercept(request, response, httpResponse);
                        }
                        catch (ClassNotFoundException cnfe) {
                            final String msg = "Could not find specified post-interceptor class '" + sPostInterceptor + "'";
                            LOG.error(msg, cnfe);
                            throw new PortletException(msg, cnfe);
                        }
                        catch (InstantiationException ie) {
                            final String msg = "Could instatiate specified post-interceptor class '" + sPostInterceptor + "'";
                            LOG.error(msg, ie);
                            throw new PortletException(msg, ie);
                        }
                        catch (IllegalAccessException iae) {
                            final String msg = "Could instatiate specified post-interceptor class '" + sPostInterceptor + "'";
                            LOG.error(msg, iae);
                            throw new PortletException(msg, iae);
                        }
                        catch (ClassCastException cce) {
                            final String msg = "Could not cast '" + sPostInterceptor + "' to 'edu.wisc.my.webproxy.beans.interceptors.PostInterceptor'";
                            LOG.error(msg, cce);
                            throw new PortletException(msg, cce);
                        }
                    }

FileLine
edu\wisc\my\webproxy\portlet\WebProxyPortlet.java323
edu\wisc\my\webproxy\portlet\WebProxyPortlet.java929
                    final String sPreInterceptor = ConfigUtils.checkEmptyNullString(pp.getValue(GeneralConfigImpl.PRE_INTERCEPTOR_CLASS, null), null);
                    if (sPreInterceptor != null) {
                        try {
                            final Class preInterceptorClass = Class.forName(sPreInterceptor);
                            PreInterceptor myPreInterceptor = (PreInterceptor)preInterceptorClass.newInstance();
                            myPreInterceptor.intercept(request, response, httpRequest);
                        }
                        catch (ClassNotFoundException cnfe) {
                            final String msg = "Could not find specified pre-interceptor class '" + sPreInterceptor + "'";
                            LOG.error(msg, cnfe);
                            throw new PortletException(msg, cnfe);
                        }
                        catch (InstantiationException ie) {
                            final String msg = "Could instatiate specified pre-interceptor class '" + sPreInterceptor + "'";
                            LOG.error(msg, ie);
                            throw new PortletException(msg, ie);
                        }
                        catch (IllegalAccessException iae) {
                            final String msg = "Could instatiate specified pre-interceptor class '" + sPreInterceptor + "'";
                            LOG.error(msg, iae);
                            throw new PortletException(msg, iae);
                        }
                        catch (ClassCastException cce) {
                            final String msg = "Could not cast '" + sPreInterceptor + "' to 'edu.wisc.my.webproxy.beans.interceptors.PreInterceptor'";
                            LOG.error(msg, cce);
                            throw new PortletException(msg, cce);
                        }
                    }

FileLine
edu\wisc\my\webproxy\portlet\WebProxyPortlet.java277
edu\wisc\my\webproxy\portlet\WebProxyPortlet.java911
                    final String[] headerValues = pp.getValues(HttpHeaderConfigImpl.HEADER_VALUE, new String[0]);
                    if (headerNames.length == headerValues.length) {
                        final List<Header> headerList = new ArrayList<Header>(headerNames.length);
                        
                        for (int headerIndex = 0; headerIndex < headerNames.length; headerIndex++) {
                            final Header h = httpRequest.createHeader();
                            h.setName(headerNames[headerIndex]);
                            h.setValue(headerValues[headerIndex]);
                            headerList.add(h);
                        }
                        
                        httpRequest.setHeaders(headerList.toArray(new Header[headerList.size()]));
                    }
                    else {
                        LOG.error("Invalid data in preferences. Header name array length does not equal header value array length");
                    }

FileLine
edu\wisc\my\webproxy\beans\filtering\ClippingFilter.java172
edu\wisc\my\webproxy\beans\filtering\ClippingFilter.java235
                    for (int myPathIndex = 0; myPathIndex < pathPartList.size(); myPathIndex++) {
                        final String currentPathPart = currentPath.get(myPathIndex);
                        final String testPathPart = pathPartList.get(myPathIndex);
                        
                        if (myPathIndex < currentPath.size() && currentPathPart != null && currentPathPart.equalsIgnoreCase(testPathPart)) {
                            xPathMatch = true;
                            break;
                        }
                        else {
                            xPathMatch = false;
                        }
                    }
                }
            }
            if (sElement != null)
                for (final String testElement : this.sElement) {
                    if (currentPath.contains(testElement)) {
                        elementMatch = true;
                        break;
                    }
                    else {
                        elementMatch = false;
                    }
                }

            if (xPathMatch || elementMatch || commentMatch) {
                super.endElement(uri, localName, qName);

FileLine
edu\wisc\my\webproxy\beans\http\HttpClientStateImpl.java82
edu\wisc\my\webproxy\beans\http\HttpClientStateImpl.java100
        final org.apache.commons.httpclient.Credentials creds = this.httpClientState.getProxyCredentials(AuthScope.ANY);
        
        if (creds instanceof UsernamePasswordCredentials) {
            final UsernamePasswordCredentials upCreds = (UsernamePasswordCredentials)creds;
            return new Credentials(upCreds.getUserName(), upCreds.getPassword());
        }
        else if (creds instanceof org.apache.commons.httpclient.NTCredentials) {
            final org.apache.commons.httpclient.NTCredentials ntCreds = (org.apache.commons.httpclient.NTCredentials)creds;
            return new NtCredentials(ntCreds.getUserName(), ntCreds.getPassword(), ntCreds.getHost(), ntCreds.getDomain());
        }
        
        return null;
    }

    /* (non-Javadoc)
     * @see edu.wisc.my.webproxy.beans.http.State#setCookies(edu.wisc.my.webproxy.beans.http.Cookie[])
     */
    public void addCookies(Cookie[] cookies) {