public void testBug36948() throws Exception {
  Connection _conn=null;
  try {
    Properties props=getPropertiesFromTestsuiteUrl();
    String host=props.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY,"localhost");
    String port=props.getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY,"3306");
    String db=props.getProperty(NonRegisteringDriver.DBNAME_PROPERTY_KEY,"test");
    String hostSpec=host;
    if (!NonRegisteringDriver.isHostPropertiesList(host)) {
      hostSpec=host + ":" + port;
    }
    props=getHostFreePropertiesFromTestsuiteUrl();
    props.remove("useSSL");
    props.remove("requireSSL");
    props.remove("verifyServerCertificate");
    props.remove("trustCertificateKeyStoreUrl");
    props.remove("trustCertificateKeyStoreType");
    props.remove("trustCertificateKeyStorePassword");
    final String url="jdbc:mysql://" + hostSpec + "/"+ db+ "?useSSL=true&requireSSL=true&verifyServerCertificate=true"+ "&trustCertificateKeyStoreUrl=file:src/testsuite/ssl-test-certs/test-cert-store&trustCertificateKeyStoreType=JKS"+ "&trustCertificateKeyStorePassword=password";
    _conn=DriverManager.getConnection(url,props);
  }
  finally {
    if (_conn != null) {
      _conn.close();
    }
  }
}

public void testBug36948 ( ) throws Exception { Connection _conn = null ; try { Properties props = getPropertiesFromTestsuiteUrl ( ) ; String host = props . getProperty ( NonRegisteringDriver . HOST_PROPERTY_KEY , "localhost" ) ; String port = props . getProperty ( NonRegisteringDriver . PORT_PROPERTY_KEY , "3306" ) ; String db = props . getProperty ( NonRegisteringDriver . DBNAME_PROPERTY_KEY , "test" ) ; String hostSpec = host ; if ( ! NonRegisteringDriver . isHostPropertiesList ( host ) ) { hostSpec = host + ":" + port ; } props = getHostFreePropertiesFromTestsuiteUrl ( ) ; props . remove ( "useSSL" ) ; props . remove ( "requireSSL" ) ; props . remove ( "verifyServerCertificate" ) ; props . remove ( "trustCertificateKeyStoreUrl" ) ; props . remove ( "trustCertificateKeyStoreType" ) ; props . remove ( "trustCertificateKeyStorePassword" ) ; final String url = "jdbc:mysql://" + hostSpec + "/" + db + "?useSSL=true&requireSSL=true&verifyServerCertificate=true" + "&trustCertificateKeyStoreUrl=file:src/testsuite/ssl-test-certs/test-cert-store&trustCertificateKeyStoreType=JKS" + "&trustCertificateKeyStorePassword=password" ; _conn = DriverManager . getConnection ( url , props ) ; } finally { if ( _conn != null ) { _conn . close ( ) ; } } }
tests fix for bug # 36948 - trying to use trustcertificatekeystoreurl causes an illegalstateexception . requires test certificates from testsuite / ssl - test - certs to be installed on the server being tested .
