Author: bodewig
Date: Tue Aug 9 03:28:32 2011
New Revision: 1155197
URL: http://svn.apache.org/viewvc?rev=1155197&view=rev
Log:
make AntClassLoader$ResourceEnumeration adhere to the Enumeration contract. PR
51579
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java
Modified: ant/core/trunk/WHATSNEW
URL:
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1155197&r1=1155196&r2=1155197&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Aug 9 03:28:32 2011
@@ -4,6 +4,12 @@ Changes from Ant 1.8.2 TO Ant 1.8.3
Changes that could break older environments:
-------------------------------------------
+ * The Enumeration returned by AntClassLoader#getResources used to
+ return null in nextElement after hasNextElement would return false.
+ It has been changed to throw a NoSuchElementException instead so
+ that it now adheres to the contract of java.util.Enumeration.
+ Bugzilla Report 51579.
+
Fixed bugs:
-----------
Modified: ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java?rev=1155197&r1=1155196&r2=1155197&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java Tue Aug 9
03:28:32 2011
@@ -33,6 +33,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.jar.Attributes;
@@ -127,6 +128,9 @@ public class AntClassLoader extends Clas
*/
public Object nextElement() {
URL ret = this.nextResource;
+ if (ret == null) {
+ throw new NoSuchElementException();
+ }
findNextResource();
return ret;
}