dblook should not swallow ClassNotFoundException regardless of -verbose setting
-------------------------------------------------------------------------------
Key: DERBY-5570
URL: https://issues.apache.org/jira/browse/DERBY-5570
Project: Derby
Issue Type: Bug
Components: Tools
Affects Versions: 10.8.2.2
Reporter: Bryan Pendleton
Priority: Minor
When I (incorrectly) place only derbytools.jar in my classpath, dblook's
behavior is very confusing:
$ java -cp derbytools.jar org.apache.derby.tools.dblook -d
jdbc:derby://localhost:1527/mydb
-- Timestamp: 2012-01-17 06:53:12.968
-- Source database is: mydb
-- Connection URL is: jdbc:derby://localhost:1527/mydb
-- appendLogs: false
There is no hint of a problem; it just prints nothing and does nothing.
This is very confusing, and leads uses to mess about with the -d argument, etc.
When I add the -verbose flag, the real problem becomes clear:
$ java -cp derbytools.jar org.apache.derby.tools.dblook -d
jdbc:derby://localhost:1527/mydb -verbose
-- Timestamp: 2012-01-17 06:53:26.465
-- Source database is: mydb
-- Connection URL is: jdbc:derby://localhost:1527/mydb
-- appendLogs: false
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.derby.tools.dblook.loadDriver(dblook.java:325)
at org.apache.derby.tools.dblook.<init>(dblook.java:132)
at org.apache.derby.tools.dblook.main(dblook.java:97)
I think that dblook should be more careful about the exceptions that it's
quietly
swallowing, and in particular should not swallow a ClassNotFoundException.
That would make it much easier for users to figure out that the problem lies
with
their classpath, not with their connection URL.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira