Derby
  1. Derby
  2. DERBY-1256

Remove usage of non-portable methods in derby code

    Details

    • Urgency:
      Normal
    • Issue & fix info:
      High Value Fix

      Description

      Remove usage of non portable methods that use native encoding as they could potentially lead to bugs on platforms with different encodings.

      Replace with code using fixed conversion, or alternative mechanisms.
      If the call is required its use should be commented as to why it is required.

      I went through the classes in java.io package in jdk1.4.2 and have come up with a list of methods, constructors in the java.io.* classes that use native encoding and did a java search on eclipse for the code in java/engine, java/testing, java/drda, java/client.

      1)ByteArrayOutputStream.toString()
      testing - DerbyNetNewServer:
      System.out.println( bos.toString());
      server- NetworkServerCtrlInfo.getCLSSysInfo, getNetSysInfo,

      2)DataInputStream.readLine()
      ArrayInputStream - org.apache.derby.iapi.services.io - java/engine
      readLine()
      CorruptRandomAccessFile - org.apache.derbyTesting.functionTests.util.corruptio - java/testing
      readLine()

      3)InputStreamReader(InputStream)
      StatementDuration - org.apache.derby.diag - java/engine -
      next()
      ImportReadData - org.apache.derby.impl.load - java/engine -
      realOpenFile()
      ErrorLogReader - org.apache.derby.diag - java/engine -
      next()
      UCode_CharStream - org.apache.derby.impl.sql.compile - java/engine -
      ReInit(InputStream, int, int, int)
      xmlBinding - org.apache.derbyTesting.functionTests.tests.lang - java/testing -
      insertDocWithDTD(Connection, String, String, String, int)
      BaseMonitor - org.apache.derby.impl.services.monitor - java/engine -
      dumpTempWriter(boolean)
      DbFile - org.apache.derbyTesting.functionTests.util - java/testing -
      stringFromFile(InputStream)
      HandleResult - org.apache.derbyTesting.functionTests.harness - java/testing -
      handleResult(int, InputStream, InputStream, PrintWriter, String) (2 matches)
      ProcessStreamResult - org.apache.derbyTesting.functionTests.harness - java/testing -
      run()
      FileCompare - org.apache.derbyTesting.functionTests.harness - java/testing -
      doSysDiff(InputStream, String, String, File, PrintWriter)
      exec(String, File, PrintWriter, String, String, String, int, boolean, boolean, String, String, String)
      UCode_CharStream(InputStream, int, int, int)
      insertFiles(Connection, String, String, int) (2 matches)

      4) OuputStreamWriter(OutputStream)

      ExportWriteData - org.apache.derby.impl.load - java/engine
      openFile()
      ProcessStreamResult - org.apache.derbyTesting.functionTests.harness - java/testing
      ProcessStreamResult(InputStream, BufferedOutputStream, String, String)
      RawStore - org.apache.derby.impl.store.raw - java/engine
      run()

      5) RandomAccessFile.readLine()
      ArrayInputStream - org.apache.derby.iapi.services.io - java/engine -
      readLine()
      CorruptRandomAccessFile - org.apache.derbyTesting.functionTests.util.corruptio - java/testing -
      readLine()
      DerbyNetAutoStart - org.apache.derbyTesting.functionTests.tests.derbynet - java/testing -
      checkLog(RandomAccessFile, String[])

      PrintStream and PrintWriter , print methods uses platforms default charset encoding.
      =============
      There are also non portable methods in String class
      new String(byte[])
      new String(byte[],int,int)
      String.getBytes(). There are jira entries already for these- DERBY-900, DERBY-901,DERBY-902,DERBY-903.

        Issue Links

          Activity

          Sunitha Kambhampati created issue -
          Sunitha Kambhampati made changes -
          Field Original Value New Value
          Component/s SQL [ 11408 ]
          Component/s Network Server [ 11410 ]
          Rick Hillegas made changes -
          Urgency Normal
          Rick Hillegas made changes -
          Fix Version/s 10.2.2.0 [ 12312027 ]
          Fix Version/s 10.2.1.0 [ 11187 ]
          Rick Hillegas made changes -
          Fix Version/s 10.2.2.0 [ 12312027 ]
          Fix Version/s 10.2.3.0 [ 12312215 ]
          Andrew McIntyre made changes -
          Fix Version/s 10.2.3.0 [ 12312215 ]
          Kathey Marsden made changes -
          Derby Categories [High Value Fix]
          Dag H. Wanvik made changes -
          Link This issue relates to DERBY-684 [ DERBY-684 ]
          Myrna van Lunteren made changes -
          Link This issue is related to DERBY-4019 [ DERBY-4019 ]
          Dag H. Wanvik made changes -
          Issue & fix info [High Value Fix]
          Kathey Marsden made changes -
          Labels derby_triage10_5_2
          Kathey Marsden made changes -
          Affects Version/s 10.1.2.1 [ 12310615 ]
          Kathey Marsden made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 10.9.0.0 [ 12316344 ]
          Resolution Fixed [ 1 ]
          Kathey Marsden made changes -
          Labels derby_triage10_5_2 derby_backport_reject_10_5 derby_backport_reject_10_6 derby_backport_reject_10_7 derby_backport_reject_10_8 derby_triage10_5_2
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12361655 ] Default workflow, editable Closed status [ 12802783 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Sunitha Kambhampati
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development