You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/10 17:13:32 UTC

svn commit: r1299228 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java

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) {