harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r495921 - in /harmony/enhanced/drlvm/trunk/vm: tests/kernel/java/lang/ThreadRTest.java vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Date Sat, 13 Jan 2007 16:43:51 GMT
Author: apetrenko
Date: Sat Jan 13 08:43:50 2007
New Revision: 495921

URL: http://svn.apache.org/viewvc?view=rev&rev=495921
Log:
Patch for HARMONY-917 "[classlib][drlvm] no IllegalArgumentException for java.lang.Thread.join(long,int)
when parameters are incorrect"

Modified:
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java?view=diff&rev=495921&r1=495920&r2=495921
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java Sat Jan 13 08:43:50
2007
@@ -59,4 +59,37 @@
             fail("NullPointerException has been thrown");
         }
     }
+    /*
+     * Regression test for Harmony-917
+     */
+    public void testJoinJI() throws Exception {
+        Thread th = new Thread(); 
+
+        long mls = 688204075024689866L; 
+        int nn = -10000; 
+        try { 
+            th.join(mls, nn); 
+            fail("1: test failed"); 
+        } catch (IllegalArgumentException e) { 
+            //expected
+        } 
+
+        mls = -1000000000000L; 
+        nn = 90000; 
+        try { 
+            th.join(mls, nn); 
+            fail("2: test failed"); 
+        } catch (IllegalArgumentException e) { 
+            //expected
+        } 
+
+        mls = 10000000000000L; 
+        nn = 1000001; 
+        try { 
+            th.join(mls, nn); 
+            fail("3: Test failed"); 
+        } catch (IllegalArgumentException e) { 
+            //expected
+        } 
+    }                     
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java?view=diff&rev=495921&r1=495920&r2=495921
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Sat Jan 13 08:43:50 2007
@@ -617,6 +617,9 @@
      */
     public final void join(long millis, int nanos)
         throws InterruptedException {
+        if (millis < 0 || nanos < 0 || nanos > 999999)
+            throw new IllegalArgumentException();
+
         if (millis == 0 && nanos == 0) {
             join();
             return;



Mime
View raw message