You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2004/02/06 12:05:27 UTC

DO NOT REPLY [Bug 26714] New: - New line charachters seem to be removed, changed or truncated

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26714>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26714

New line charachters seem to be removed, changed or truncated

           Summary: New line charachters seem to be removed, changed or
                    truncated
           Product: Axis
           Version: 1.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: dputzeys@cognicase.be


1) When sending a string which contains '\r\n' from a client to a webservice
supported by Axis, strangely enough the '\r\n' gets changed to '\n'.

I will add some code which shows the case.
basically if I do the following in the web services client:

<code snip>
String aString = "This is a test new line follows : \r\nThis is the new
line\r\n\r\nThis is the second new line";
        byte[] array = aString.getBytes();
        int len = array.length;
		System.out.println("aString.length()="+aString.length()+", array.length="+len);
</code snip>

the system gives me as result : aString.length()=87, array.length=87

2) In the webservice I execute immediately the following line:
<code snip>
byte[] array = aString.getBytes();
			int len = aString.getBytes().length;
			System.out.println("aString.length()="+aString.length()+", array.length="+len);
			for (int i=0 ; i < len ; i++) {
				System.out.println("'"+aString.charAt(i) + "' = " +"'"+(int)array[i]+"'");
			}
</end code snip>

This results in the following printout: aString.length()=84, array.length=84
'T' = '84'
'h' = '104'
'i' = '105'
's' = '115'
' ' = '32'
'i' = '105'
's' = '115'
' ' = '32'
'a' = '97'
' ' = '32'
't' = '116'
'e' = '101'
's' = '115'
't' = '116'
' ' = '32'
'n' = '110'
'e' = '101'
'w' = '119'
' ' = '32'
'l' = '108'
'i' = '105'
'n' = '110'
'e' = '101'
' ' = '32'
'f' = '102'
'o' = '111'
'l' = '108'
'l' = '108'
'o' = '111'
'w' = '119'
's' = '115'
' ' = '32'
':' = '58'
' ' = '32'
'
' = '10'
'T' = '84'
'h' = '104'
'i' = '105'
's' = '115'
' ' = '32'
'i' = '105'
's' = '115'
' ' = '32'
't' = '116'
'h' = '104'
'e' = '101'
' ' = '32'
'n' = '110'
'e' = '101'
'w' = '119'
' ' = '32'
'l' = '108'
'i' = '105'
'n' = '110'
'e' = '101'
'
' = '10'
'
' = '10'
'T' = '84'
'h' = '104'
'i' = '105'
's' = '115'
' ' = '32'
'i' = '105'
's' = '115'
' ' = '32'
't' = '116'
'h' = '104'
'e' = '101'
' ' = '32'
's' = '115'
'e' = '101'
'c' = '99'
'o' = '111'
'n' = '110'
'd' = '100'
' ' = '32'
'n' = '110'
'e' = '101'
'w' = '119'
' ' = '32'
'l' = '108'
'i' = '105'
'n' = '110'
'e' = '101'


Strangely enough the \r\n which should be listed as :
13
10
is replaced with
10
and the length of the bytes changes as well.

3) If I write the byte[] out to a FileOutputStream (on Win32 machine) and I
check the file in hex format, the '\r\n' (0D 0A) suddenly reappears probably due
to the way the OutputStream is handled

4) This problem occurs when talking between a win32 (client) to win32
(ws-server) and between a win32 (client) and a Unix (ws-server).
win32 : Windows 2000
Unix : Sun Solaris 8

The problem occurs using a .jws solution and working with complete classes and
using the java2wsdl and wsdl2java integration.


---------JVM identification -------------

C:\>java -version
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

C:\>java -fullversion
java full version "1.4.1_02-b06"

C:\>

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