[ https://issues.apache.org/jira/browse/CLOUDSTACK-9632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15710044#comment-15710044 ]
ASF GitHub Bot commented on CLOUDSTACK-9632: -------------------------------------------- Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1799#discussion_r90313790 --- Diff: server/test/org/apache/cloudstack/network/lb/CertServiceTest.java --- @@ -245,48 +245,48 @@ public void runUploadSslCertSelfSignedNoPassword() throws Exception { public void runUploadSslCertBadChain() throws IOException, IllegalAccessException, NoSuchFieldException { Assume.assumeTrue(isOpenJdk() || isJCEInstalled()); - String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name()); - String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name()); - String chainFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name()); + final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name()); + final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name()); + final String chainFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name()); - String cert = readFileToString(new File(certFile)); - String key = readFileToString(new File(keyFile)); - String chain = readFileToString(new File(chainFile)); + final String cert = readFileToString(new File(certFile)); + final String key = readFileToString(new File(keyFile)); + final String chain = readFileToString(new File(chainFile)); - CertServiceImpl certService = new CertServiceImpl(); + final CertServiceImpl certService = new CertServiceImpl(); //setting mock objects certService._accountMgr = Mockito.mock(AccountManager.class); - Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString()); + final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString()); when(certService._accountMgr.getAccount(anyLong())).thenReturn(account); certService._domainDao = Mockito.mock(DomainDao.class); - DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain"); + final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain"); when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain); certService._sslCertDao = Mockito.mock(SslCertDao.class); when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO()); //creating the command - UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn(); - Class<?> _class = uploadCmd.getClass().getSuperclass(); + final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn(); + final Class<?> klazz = uploadCmd.getClass().getSuperclass(); - Field certField = _class.getDeclaredField("cert"); + final Field certField = klazz.getDeclaredField("cert"); certField.setAccessible(true); certField.set(uploadCmd, cert); - Field keyField = _class.getDeclaredField("key"); + final Field keyField = klazz.getDeclaredField("key"); keyField.setAccessible(true); keyField.set(uploadCmd, key); - Field chainField = _class.getDeclaredField("chain"); + final Field chainField = klazz.getDeclaredField("chain"); chainField.setAccessible(true); chainField.set(uploadCmd, chain); try { certService.uploadSslCert(uploadCmd); fail("The chain given is not the correct chain for the certificate"); - } catch (Exception e) { + } catch (final Exception e) { --- End diff -- Please consider refactoring this method to use `@Test(expected)` to eliminate this `try-catch` block. > Upgrade bountycastle to 1.55+ > ----------------------------- > > Key: CLOUDSTACK-9632 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9632 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Rohit Yadav > Assignee: Rohit Yadav > Fix For: Future, 4.10.0.0 > > > Upgrade bountycastle library to latest versions. -- This message was sent by Atlassian JIRA (v6.3.4#6332)