[ 
https://issues.apache.org/jira/browse/DERBY-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665771#action_12665771
 ] 

Knut Anders Hatlen commented on DERBY-1256:
-------------------------------------------

The use of InputStreamReader(InputStream) in ReplicationRun looks safe to me. 
The stream returned by Process.getInputStream() will use the default encoding 
of the platform, so the reader that decodes it should also use the default 
encoding.

When you tested with file.encoding=UTF-16, did you make sure that the 
subprocesses also had that property set? If the subprocesses had different 
encoding than the main process, I guess there could be inconsistencies when 
decoding the output (though decoding the process output does not seem to be the 
problem, judging by the stack trace).

Note also that the file.encoding property is not supposed to be modified, so 
any problems seen while running with that property set can just as well be in 
the JDK as in Derby. See for instance the evaluation comments in this bug 
report: http://bugs.sun.com/view_bug.do?bug_id=4163515

> Remove usage of non-portable methods in derby code
> --------------------------------------------------
>
>                 Key: DERBY-1256
>                 URL: https://issues.apache.org/jira/browse/DERBY-1256
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server, SQL, Store, Test
>            Reporter: Sunitha Kambhampati
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to