commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1299228 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java
Date Sat, 10 Mar 2012 16:13:32 GMT
Author: sebb
Date: Sat Mar 10 16:13:31 2012
New Revision: 1299228

URL: http://svn.apache.org/viewvc?rev=1299228&view=rev
Log:
Work-round for PMD crash

Modified:
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java?rev=1299228&r1=1299227&r2=1299228&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java
Sat Mar 10 16:13:31 2012
@@ -1704,8 +1704,14 @@ public class ExtendedProperties extends 
     public static ExtendedProperties convertProperties(Properties props) {
         ExtendedProperties c = new ExtendedProperties();
 
-        for (@SuppressWarnings("unchecked") // Properties are supposed to have string keys
...
-        Enumeration<String> e = (Enumeration<String>) props.propertyNames();
e.hasMoreElements();) {
+        @SuppressWarnings("unchecked") // Properties are supposed to have string keys ...
+        Enumeration<String> e = (Enumeration<String>) props.propertyNames();
+        // Unfortunately PMD 4.3 cannot handle the original code where the @Suppress
+        // was in the for loop:
+        //    for (@SuppressWarnings("unchecked") // Properties are supposed to have string
keys ...
+        //    Enumeration<String> e = (Enumeration<String>) props.propertyNames();
e.hasMoreElements();) {
+        //        String s = e.nextElement(); // ... if props does not, this line would fail
anyway ...
+        while (e.hasMoreElements()) {
             String s = e.nextElement(); // ... if props does not, this line would fail anyway
...
             String value = props.getProperty(s);
             if(value != null) {



Mime
View raw message