CPD Results

The following document contains the results of PMD's CPD

Duplications

FileLine
org/apache/geronimo/console/car/DownloadCARHandler.java48
org/apache/geronimo/console/car/ViewPluginDownloadHandler.java44
        super(VIEW_FOR_DOWNLOAD_MODE, "/WEB-INF/view/car/viewForDownload.jsp");
    }

    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
        String configId = request.getParameter("configId");
        String repo = request.getParameter("repository");
        String user = request.getParameter("repo-user");
        String pass = request.getParameter("repo-pass");
        response.setRenderParameter("configId", configId);
        response.setRenderParameter("repository", repo);
        if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
        if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);

        return getMode();
    }

    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
        String configId = request.getParameter("configId");
        String repo = request.getParameter("repository");
        String user = request.getParameter("repo-user");
        String pass = request.getParameter("repo-pass");
        PluginMetadata config = null;
        try {
            PluginList list = (PluginList) request.getPortletSession(true).getAttribute(CONFIG_LIST_SESSION_KEY);
            if(list == null) {
                list = PortletManager.getCurrentServer(request).getPluginInstaller().listPlugins(new URL(repo), user, pass);
                request.getPortletSession(true).setAttribute(CONFIG_LIST_SESSION_KEY, list);
            }
            for (int i = 0; i < list.getPlugins().length; i++) {
                PluginMetadata metadata = list.getPlugins()[i];
                if(metadata.getModuleId().toString().equals(configId)) {
                    config = metadata;
                    break;
                }
            }
        } catch (FailedLoginException e) {
            throw new PortletException("Invalid login for Maven repository '"+repo+"'", e);
        }
        if(config == null) {
            throw new PortletException("No configuration found for '"+configId+"'");
        }
        request.setAttribute("configId", configId);
        request.setAttribute("plugin", config);

FileLine
org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java83
org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java123
            for (int i = 0; i < modules.length; i++) {
                ResourceAdapterModule module = modules[i];

                JMSResourceSummary target = null;
                for (int j = 0; j < resources.size(); j++) {
                    JMSResourceSummary data = (JMSResourceSummary) resources.get(j);
                    if (data.adapterObjectName.equals(module.getObjectName())) {
                        target = data;
                        break;
                    }
                }
                if (target == null) {
                    ResourceAdapter[] adapters = PortletManager.getResourceAdapters(renderRequest, module);
                    String name = null;
                    if (adapters.length == 1 && adapters[0].getJCAResources().length == 1) {
                        JCAResource[] resource = PortletManager.getJCAResources(renderRequest, adapters[0]);
                        if (resource.length == 1 && resource[0].getResourceAdapterInstances().length == 1) {
                            name = ObjectName.getInstance(resource[0].getResourceAdapterInstanceNames()[0]).getKeyProperty(NameFactory.J2EE_NAME);
                        }
                    }
                    if (name == null) {
                        name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
                    }
                    target = new JMSResourceSummary(PortletManager.getConfigurationFor(renderRequest, PortletManager.getNameFor(renderRequest, module)).toString(),
                            module.getObjectName(), name, ((GeronimoManagedBean) module).getState());
                    resources.add(target);
                }

FileLine
org/apache/geronimo/console/webmanager/ConnectorPortlet.java315
org/apache/geronimo/console/webmanager/ConnectorPortlet.java367
                        renderRequest.setAttribute("minThreads", String.valueOf(minThreads));
                        KeystoreManager mgr = PortletManager.getCurrentServer(renderRequest).getKeystoreManager();
                        KeystoreInstance[] stores = mgr.getUnlockedKeyStores();
                        String[] storeNames = new String[stores.length];
                        for (int i = 0; i < storeNames.length; i++) {
                            storeNames[i] = stores[i].getKeystoreName();
                        }
                        renderRequest.setAttribute("keyStores", storeNames);
                        KeystoreInstance[] trusts = mgr.getUnlockedTrustStores();
                        String[] trustNames = new String[trusts.length];
                        for (int i = 0; i < trustNames.length; i++) {
                            trustNames[i] = trusts[i].getKeystoreName();
                        }
                        renderRequest.setAttribute("trustStores", trustNames);
                        Map aliases = new HashMap();
                        for (int i = 0; i < stores.length; i++) {
                            try {
                                aliases.put(stores[i].getKeystoreName(), stores[i].getUnlockedKeys());
                            } catch (KeystoreIsLocked locked) {}
                        }
                        renderRequest.setAttribute("unlockedKeys", aliases);
                    }
                    else if (server.equals(WEB_SERVER_TOMCAT)) {
                        //todo:   Any Tomcat specific processing?
                    }
                    else {
                        //todo:   Handle "should not occur" condition
                    }
                    renderRequest.setAttribute("mode", "save");

FileLine
org/apache/geronimo/console/webmanager/ConnectorPortlet.java121
org/apache/geronimo/console/webmanager/ConnectorPortlet.java203
                if(connector instanceof SecureConnector) {
                    String keystoreType = actionRequest.getParameter("keystoreType");
                    String keystoreFile = actionRequest.getParameter("keystoreFile");
                    String privateKeyPass = actionRequest.getParameter("privateKeyPassword");
                    String keystorePass = actionRequest.getParameter("keystorePassword");
                    String secureProtocol = actionRequest.getParameter("secureProtocol");
                    String algorithm = actionRequest.getParameter("algorithm");
                    String truststoreType = actionRequest.getParameter("truststoreType");
                    String truststoreFile = actionRequest.getParameter("truststoreFile");
                    String truststorePass = actionRequest.getParameter("truststorePassword");
                    boolean clientAuth = isValid(actionRequest.getParameter("clientAuth"));
                    SecureConnector secure = (SecureConnector) connector;
                    if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);}
                    if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);}
                    if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);}
                    if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);}
                    if(isValid(algorithm)) {secure.setAlgorithm(algorithm);}
                    secure.setClientAuthRequired(clientAuth);
                    if(server.equals(WEB_SERVER_JETTY)) {
                        if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}

FileLine
org/apache/geronimo/console/certmanager/actions/GenerateKeyPair.java100
org/apache/geronimo/console/certmanager/actions/ViewKeyStore.java48
        try {
            AbstractName name = portlet.getKeyStoreObjectName();

            String keyStoreType = (String) KernelRegistry.getSingleKernel()
                    .getAttribute(name, "keyStoreType");
            String keyStoreProvider = (String) KernelRegistry.getSingleKernel()
                    .getAttribute(name, "keyStoreProvider");
            String keyStoreLocation = (String) KernelRegistry.getSingleKernel()
                    .getAttribute(name, "keyStoreLocation");

            request.setAttribute("org.apache.geronimo.console.keystore.type", keyStoreType);
            request.setAttribute("org.apache.geronimo.console.keystore.provider",
                    keyStoreProvider);
            request.setAttribute("org.apache.geronimo.console.keystore.location",
                    keyStoreLocation);

            List storelist = (List) KernelRegistry.getSingleKernel().invoke(
                    name, "getKeyStoreEntries");

            Iterator iter = storelist.iterator();
            while (iter.hasNext()) {
                portlet.getPortletContext().log("store-item = " + iter.next());
            }

            request.setAttribute("org.apache.geronimo.console.keystore.list", storelist);
            request.setAttribute("org.apache.geronimo.console.keystore.size", String
                    .valueOf(storelist.size()));
        } catch (Exception e) {
            throw new PortletException(e);
        }

        rd = portlet.getPortletContext().getRequestDispatcher(
                "/WEB-INF/view/certmanager/viewKeyStoreNormal.jsp");

FileLine
org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java789
org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java626
    }

    private void loadDriverJARList(RenderRequest renderRequest) {
        // List the available JARs
        List list = new ArrayList();
        ListableRepository[] repos = PortletManager.getCurrentServer(renderRequest).getRepositories();
        for (int i = 0; i < repos.length; i++) {
            ListableRepository repo = repos[i];

            SortedSet artifacts = repo.list();
            outer:
            for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
                Artifact artifact = (Artifact) iterator.next();
                String test = artifact.toString();
                // todo should only test groupId and should check for long (org.apache.geronimo) and short form
                for (int k = 0; k < SKIP_ENTRIES_WITH.length; k++) {
                    String skip = SKIP_ENTRIES_WITH[k];
                    if (test.indexOf(skip) > -1) {
                        continue outer;
                    }
                }
                list.add(test);
            }
        }
        Collections.sort(list);
        renderRequest.setAttribute("jars", list);

FileLine
org/apache/geronimo/console/infomanager/ServerInfoPortlet.java82
org/apache/geronimo/console/internaldb/InternalDBPortlet.java74
        renderRequest.setAttribute("internalDB", internalDB);

        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
            normalView.include(renderRequest, renderResponse);
        } else {
            maximizedView.include(renderRequest, renderResponse);
        }
    }

    protected void doHelp(RenderRequest renderRequest,
            RenderResponse renderResponse) throws PortletException, IOException {
        helpView.include(renderRequest, renderResponse);
    }

    public void init(PortletConfig portletConfig) throws PortletException {
        super.init(portletConfig);
        normalView = portletConfig.getPortletContext().getRequestDispatcher(
                NORMALVIEW_JSP);
        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
                MAXIMIZEDVIEW_JSP);
        helpView = portletConfig.getPortletContext().getRequestDispatcher(
                HELPVIEW_JSP);
    }

    public void destroy() {
        normalView = null;
        maximizedView = null;
        helpView = null;
        super.destroy();
    }

}

