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

JdbcOdbcObject tracing uses deprecated API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 1.4.0
    • 1.2.0
    • core-libs
    • beta
    • generic
    • generic



      Name: stC104175 Date: 07/19/2000


      The tracing methods in sun.jdbc.odbc.JdbcOdbcObject use
      java.sql.DriverManager.getLogStream(), which is deprecated. A
      non-deprecated API (DriverManager.getLogWriter() and
      DriverManager.println(String message)) is available. In fact, I believe
      drivers are supposed to call DriverManager.println to output messages,
      instead of explicitly printing themselves. Why is the deprecated API
      being used, and printing done explicitly?

      Here is the relevant code, from sun.jdbc.odbc.JdbcOdbcObject.
      protected static boolean isTracing ()
      {
      return (DriverManager.getLogStream () != null);
      }

      (Note that if the user calls DriverManger.setLogWriter, the logStream
      is set to null. So apparently the isTracing method only applies to the
      deprecated logStream API.)

      protected static void trace (
      String outLine)
      {
      java.io.PrintStream outStream = DriverManager.getLogStream ();

      // Sanity check to ensure we have a print stream

      if (outStream != null) {
      outStream.println (outLine);
      }
      }

      protected static void trace (
      String outLine,
      boolean advance)
      {
      // If advancing line, use default implementation

      if (advance) {
      trace (outLine);
      }

      java.io.PrintStream outStream = DriverManager.getLogStream ();

      // Sanity check to ensure we have a print stream

      if (outStream != null) {
      outStream.print (outLine);
      }
      }
      (Review ID: 107379)
      ======================================================================

            jellissunw Jon Ellis (Inactive)
            stompkinsunw Sean Tompkins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: