Jaechang Nam created JUDDI-967: ---------------------------------- Summary: Suspicious incrementers in for loops Key: JUDDI-967 URL: https://issues.apache.org/jira/browse/JUDDI-967 Project: jUDDI Issue Type: Bug Reporter: Jaechang Nam
In recent github snapshot, I've found suspicious use of incrementers in for loops juddi-core/src/main/java/org/apache/juddi/validation/vsv/Uddiuddiorgcategorizationderivedfrom.java {code:java} 154 for (int i = 0; i < items.size(); i++) { 155 List<String> validValues = getValidValues(); 156 if (validValues != null) { 157 //ok we have some work to do 158 boolean valid = false; 159 for (int k = 0; k < validValues.size(); k++) { 160 if (validValues.get(i).equals(items.get(i).getKeyValue())) { 161 valid = true; 162 } 163 } 164 if (!valid) { 165 err += xpath + "keyedReference(" + i + ") "; 166 } 167 } 168 } {code} In Line 160, validValues.get(i) should be validValues.get(j)? juddi-core/src/main/java/org/apache/juddi/validation/vsv/Uddiuddiorgidentifierisreplacedby.java {code:java} 303 for (int i = 0; i < items.size(); i++) { 304 List<String> validValues = getValidValues(); 305 if (validValues != null) { 306 //ok we have some work to do 307 boolean valid = false; 308 for (int k = 0; k < validValues.size(); k++) { 309 if (validValues.get(i).equals(items.get(i).getKeyValue())) { 310 valid = true; 311 } 312 } 313 if (!valid) { 314 err += xpath + "keyedReference(" + i + ") "; 315 } 316 } 317 } {code} In Line 309, validValues.get(i) should be validValues.get(j)? When inner loops iterate, equals always compare the same objects. -- This message was sent by Atlassian JIRA (v6.3.15#6346)