incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romanst...@apache.org
Subject svn commit: r1161615 - /incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
Date Thu, 25 Aug 2011 15:57:52 GMT
Author: romanstumm
Date: Thu Aug 25 15:57:52 2011
New Revision: 1161615

URL: http://svn.apache.org/viewvc?rev=1161615&view=rev
Log:
BVAL-97 optimized a little more to get rid of the Set<String>

Modified:
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java?rev=1161615&r1=1161614&r2=1161615&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
(original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
Thu Aug 25 15:57:52 2011
@@ -44,8 +44,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
 
 /**
  * Description: uses jaxb to parse validation.xml<br/>
@@ -119,12 +117,12 @@ public class ValidationParser {
             // spec says: If more than one META-INF/validation.xml file
             // is found in the classpath, a ValidationException is raised.
             Enumeration<URL> urls = loader.getResources(path);
-            Set<String> uniqueUrls = new HashSet<String>(2);
-            while (urls.hasMoreElements()) {
-                uniqueUrls.add(urls.nextElement().toString());
-                if (uniqueUrls.size() > 1){ // complain when first duplicate found
-                    throw new ValidationException("More than one " + path + " is found in
the classpath"
-                            + uniqueUrls);
+            if (urls.hasMoreElements()) {
+                String url = urls.nextElement().toString();
+                while (urls.hasMoreElements()) {
+                    if (!url.equals(urls.nextElement().toString())) { // complain when first
duplicate found
+                        throw new ValidationException("More than one " + path + " is found
in the classpath");
+                    }
                 }
             }
         }



Mime
View raw message