Skip to content

Commit

Permalink
TEIIDDES-879: Surround loading of class with exception handling
Browse files Browse the repository at this point in the history
* If the classloader fails to load the class, avoid letting an exception
  thrown so that the version can be found using the runtime client
  registry.

* This mitigates the possibility that users still have the original
  default Teiid driver instance.
  • Loading branch information
Paul Richardson committed Jun 25, 2013
1 parent 606e809 commit 98002a3
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ protected Object createConnection( ClassLoader classloader ) throws Throwable {
* The classloader is provided to allow access to the JAR_LIST of the connection
* properties. Thus, the driver should be contained in this list.
*/
Driver jdbcDriver = (Driver) classloader.loadClass(driverClass).newInstance();
if (jdbcDriver != null)
return jdbcDriver.connect(connectURL, connectionProps);
Driver jdbcDriver = null;
try {
jdbcDriver = (Driver) classloader.loadClass(driverClass).newInstance();
if (jdbcDriver != null)
return jdbcDriver.connect(connectURL, connectionProps);
} catch (Exception ex) { /* Do nothing */ }

/*
* Failed to find the driver with the given classloader so try to get a match from
Expand Down

0 comments on commit 98002a3

Please sign in to comment.