"John H. Embretsen (JIRA)" <[EMAIL PROTECTED]> writes: > [ > https://issues.apache.org/jira/browse/DERBY-2274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503871 > ] > > John H. Embretsen commented on DERBY-2274: > ------------------------------------------ > > I'm afraid I'm not able to say whether or not you've done the right thing > wrt. the JUnit framework stuff (it looks OK to me), but I do have one comment > about the test itself (SSLTest.java). > > In the public void sslTest() method, there is the following code > > + try { > + // Should fail > + Connection c2 = DriverManager.getConnection(plain); > + c2.close(); > + } catch (SQLException e) { > + if (e.getCause() != null && > + e.getCause() instanceof > org.apache.derby.client.am.DisconnectException) { > + // Assumes protocol fail due to SSL on the other end > + } else { > + throw e; > + } > + }
Two more nits about this code fragment: 1) (e.getCause() != null) is redundant, since (e.getCause() instanceof DisconnectException) is false if e.getCause() returns null. 2) Would it be better to replace the contents of the catch block with a call to assertSQLState()? Or is the SQL state non-deterministic in this test? -- Knut Anders
