You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Daniel John Debrunner (JIRA)" <de...@db.apache.org> on 2006/01/31 21:57:33 UTC

[jira] Created: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
---------------------------------------------------------------------------------------------

         Key: DERBY-901
         URL: http://issues.apache.org/jira/browse/DERBY-901
     Project: Derby
        Type: Bug
    Reporter: Daniel John Debrunner


These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.

org.apache.derby.impl.drda.DRDAConnThread

I generated this list using the Java search in eclipse for references to the constructors
String(byte[])
String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Sunitha Kambhampati updated DERBY-901:
--------------------------------------

    Attachment: derby901.p2.diff.txt
                derby901.p2.stat.txt

I am attaching the patch ( derby901.p2.diff.txt, derby901.p2.stat.txt)  to fix the remaining places that the String(byte[]) constructor is used in Network Server. 

remove use of default String(byte[]) constructor in 
--  trace method in DRDAConnThread.readAndSetParams to print out the hex string of the bytes .
--  use SQLERRMC_TOKEN_DELIMITER in SQLDIAGCI .

some cleanup 
 -- define the SQLERRMC_MESSAGE_DELIMITER in SystemProcedures and use that in DRDAConnThread.

Testing:
derbyall on linux /ibm142 ran OK with no new failures. 

Can someone please look at this patch.  Thanks. 

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java, derby901.p2.diff.txt, derby901.p2.stat.txt, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-901?page=comments#action_12374571 ] 

Sunitha Kambhampati commented on DERBY-901:
-------------------------------------------

There is one place in DRDAConnThread.readAndSetParams  where this non portable constructor is used.
ln 
				case  DRDAConstants.DRDA_TYPE_NFIXBYTE:
			{
				byte[] paramVal = reader.readBytes();
				if (SanityManager.DEBUG) 
					trace("fix bytes parameter value is: "+new String(paramVal));
				ps.setBytes(i+1, paramVal);
				break;
			}

I can see two ways of fixing this,.
1) to change the trace message to say uses native encoding and leave it at that . 
2) change String to use "UTF-8"  encoding and add code to catch the unsupported encoding exception. 

Does anyone have any opinions here ? 

Thanks. 

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by Sunitha Kambhampati <ks...@gmail.com>.
Kathey Marsden (JIRA) wrote:

>    [ http://issues.apache.org/jira/browse/DERBY-901?page=comments#action_12375182 ] 
>
>Kathey Marsden commented on DERBY-901:
>--------------------------------------
>
>Sunitha. I am sorry I just got to this commit and it is out of date with the DERBY-822 changes. Can you sync up and resubmit?
>
>  
>
No problem. I will sync up and resubmit the patch. 

Thanks,
Sunitha.

[jira] Commented: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-901?page=comments#action_12375182 ] 

Kathey Marsden commented on DERBY-901:
--------------------------------------

Sunitha. I am sorry I just got to this commit and it is out of date with the DERBY-822 changes. Can you sync up and resubmit?


> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java, derby901.p2.diff.txt, derby901.p2.stat.txt, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]
     
Sunitha Kambhampati resolved DERBY-901:
---------------------------------------

    Fix Version: 10.2.0.0
                 10.1.3.0
     Resolution: Fixed
     Derby Info:   (was: [Patch Available])

Fix checked in both 10.1 as well as 10.2 codelines.
in 10.1 branch - #395687,#394223
in 10.2 branch - #395416, #394205

No occurences of non portable constructors in String class  present in network server code.  


> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>      Fix For: 10.2.0.0, 10.1.3.0
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java, derby901.p2.diff.txt, derby901.p2.stat.txt, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt, for_10.1_derby901.p2.diff.txt, for_10.1_derby901.p2.stat.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-901?page=comments#action_12374546 ] 

Sunitha Kambhampati commented on DERBY-901:
-------------------------------------------

I'll post another patch to resolve this issue fully.   The Derby901.p1.diff.txt is the partial ( first phase )patch.  Thanks.  

checkin comment for the Derby901.p1.diff.txt.

----------------------------------------------------------------------------------------------------
DERBY-901 (partial)    
Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

This fixes
- SQLERRMC_TOKEN_DELIMITER, SQLERRMC_MESSAGE_DELIMITER and the corresponding usage of it in SystemProcedures to not use the default string constructors that are non portable. 

--------------------------------------------------------------------------------------------------

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-901?page=comments#action_12374573 ] 

Sunitha Kambhampati commented on DERBY-901:
-------------------------------------------

Thanks Kathey for looking at the patch. 

Are you running the server with -Dfile.encoding=UTF16 ?  The problem will reproduce only when server is running with a native encoding where the value 20 is mapped  to a different value as in UTF16.

I have a phase2  patch that fixes the remaining occurrences of the default string contructor in DRDAConnThread - ie writeSQLDIAGCI and the trace method. in readAndSetParams. 

The char value of 20 is same in UTF-8 and US-ASCII.    

