NPE in ij while attempting to execute a query after a failed named connection creation ---------------------------------------------------------------------------------------
Key: DERBY-1604 URL: http://issues.apache.org/jira/browse/DERBY-1604 Project: Derby Issue Type: Bug Components: Tools Affects Versions: 10.1.3.1, 10.1.3.0, 10.1.2.1, 10.1.1.0, 10.0.2.1, 10.0.2.0, 10.0.2.2 Environment: Windows 2000, jdk 1.5 Reporter: Rajesh Kartha Priority: Minor I came across this by chance. While attempting to execute a statement after a failed named connection, ij throws a NPE. Following are ij steps that reproduces this error: ij version 10.2 ij> connect 'jdbc:derby:grntrvkdb;create=true' user 'raj' as raj; WARNING 01J01: Database 'grntrvkdb' not created, connection made to existing database instead. ij> show connections; RAJ* - jdbc:derby:grntrvkdb * = current connection ij> connect 'jdbc:derby:grntrvkdb;create=true' user 'raj2' as raj2; WARNING 01J01: Database 'grntrvkdb' not created, connection made to existing database instead. ij(RAJ2)> show connections; RAJ - jdbc:derby:grntrvkdb RAJ2* - jdbc:derby:grntrvkdb * = current connection ij(RAJ2)> disconnect; ij> show connections; RAJ - jdbc:derby:grntrvkdb No current connection ij> connect 'jdbc:derby:grntrvkdb;create=true' user 'raj' as raj; IJ ERROR: Already have a connection named RAJ org.apache.derby.impl.tools.ij.ijException: Already have a connection named RAJ at org.apache.derby.impl.tools.ij.ijException.alreadyHaveConnectionNamed (ijException.java:78) at org.apache.derby.impl.tools.ij.ij.addSession(ij.java:418) at org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:875) at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:723) at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:553) at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:289) at org.apache.derby.impl.tools.ij.Main.go(Main.java:207) at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:173) at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55) at org.apache.derby.tools.ij.main(ij.java:60) ij> show connections; RAJ - jdbc:derby:grntrvkdb No current connection ij> select * from sys.systables; JAVA ERROR: java.lang.NullPointerException java.lang.NullPointerException at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:289) at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433) at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:312) at org.apache.derby.impl.tools.ij.Main.go(Main.java:207) at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:173) at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55) at org.apache.derby.tools.ij.main(ij.java:60) ij> I expected an error like "IJ ERROR: Unable to establish connection" since there does not exist any connection to execute this statement. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira