Derby
  1. Derby
  2. DERBY-3419

Incorrect error message in ij for disconnect with no active connections

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.2.2.0
    • Fix Version/s: None
    • Component/s: Tools
    • Urgency:
      Low
    • Issue & fix info:
      Newcomer, Repro attached

      Description

      Using ij, before connecting to the database, when the disconnect command is issued, the error message which is printed is:IJ ERROR: Unable to establish connection

      bash-3.00# ij
      ij version 10.4
      ij> disconnect;
      IJ ERROR: Unable to establish connection

      The error message should be changed to "No connection available" for a better understanding.

      1. DERBY-3419.diff
        10 kB
        M.A.D.M Mallikarachchi

        Issue Links

          Activity

          Hide
          Daniel John Debrunner added a comment -

          Make the summary useful by not being a generic statement.

          Show
          Daniel John Debrunner added a comment - Make the summary useful by not being a generic statement.
          Hide
          Tiago R. Espinha added a comment -

          Triaged for 10.5.2.

          Assigned low urgency, checked new comer and repro attached.

          Show
          Tiago R. Espinha added a comment - Triaged for 10.5.2. Assigned low urgency, checked new comer and repro attached.
          Hide
          M.A.D.M Mallikarachchi added a comment -

          I hope that the bug is fixed. I am attaching the code. Thank You!

          Show
          M.A.D.M Mallikarachchi added a comment - I hope that the bug is fixed. I am attaching the code. Thank You!
          Hide
          Bryan Pendleton added a comment -

          Thanks for looking at this issue.

          I think that the error arises as follows:

          at org.apache.derby.tools.JDBCDisplayUtil.checkNotNull(JDBCDisplayUtil.java:738)
          at org.apache.derby.impl.tools.ij.ij.haveConnection(ij.java:280)
          at org.apache.derby.impl.tools.ij.ij.DisconnectStatement(ij.java:1981)
          at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1112)
          at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:353)
          at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:251)
          at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
          at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
          at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
          at org.apache.derby.tools.ij.main(ij.java:59)

          I think that the fix should be in the DisconnectStatement method.

          Note that it's a bit tricky to follow this part of the code because ij.java is a generated file, generated from the parser file ij.jj.

          So you can find the generated ij.java code in the generated code area of your build, but the changes must be made to the ij.jj parser file.

          Here is an idea to try:

          1. in ijException.java, add a new helper method, named noCurrentConnection() that throws an exception with the message IJ_NoCurreConne, following the existing pattern in that class.
          2. in ij.jj, in the DisconnectStatement method, change the handling of the case where ( a == null ) and (n == null) to add:

            if (currentConnEnv.getSession() == null)
            throw ijException.noCurrentConnection();

          Can you try that approach, and see if it seems like it would work? Thanks!

          Show
          Bryan Pendleton added a comment - Thanks for looking at this issue. I think that the error arises as follows: at org.apache.derby.tools.JDBCDisplayUtil.checkNotNull(JDBCDisplayUtil.java:738) at org.apache.derby.impl.tools.ij.ij.haveConnection(ij.java:280) at org.apache.derby.impl.tools.ij.ij.DisconnectStatement(ij.java:1981) at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1112) at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:353) at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:251) at org.apache.derby.impl.tools.ij.Main.go(Main.java:229) at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184) at org.apache.derby.impl.tools.ij.Main.main(Main.java:75) at org.apache.derby.tools.ij.main(ij.java:59) I think that the fix should be in the DisconnectStatement method. Note that it's a bit tricky to follow this part of the code because ij.java is a generated file, generated from the parser file ij.jj . So you can find the generated ij.java code in the generated code area of your build, but the changes must be made to the ij.jj parser file. Here is an idea to try: in ijException.java, add a new helper method, named noCurrentConnection() that throws an exception with the message IJ_NoCurreConne , following the existing pattern in that class. in ij.jj, in the DisconnectStatement method, change the handling of the case where ( a == null ) and (n == null) to add: if (currentConnEnv.getSession() == null) throw ijException.noCurrentConnection(); Can you try that approach, and see if it seems like it would work? Thanks!

            People

            • Assignee:
              Unassigned
              Reporter:
              Deepthi Devaki A R
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development