harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Zhou <zhoukevi...@gmail.com>
Subject Re: svn commit: r799505 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
Date Sat, 01 Aug 2009 10:02:59 GMT
Hi Nathan,
Yes. Actually I do try the String(byte[], String) on z/OS but still fail to
solve the previous failure. As I tested, the Socket on Z returns strings in
platform-dependent encoding, thus the String(byte[]) is adopted.

On Sat, Aug 1, 2009 at 7:16 AM, Nathan Beyer <ndbeyer@apache.org> wrote:

> This code is now platform-dependant. The String(byte[]) assumes the
> bytes are encoded in the platform's default encoding. The code should
> really use String(byte[], String) with a specific encoding.
>
> -Nathan
>
> On Thu, Jul 30, 2009 at 10:29 PM, <zhoukevin@apache.org> wrote:
> > Author: zhoukevin
> > Date: Fri Jul 31 03:29:46 2009
> > New Revision: 799505
> >
> > URL: http://svn.apache.org/viewvc?rev=799505&view=rev
> > Log:
> > Fix test failure of SocketTest.test_sendUrgentDataI method for z/OS.
> >
> > Modified:
> >
>  harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
> >
> > Modified:
> harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
> > URL:
> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java?rev=799505&r1=799504&r2=799505&view=diff
> >
> ==============================================================================
> > ---
> harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
> (original)
> > +++
> harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
> Fri Jul 31 03:29:46 2009
> > @@ -1582,8 +1582,10 @@
> >         server.close();
> >
> >         receivedString = new String(myBytes, 0, totalBytesRead);
> > -        assertEquals("Urgent data was not received with one urgent
> byte",
> > -                sendString + (char) urgentByte + sendString,
> receivedString);
> > +        assertEquals(
> > +                "Urgent data was not received with one urgent byte",
> > +                sendString + new String(new byte[] { urgentByte }) +
> sendString,
> > +                receivedString);
> >
> >         /*
> >          * Test 3: Now validate that urgent data is received as expected.
> Expect
> > @@ -1634,7 +1636,8 @@
> >
> >         receivedString = new String(myBytes, 0, totalBytesRead);
> >         assertEquals("Urgent data was not received with two urgent
> bytes",
> > -                sendString + (char) urgentByte1 + (char) urgentByte2
> > +                sendString
> > +                        + new String(new byte[] { urgentByte1,
> urgentByte2 })
> >                         + sendString, receivedString);
> >
> >         /*
> > @@ -1663,8 +1666,8 @@
> >         client.close();
> >         server.close();
> >
> > -        assertEquals("Sole urgent data was not received", (int)
> urgentByte,
> > -                byteRead);
> > +        assertEquals("Sole urgent data was not received",
> > +                (int) (urgentByte & 0xff), byteRead);
> >     }
> >
> >     /**
> >
> >
> >
>



-- 
Best regards,
Yours, Kevin Zhou

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message