commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r603645 - /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/BasicNodeSet.java
Date Wed, 12 Dec 2007 15:40:47 GMT
Author: mbenson
Date: Wed Dec 12 07:40:46 2007
New Revision: 603645

URL: http://svn.apache.org/viewvc?rev=603645&view=rev
Log:
refine cache clearing

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/BasicNodeSet.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/BasicNodeSet.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/BasicNodeSet.java?rev=603645&r1=603644&r2=603645&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/BasicNodeSet.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/BasicNodeSet.java Wed Dec
12 07:40:46 2007
@@ -32,20 +32,23 @@
     private List values;
 
     public void add(Pointer pointer) {
-        pointers.add(pointer);
-        clearCacheLists();
+        if (pointers.add(pointer)) {
+            clearCacheLists();
+        }
     }
 
     public void add(NodeSet nodeSet) {
-        pointers.addAll(nodeSet.getPointers());
-        clearCacheLists();
+        if (pointers.addAll(nodeSet.getPointers())) {
+            clearCacheLists();
+        }
     }
 
     public void remove(Pointer pointer) {
-        pointers.remove(pointer);
-        clearCacheLists();
+        if (pointers.remove(pointer)) {
+            clearCacheLists();
+        }
     }
-    
+
     public synchronized List getPointers() {
         if (readOnlyPointers == null) {
             readOnlyPointers = Collections.unmodifiableList(pointers);
@@ -76,7 +79,7 @@
         }
         return values;
     }
-    
+
     public String toString() {
         return pointers.toString();
     }
@@ -89,4 +92,5 @@
         nodes = null;
         values = null;
     }
+
 }



Mime
View raw message