Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5094691

NullPointerException if native JDBC/ODBC library not found

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • None
    • 5.0
    • core-libs

    Description



      Name: js151677 Date: 08/31/2004


      A DESCRIPTION OF THE REQUEST:
      A simple modification would improve error messages when the native JDBC/ODBC library is not found.

      In JdbcOdbcDriver.initialize(), there is this bit of code:

        try {
          OdbcApi = new JdbcOdbc(tracer, nativePrefix);
          ....
        } catch (Exception exception) {
              ...log...
        }

      This drops the SQLException thrown by the JdbcOdbc constructor on the floor. The "OdbcApi" variable remains null, causing a NullPointerException a bit later.

      Simple fix: add "catch (SQLException e) { throw e; }" to allow the more useful exception to get through to the user.

      JUSTIFICATION :
      An easy enough fix to improve a strange error message. A few people have run into this; google for it, or search the Java forums.
      (Incident Review ID: 301469)
      ======================================================================

      Attachments

        Activity

          People

            ahandasunw Amit Handa (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: