svn commit: r904613 - /jakarta/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java

[email protected]
Newsgroups gmane.comp.jakarta.jmeter.devel
Message-ID <[email protected]>
Author: sebb
Date: Fri Jan 29 20:03:26 2010
New Revision: 904613

URL: http://svn.apache.org/viewvc?rev=904613&view=rev
Log:
Re-enable duplicate key checks for messages*.properties

Modified:
    jakarta/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java?rev=904613&r1=904612&r2=904613&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java (original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java Fri Jan 29 20:03:26 2010
@@ -25,6 +25,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.Iterator;
 import java.util.List;
 import java.util.MissingResourceException;
 import java.util.PropertyResourceBundle;
@@ -168,11 +169,18 @@
             if (prb == null){
                 return;
             }
-            Enumeration<String> enumr = prb.getKeys();
-            while (enumr.hasMoreElements()) {
-                String key = enumr.nextElement();
+            final ArrayList<String> list = Collections.list(prb.getKeys());
+            Collections.sort(list);
+            Iterator<String> enumr = list.iterator();
+            final boolean mainResourceFile = resname.startsWith("messages");
+            while (enumr.hasNext()) {
+                String key = enumr.next();
                 try {
-                    defaultPRB.getString(key); // Check key is in default
+                    String val = defaultPRB.getString(key); // Also Check key is in default
+                    if (mainResourceFile && val.equals(prb.getString(key))){
+                        System.out.println("Duplicate value? "+key+"="+val+" in "+res);
+                        subTestFailures++;
+                    }
                 } catch (MissingResourceException e) {
                     subTestFailures++;
                     System.out.println(resourcePrefix + "_" + resname + " has unexpected key: " + key);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.