Fixed a small bug where value handler was being set repeatedly.
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / aa / attrresolv / provider / SimpleAttributeDefinition.java
index a39cd41..60c6aa5 100644 (file)
@@ -175,14 +175,15 @@ public class SimpleAttributeDefinition extends BaseAttributeDefinition implement
                        attribute.setLifetime(lifeTime);
                }
 
+               if (smartScope != null) {
+                       attribute.registerValueHandler(new ScopedStringValueHandler(smartScope));
+               }
+               if (smartScope == null && valueHandler != null) {
+                       attribute.registerValueHandler(valueHandler);
+               }
+               
                Iterator resultsIt = results.iterator();
                while (resultsIt.hasNext()) {
-                       if (smartScope != null) {
-                               attribute.registerValueHandler(new ScopedStringValueHandler(smartScope));
-                       }
-                       if (smartScope == null && valueHandler != null) {
-                               attribute.registerValueHandler(valueHandler);
-                       }
                        attribute.addValue(resultsIt.next());
                }
                attribute.setResolved();