Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1799#discussion_r90338425 --- Diff: server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java --- @@ -240,68 +245,71 @@ public void deleteSslCert(DeleteSslCertCmd deleteSslCertCmd) { } if (projectId != null) { - Project project = _projectMgr.getProject(projectId); + final Project project = _projectMgr.getProject(projectId); if (project == null) { throw new InvalidParameterValueException("Found no project with id: " + projectId); } - List<SslCertVO> projectCertVOList = _sslCertDao.listByAccountId(project.getProjectAccountId()); - if (projectCertVOList == null || projectCertVOList.isEmpty()) + final List<SslCertVO> projectCertVOList = _sslCertDao.listByAccountId(project.getProjectAccountId()); + if (projectCertVOList == null || projectCertVOList.isEmpty()) { return certResponseList; + } _accountMgr.checkAccess(caller, SecurityChecker.AccessType.UseEntry, true, projectCertVOList.get(0)); - for (SslCertVO cert : projectCertVOList) { + for (final SslCertVO cert : projectCertVOList) { certLbMap = _lbCertDao.listByCertId(cert.getId()); certResponseList.add(createCertResponse(cert, certLbMap)); } return certResponseList; } //reached here look by accountId - List<SslCertVO> certVOList = _sslCertDao.listByAccountId(accountId); - if (certVOList == null || certVOList.isEmpty()) + final List<SslCertVO> certVOList = _sslCertDao.listByAccountId(accountId); + if (certVOList == null || certVOList.isEmpty()) { return certResponseList; + } _accountMgr.checkAccess(caller, SecurityChecker.AccessType.UseEntry, true, certVOList.get(0)); - for (SslCertVO cert : certVOList) { + for (final SslCertVO cert : certVOList) { certLbMap = _lbCertDao.listByCertId(cert.getId()); certResponseList.add(createCertResponse(cert, certLbMap)); } return certResponseList; } - private void validate(String certInput, String keyInput, String password, String chainInput) { + private void validate(final String certInput, final String keyInput, final String password, final String chainInput) { Certificate cert; PrivateKey key; List<Certificate> chain = null; try { cert = parseCertificate(certInput); - key = parsePrivateKey(keyInput, password); + key = parsePrivateKey(keyInput); --- End diff -- Please consider consolidating the declaration of the `cert` and `key` variables into the `try` block, as well as, pulling lines 298-303 into the `try` block.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---