The SQLERRMC_MESSAGE_DELIMITER is used in SystemProcedures. I'll see we can use that in DRDAConnThread. 

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Mike Matrigali (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Mike Matrigali updated DERBY-901:
---------------------------------

    Component: Network Server

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner

>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-901?page=comments#action_12374576 ] 

Kathey Marsden commented on DERBY-901:
--------------------------------------

Thanks Sunitha,  

I got the repro working and committed the patch.  This is a big improvement.
For the trace issue I think we should print a hex representation of the byte[] I don't think what prints now is useful with any encoding.

I think I believe that (char) 20 gets converted properly since I saw it work with my own eyes but I never cease to be confused by the control character delimeters.





> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Sunitha Kambhampati updated DERBY-901:
--------------------------------------

    Attachment: Derby901.p1.diff.txt
                Derby901.p1.stat.txt
                TestEnc.java

This fix (Derby901.p1.diff.txt and Derby901.p1.stat.txt ) fixes the usage of default String encoding in NetworkServer error message delimiters. SQLERRMC_TOKEN_DELIMITER and SQLERRMC_MESSAGE_DELIMITER

Overview:
--The server sends the sqlerrmc which includes the following for each message if there are multiple messages in the exception:
message arguments for the error + SQLERRMC_TOKEN_DELIMITER + messageId. see DRDAConnThread.buildTokenizedSqlerrmc. 

--Server sends the sqlerrmc using UTF8 encoding to the client.To get the message, client sends back information to the server calling SYSIBM.SQLCAMESSAGE (see Sqlca.getMessage).  Several parameters are sent to this procedure including the locale, the sqlerrmc that the client received from the server. 

On server side, the procedure SQLCAMESSAGE in SystemProcedures then calls the MessageService.getLocalizedMessage to retrieve the localized error message. 

In MessageService.getLocalizedMessage the sqlerrmc that is passed in, is parsed to retrieve the message id. The value it uses to parse the MessageId is char value of 20, otherwise it uses the entire sqlerrmc as the message id. 

Problem:
Because the SQLERRMC_TOKEN_DELIMITER in DRDAConnThread was not portable, the bytes would be converted to string using native encoding. Therefore localized error messages would not be obtained correctly from the server and thus error messages on client would be displaying the sqlerrmc values.

E.g of the problems caused by SQLERRMC_TOKEN_DELIMITER 
	String SQLERRMC_TOKEN_DELIMITER = new String(new byte[] {20});

I wrote a small program to see what the value would map to in different encoding's.
Cp1047 is encoding on Z/os.
*************************
ENCODING USED Cp1047
=====================
[0]?=157
*************************
ENCODING USED UTF-16
=====================
[0]?=65533
*************************
ENCODING USED UTF-8
=====================
[0]=20
*************************
ENCODING USED US-ASCII
=====================
[0]=20


This fixes 
- SQLERRMC_TOKEN_DELIMITER, SQLERRMC_MESSAGE_DELIMITER and the corresponding usage of it in SystemProcedures to not use the default string constructors that are non portable. 

Testing:
- derbyall ran ok on ibm142/linux. 
- derbynetclientmats and derbynetmats were run on Z/os platform and the error message garbled diffs have all been resolved there. There are still failures on z/os that will need to be resolved. 

Simulate Testing on Windows:
- Sun JVM1.5, Start server with UTF-16 encoding as
java -cp "C:/workghm/svnclient/trunk2/classes" -Dfile.encoding=UTF-16 -Dconsole.encoding=Cp1252 org.apache.derby.drda.NetworkServerControl start

- Run the standalone repro.
java -cp ".;C:/workghm/svnclient/trunk2/classes;." -Dfile.encoding=UTF8 -DConsole.encoding=Cp1252 TestEnc


WITHOUT FIX
==========================================================================

$java -cp ".;C:/workghm/svnclient/trunk2/classes;." -Dfile.encoding=UTF8 -DConsole.encoding=Cp1252 TestEnc
Initializing connection type: derbynetclient
driver: org.apache.derby.jdbc.ClientDriver
url: jdbc:derby://localhost:1527/wombatderbynetclient;create=true;traceFile=derbynetclient.trace
Obtaining the connection
Database: Apache Derby 10.2.0.0 alpha
lnDriver: Apache Derby Network Client JDBC Driver 10.2.0.0 alphae=Encountered "<EOF>" at line 1, column 10�42X01 

Note: the message is Encountered "<EOF>" at line 1, column 10�42X01 

==========================================================================

WITH FIX
$java -cp ".;C:/workghm/svnclient/trunk2/classes;." -Dfile.encoding=UTF8 -DConsole.encoding=Cp1252 TestEnc
Initializing connection type: derbynetclient
driver: org.apache.derby.jdbc.ClientDriver
url: jdbc:derby://localhost:1527/wombatderbynetclient;create=true;traceFile=derbynetclient.trace
Obtaining the connection
Database: Apache Derby 10.2.0.0 alpha
lnDriver: Apache Derby Network Client JDBC Driver 10.2.0.0 alphae=Syntax error: Encountered "<EOF>" at line 1, column 10.

Note: The error message is correctly retrived as 
Syntax error: Encountered "<EOF>" at line 1, column 10.

=======================

Can someone please review/commit this change if it looks ok.  Thanks. 

It might be nice to add some tests with server running with different encoding. I'll see if we can do that.   

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-901?page=comments#action_12374572 ] 

Kathey Marsden commented on DERBY-901:
--------------------------------------

Hi Sunitha,

Thank you for looking at the issue:
I am having a bit of trouble with the repro. I am seeing i pass with and without the change.

On the code changes.
- I really like all the comments you added.
- I am not sure if I understand the encoding implications of switching from the byte array to 
private static String SQLERRMC_TOKEN_DELIMITER = new String(new char[] {(char)20}); and what that means when it is converted to UTF-8

I am wondering if there is not some ascii delimter we could use, e.g. ^^ or somesuch.  Whatever it is it can't be in the message strings themselves.

-   I still see one occurance of the byte[] in writeSQLDIAGCI(SQLException nextException)
byte[] sep = {20};	// use it as separator of sqlerrmc tokens
String separator = new String(sep);
				
- Could we avoid the duplicate definitions of SQLERRMC_TOKEN_DELIMITER by having network server refer to the value in  SystemProcedures?



> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Sunitha Kambhampati updated DERBY-901:
--------------------------------------

    Fix Version: 10.1.2.4

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.4
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java, derby901.p2.diff.txt, derby901.p2.stat.txt, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt, for_10.1_derby901.p2.diff.txt, for_10.1_derby901.p2.stat.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Sunitha Kambhampati reassigned DERBY-901:
-----------------------------------------

    Assign To: Sunitha Kambhampati

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati

>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel John Debrunner closed DERBY-901.
---------------------------------------

    Assignee:     (was: Sunitha Kambhampati)

confirmed no use of String(byte[]) in drda code.

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-901
>                 URL: https://issues.apache.org/jira/browse/DERBY-901
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>            Reporter: Daniel John Debrunner
>             Fix For: 10.1.3.1, 10.2.1.6
>
>         Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, derby901.p2.diff.txt, derby901.p2.stat.txt, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt, for_10.1_derby901.p2.diff.txt, for_10.1_derby901.p2.stat.txt, TestEnc.java
>
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

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


[jira] Updated: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Sunitha Kambhampati updated DERBY-901:
--------------------------------------

    Derby Info: [Patch Available]

Please note, there is one patch waiting for review/commit - derby901.p2.diff.txt.  Thanks. 

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java, derby901.p2.diff.txt, derby901.p2.stat.txt, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Sunitha Kambhampati updated DERBY-901:
--------------------------------------

    Attachment: for_10.1_derby901.p2.diff.txt
                for_10.1_derby901.p2.stat.txt

Thanks Kathey for committing the derby901.p2.diff.txt patch on trunk.

 I am attaching a p2 patch for  10.1 codeline ( for_10.1_derby901.p2.diff.txt).
The changes in this patch are similar to changes in derby901.p2.diff.txt.

----------------------------------------------------------------------------
DERBY901. Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

remove use of default String(byte[]) constructor in 
--  trace method in DRDAConnThread.readAndSetParams to print out the hex string of the bytes .
--  use SQLERRMC_TOKEN_DELIMITER in SQLDIAGCI .

some cleanup 
 -- define the SQLERRMC_MESSAGE_DELIMITER in SystemProcedures and use that in DRDAConnThread.

Testing:
derbyall on linux /ibm142 ran OK with no new failures. 

Can someone please look at this patch.  Thanks. 

> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java, derby901.p2.diff.txt, derby901.p2.stat.txt, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt, for_10.1_derby901.p2.diff.txt, for_10.1_derby901.p2.stat.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-901) Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

