harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [continuum] BUILD FAILURE: Classlib/linux.ia32 Build/Test
Date Fri, 23 Jun 2006 14:04:43 GMT
The failing test does this (amongst other things):

        final int THREAD_NUM = 20;
        Thread[] thread = new Thread[THREAD_NUM];
        for (int i = 0; i < THREAD_NUM; i++) {
            thread[i] = new Thread() {
                public void run() {
                    try {
                        sink
                                .write(ByteBuffer.wrap("bytes"
*****                                   .getBytes(ISO8859_1)));
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            };
        }
        for (int i = 0; i < THREAD_NUM; i++) {
            thread[i].start();
        }

If String#getBytes(String) is not thread safe then we are doomed ;-)

How about:


@@ -104,14 +104,13 @@
 	public void test_write_LByteBuffer_mutliThread() throws IOException,
 	        InterruptedException {
         final int THREAD_NUM = 20;
+        final byte[] strbytes = "bytes".getBytes(ISO8859_1);
         Thread[] thread = new Thread[THREAD_NUM];
         for (int i = 0; i < THREAD_NUM; i++) {
             thread[i] = new Thread() {
                 public void run() {
                     try {
-                        sink
-                                .write(ByteBuffer.wrap("bytes"
-                                        .getBytes(ISO8859_1)));
+                        sink.write(ByteBuffer.wrap(strbytes));
                     } catch (IOException e) {
                         throw new RuntimeException(e);
                     }


Regards,
Tim


Apache Harmony Build wrote:
<snip>
>      [exec]     [junit] java.lang.IllegalStateException
>      [exec]     [junit] 	at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:480)
>      [exec]     [junit] 	at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:347)
>      [exec]     [junit] 	at java.nio.charset.Charset.encode(Charset.java:639)
>      [exec]     [junit] 	at java.lang.String.getBytes(String.java:838)
>      [exec]     [junit] 	at org.apache.harmony.tests.java.nio.channels.SinkChannelTest$1.run(SinkChannelTest.java:112)
>      [exec]     [junit] Tests FAILED


-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message