Fixed a bug where the ARP engine was sometimes returning attributes with no values.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 28 Oct 2003 17:35:36 +0000 (17:35 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 28 Oct 2003 17:35:36 +0000 (17:35 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@780 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/arp/ArpEngine.java

index 2b7021f..016a05e 100755 (executable)
@@ -270,7 +270,7 @@ public class ArpEngine {
 
                //Filter
                for (ArpAttributeIterator returnIterator = attributes.arpAttributeIterator(); returnIterator.hasNext();) {
-                       
+
                        ArpAttribute arpAttribute = returnIterator.nextArpAttribute();
                        Rule.Attribute attribute = (Rule.Attribute) arpAttributeSpecs.get(arpAttribute.getName());
 
@@ -293,13 +293,19 @@ public class ArpEngine {
 
                        //Handle "Permit All-Except" and "Permit Specific"
                        ArrayList releaseValues = new ArrayList();
-                       for (Iterator valueIterator = arpAttribute.getValues();valueIterator.hasNext();) {
+                       for (Iterator valueIterator = arpAttribute.getValues(); valueIterator.hasNext();) {
                                Object value = valueIterator.next();
                                if (attribute.isValuePermitted(value)) {
                                        releaseValues.add(value);
                                }
                        }
-                       arpAttribute.setValues((Object[]) releaseValues.toArray(new Object[0]));
+
+                       if (!releaseValues.isEmpty()) {
+                               arpAttribute.setValues((Object[]) releaseValues.toArray(new Object[0]));
+                       } else {
+                               returnIterator.remove();
+                       }
+
                }
        }