Posted by "Sunitha Kambhampati (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-901?page=all ]

Sunitha Kambhampati updated DERBY-901:
--------------------------------------

    Attachment: for_10.1_derby901.p1.diff.txt
                for_10.1_derby901.p1.stat.txt

Thanks Kathey for commiting my phase 1 patch.   I am attaching  following files for_10.1_derby901.p1.diff.txt and for_10.1_derby901.p1.stat.txt.  for 10.1 codeline. 

The changes are the same as the Derby901.p1.diff.txt attached earlier. 

-------------------
DERBY-901 (partial)    
Remove use of String(byte[]) constructors in network server leading to non-portable behaviour

This fixes
- SQLERRMC_TOKEN_DELIMITER, SQLERRMC_MESSAGE_DELIMITER and the corresponding usage of it in SystemProcedures to not use the default string constructors that are non portable. 
-----------------------

I ran derbyall on linux/ibm142 and no new failures. 

If this looks ok, can this be committed. Thanks. 


> Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
> ---------------------------------------------------------------------------------------------
>
>          Key: DERBY-901
>          URL: http://issues.apache.org/jira/browse/DERBY-901
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Daniel John Debrunner
>     Assignee: Sunitha Kambhampati
>  Attachments: Derby901.p1.diff.txt, Derby901.p1.stat.txt, TestEnc.java, for_10.1_derby901.p1.diff.txt, for_10.1_derby901.p1.stat.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String, this typically leads 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.
> org.apache.derby.impl.drda.DRDAConnThread
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int) - no occurences found in java/drda

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira