[java-xmltooling COMMIT] in /branches/REL_1: doc/RELEASE-NOTES.txt src/main/java/org/opensaml/xml/util/IndexedXMLObje...

noreply at shibboleth.net noreply at shibboleth.net
Fri Oct 21 21:35:11 BST 2011


Author: putmanb
Date: Fri Oct 21 21:35:11 2011
New Revision: 742

URL: http://svn.shibboleth.net/view/java-xmltooling?rev=742&view=rev
Log:
JXT-83: IndexedXMLObjectChildrenList ListView indexOf and lastIndexOf methods operate on the wrong data

Modified:
    branches/REL_1/doc/RELEASE-NOTES.txt
    branches/REL_1/src/main/java/org/opensaml/xml/util/IndexedXMLObjectChildrenList.java
    branches/REL_1/src/test/java/org/opensaml/xml/util/IndexedXMLObjectChildrenListTest.java

Modified: branches/REL_1/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/doc/RELEASE-NOTES.txt?rev=742&r1=741&r2=742&view=diff
==============================================================================
--- branches/REL_1/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_1/doc/RELEASE-NOTES.txt Fri Oct 21 21:35:11 2011
@@ -3,6 +3,7 @@
 [JXT-78] - XSBoolean does not extend XMLObject
 [JXT-79] - Disable RSA v1.5 key transport in favor of RSA-OAEP for all data encryption key types
 [JXT-80] - Update 3rd party runtime library dependencies
+[JXT-83] - IndexedXMLObjectChildrenList ListView indexOf and lastIndexOf methods operate on the wrong data
 
 Changes in Release 1.3.2
 ==============================================

Modified: branches/REL_1/src/main/java/org/opensaml/xml/util/IndexedXMLObjectChildrenList.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/main/java/org/opensaml/xml/util/IndexedXMLObjectChildrenList.java?rev=742&r1=741&r2=742&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/xml/util/IndexedXMLObjectChildrenList.java (original)
+++ branches/REL_1/src/main/java/org/opensaml/xml/util/IndexedXMLObjectChildrenList.java Fri Oct 21 21:35:11 2011
@@ -310,7 +310,7 @@
 
     /** {@inheritDoc} */
     public int indexOf(Object o) {
-        return backingList.indexOf(o);
+        return indexList.indexOf(o);
     }
 
     /** {@inheritDoc} */
@@ -320,7 +320,7 @@
 
     /** {@inheritDoc} */
     public int lastIndexOf(Object o) {
-        return backingList.lastIndexOf(o);
+        return indexList.lastIndexOf(o);
     }
 
     /** {@inheritDoc} */

Modified: branches/REL_1/src/test/java/org/opensaml/xml/util/IndexedXMLObjectChildrenListTest.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/test/java/org/opensaml/xml/util/IndexedXMLObjectChildrenListTest.java?rev=742&r1=741&r2=742&view=diff
==============================================================================
--- branches/REL_1/src/test/java/org/opensaml/xml/util/IndexedXMLObjectChildrenListTest.java (original)
+++ branches/REL_1/src/test/java/org/opensaml/xml/util/IndexedXMLObjectChildrenListTest.java Fri Oct 21 21:35:11 2011
@@ -163,5 +163,44 @@
         } catch (UnsupportedOperationException e) {
 
         }
-    }
+        
+    }
+    
+    /**
+     *  Test sublist  indexOf method.
+     */
+    public void testSublistIndexOf() {
+        SimpleXMLObject parentObject = sxoBuilder.buildObject();
+        IndexedXMLObjectChildrenList<XMLObject> indexedList = new IndexedXMLObjectChildrenList<XMLObject>(parentObject);
+
+        SimpleXMLObject child1 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type1);
+        indexedList.add(child1);
+
+        SimpleXMLObject child2 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type2);
+        indexedList.add(child2);
+        
+        List<SimpleXMLObject> sublist = (List<SimpleXMLObject>) indexedList.subList(type2);
+        assertTrue(child2 == sublist.get(sublist.indexOf(child2)));
+    }
+    
+    /**
+     *  Test sublist  lastIndexOf method.
+     */
+    public void testSublistLastIndexOf() {
+        SimpleXMLObject parentObject = sxoBuilder.buildObject();
+        IndexedXMLObjectChildrenList<XMLObject> indexedList = new IndexedXMLObjectChildrenList<XMLObject>(parentObject);
+
+        SimpleXMLObject child1 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type1);
+        indexedList.add(child1);
+
+        SimpleXMLObject child2 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type2);
+        indexedList.add(child2);
+        
+        SimpleXMLObject child3 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type1);
+        indexedList.add(child3);
+        
+        List<SimpleXMLObject> sublist = (List<SimpleXMLObject>) indexedList.subList(type1);
+        assertTrue(child3 == sublist.get(sublist.lastIndexOf(child3)));
+    }
+    
 }



More information about the commits mailing list