FileLine
org/apache/geronimo/console/infomanager/ServerInfoPortlet.java84
org/apache/geronimo/console/welcome/WelcomePortlet.java63
        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
            normalView.include(renderRequest, renderResponse);
        } else {
            maximizedView.include(renderRequest, renderResponse);
        }
    }

    protected void doHelp(RenderRequest renderRequest,
            RenderResponse renderResponse) throws PortletException, IOException {
        helpView.include(renderRequest, renderResponse);
    }

    public void init(PortletConfig portletConfig) throws PortletException {
        super.init(portletConfig);
        normalView = portletConfig.getPortletContext().getRequestDispatcher(
                NORMALVIEW_JSP);
        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
                MAXIMIZEDVIEW_JSP);
        helpView = portletConfig.getPortletContext().getRequestDispatcher(
                HELPVIEW_JSP);
    }

    public void destroy() {
        normalView = null;
        maximizedView = null;
        helpView = null;
        super.destroy();
    }

}

FileLine
org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java47
org/apache/geronimo/console/keystores/ConfirmKeyHandler.java79
        request.setAttribute("certC", certC);
    }

    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
        String keystore = request.getParameter("keystore");
        String alias = request.getParameter("alias");
        String password = request.getParameter("password");
        String keySize = request.getParameter("keySize");
        String algorithm = request.getParameter("algorithm");
        String valid = request.getParameter("valid");
        String certCN = request.getParameter("certCN");
        String certOU = request.getParameter("certOU");
        String certO = request.getParameter("certO");
        String certL = request.getParameter("certL");
        String certST = request.getParameter("certST");
        String certC = request.getParameter("certC");

FileLine
org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java876
org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java469
                File rarFile = PortletManager.getRepositoryEntry(request, data.getRarURI());
                ConnectorDeployable deployable = new ConnectorDeployable(rarFile.toURL());
                DeploymentConfiguration config = mgr.createConfiguration(deployable);
                final DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
                Connector15DCBRoot root = (Connector15DCBRoot) config.getDConfigBeanRoot(ddBeanRoot);
                ConnectorDCB connector = (ConnectorDCB) root.getDConfigBean(ddBeanRoot.getChildBean(root.getXpaths()[0])[0]);

                EnvironmentData environment = new EnvironmentData();
                connector.setEnvironment(environment);
                org.apache.geronimo.deployment.service.jsr88.Artifact configId = new org.apache.geronimo.deployment.service.jsr88.Artifact();
                environment.setConfigId(configId);
                configId.setGroupId("console.jms");

FileLine
org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java964
org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java614
                    log.debug("Writing JMS Resource deployment plan to "+tempFile.getAbsolutePath());
                    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tempFile));
                    config.save(out);
                    out.flush();
                    out.close();
                    Target[] targets = mgr.getTargets();
                    ProgressObject po = mgr.distribute(targets, rarFile, tempFile);
                    waitForProgress(po);
                    if(po.getDeploymentStatus().isCompleted()) {
                        TargetModuleID[] ids = po.getResultTargetModuleIDs();
                        po = mgr.start(ids);
                        waitForProgress(po);
                        if(po.getDeploymentStatus().isCompleted()) {
                            ids = po.getResultTargetModuleIDs();

FileLine
org/apache/geronimo/console/keystores/GenerateCSRHandler.java36
org/apache/geronimo/console/keystores/ImportCAReplyHandler.java36
        super(IMPORT_CA_REPLY, "/WEB-INF/view/keystore/importCAReply.jsp");
    }

    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
    	String id = request.getParameter("id");
    	String alias = request.getParameter("alias");
        response.setRenderParameter("id", id);
        response.setRenderParameter("alias", alias);
        return getMode();
    }
	public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
		String id = request.getParameter("id");
    	String alias = request.getParameter("alias");
        request.setAttribute("id", id);
        request.setAttribute("alias", alias);

FileLine
org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java51
org/apache/geronimo/console/keystores/ConfirmKeyHandler.java52
        String keystore = request.getParameter("keystore");
        String alias = request.getParameter("alias");
        String password = request.getParameter("password");
        String keySize = request.getParameter("keySize");
        String algorithm = request.getParameter("algorithm");
        String valid = request.getParameter("valid");
        String certCN = request.getParameter("certCN");
        String certOU = request.getParameter("certOU");
        String certO = request.getParameter("certO");
        String certL = request.getParameter("certL");
        String certST = request.getParameter("certST");
        String certC = request.getParameter("certC");

FileLine
org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java122
org/apache/geronimo/console/welcome/WelcomePortlet.java68
    }

    protected void doHelp(RenderRequest renderRequest,
                          RenderResponse renderResponse) throws PortletException, IOException {
        helpView.include(renderRequest, renderResponse);
    }

    public void init(PortletConfig portletConfig) throws PortletException {
        super.init(portletConfig);
        normalView = portletConfig.getPortletContext().getRequestDispatcher(
                NORMALVIEW_JSP);
        maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
                MAXIMIZEDVIEW_JSP);
        helpView = portletConfig.getPortletContext().getRequestDispatcher(
                HELPVIEW_JSP);
    }

    public void destroy() {
        normalView = null;
        maximizedView = null;
        helpView = null;
        super.destroy();
    }
}