harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r428723 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Timer.java test/java/tests/api/java/util/TimerTest.java
Date Fri, 04 Aug 2006 13:39:57 GMT
Author: tellison
Date: Fri Aug  4 06:39:56 2006
New Revision: 428723

URL: http://svn.apache.org/viewvc?rev=428723&view=rev
Log:
Apply patch HARMONY-963 (java.util.Timer: purge() throws NPE on empty timer)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java?rev=428723&r1=428722&r2=428723&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java
Fri Aug  4 06:39:56 2006
@@ -285,6 +285,9 @@
 		}
 
         public int purge() {
+            if(tasks.isEmpty()) {
+                return 0;
+            }
             // callers are synchronized
             tasks.deletedCancelledNumber = 0;
             tasks.root.deleteIfCancelled(tasks);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTest.java?rev=428723&r1=428722&r2=428723&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTest.java
Fri Aug  4 06:39:56 2006
@@ -292,6 +292,8 @@
         Timer t = null;
         try {
             t = new Timer();
+            assertEquals(t.purge(), 0);
+
             TimerTestTask[] tasks = new TimerTestTask[100];
             int[] delayTime = { 50, 80, 20, 70, 40, 10, 90, 30, 60 };
 



Mime
View raw message