openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r956938 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
Date Tue, 22 Jun 2010 16:13:04 GMT
Author: dwoods
Date: Tue Jun 22 16:13:04 2010
New Revision: 956938

URL: http://svn.apache.org/viewvc?rev=956938&view=rev
Log:
OPENJPA-1700 FindBugs - Inefficient use of keySet iterator instead of entrySet iterator. 
Noticed this duplciated code while looking to resolve the entrySet warning.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java?rev=956938&r1=956937&r2=956938&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
Tue Jun 22 16:13:04 2010
@@ -337,11 +337,7 @@ public class RelationFieldStrategy
     private Object getMapKeyObj(Map mapObj, Object value) {
         if (value instanceof ReflectingPersistenceCapable)
             value = ((ReflectingPersistenceCapable)value).getManagedInstance(); 
-        Set keySet = mapObj.keySet();
-        for (Object key : keySet) {
-            if (mapObj.get(key) == value)
-                return key;
-        }
+
         Set<Map.Entry> entries = mapObj.entrySet();
         for (Map.Entry entry : entries) {
             if (entry.getValue() == value)



Mime
View raw message