cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhtyd <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1799: CLOUDSTACK-9632: Upgrade bouncy castle to ver...
Date Thu, 01 Dec 2016 08:38:22 GMT
Github user rhtyd commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1799#discussion_r90402383
  
    --- 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);
     
                 if (chainInput != null) {
    -                chain = parseChain(chainInput);
    +                chain = CertificateHelper.parseChain(chainInput);
                 }
     
    -        } catch (IOException e) {
    +        } catch (final IOException | CertificateException e) {
                 throw new IllegalArgumentException("Parsing certificate/key failed: " + e.getMessage(),
e);
             }
     
             validateCert(cert, chainInput != null ? true : false);
             validateKeys(cert.getPublicKey(), key);
     
    -        if (chainInput != null)
    +        if (chainInput != null) {
                 validateChain(chain, cert);
    +        }
         }
     
    -    public SslCertResponse createCertResponse(SslCertVO cert, List<LoadBalancerCertMapVO>
lbCertMap) {
    -        SslCertResponse response = new SslCertResponse();
    +    public SslCertResponse createCertResponse(final SslCertVO cert, final List<LoadBalancerCertMapVO>
lbCertMap) {
    --- End diff --
    
    Fixed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message