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

DriverManager has insufficient message for bad URL: No suitable driver

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 1.4.2
    • core-libs
    • beta2
    • x86
    • windows_xp
    • Not verified

      FULL PRODUCT VERSION :
      java version "1.4.2_07"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      If the DriverManager.getConnection is called with a bad URL (e.g."foo"), the method throws an exception with a message "No suitable driver". This message is likely to be reported to the user, but it sends the user on the wrong path to try to fix the situation by trying to deal with the drivers - instead of fixing the URL.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Call

      DriverManager.getConnection("foo");


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The error message should include more and better information so that the user can figure out and fix the problem. The error message could say that the URI has no scheme, or it could at least include the URL in the text of the message to say that the driver cannot be found for that particular URL. In fact, the argument is not really a URL anyway but a URI.
      ACTUAL -
      The error message only says "No suitable driver"

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No suitable driver

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------


      DriverManager.getConnection("foo");

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Must check URL manually before calling DriverManager methods - e.g. by constructing a URI object, checking the scheme, scheme specific part, etc.

            lancea Lance Andersen
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: