[java-shib-common COMMIT] in /branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resol...

noreply at shibboleth.net noreply at shibboleth.net
Fri Oct 31 12:29:53 EDT 2014


Author: rdw
Date: Fri Oct 31 12:29:52 2014
New Revision: 1117

URL: http://svn.shibboleth.net/view/java-shib-common?rev=1117&view=rev
Log:
SIDP-622 Slight tidy in the longhand clone in the Static connector (for safety ).  use longhand clone in Scripted connector

Modified:
    branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/attributeDefinition/ScriptedAttributeDefinition.java
    branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/dataConnector/StaticDataConnector.java

Modified: branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/attributeDefinition/ScriptedAttributeDefinition.java
URL: http://svn.shibboleth.net/view/java-shib-common/branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/attributeDefinition/ScriptedAttributeDefinition.java?rev=1117&r1=1116&r2=1117&view=diff
==============================================================================
--- branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/attributeDefinition/ScriptedAttributeDefinition.java (original)
+++ branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/attributeDefinition/ScriptedAttributeDefinition.java Fri Oct 31 12:29:52 2014
@@ -30,7 +30,6 @@
 import org.opensaml.xml.util.DatatypeHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.tmatesoft.sqljet.core.internal.lang.SqlParser.insert_stmt_return;
 
 import edu.internet2.middleware.shibboleth.common.attribute.BaseAttribute;
 import edu.internet2.middleware.shibboleth.common.attribute.provider.BasicAttribute;
@@ -185,12 +184,12 @@
                     attributes = ((DataConnector) plugin).resolve(resolutionContext);
                     if (attributes != null) {
                         for (BaseAttribute attr : attributes.values()) {
-                            if (attr instanceof BasicAttribute) {
-                                BasicAttribute basic = (BasicAttribute) attr;
-                                scriptContext.setAttribute(attr.getId(), basic.clone(), ScriptContext.ENGINE_SCOPE);
-                            } else {
-                                scriptContext.setAttribute(attr.getId(), attr, ScriptContext.ENGINE_SCOPE);
-                            }
+                            final BasicAttribute copy = new BasicAttribute(attr.getId());
+                            copy.getDisplayDescriptions().putAll(attr.getDisplayDescriptions());
+                            copy.getDisplayNames().putAll(attr.getDisplayNames());
+                            copy.setValueComparator(attr.getValueComparator());
+                            copy.setValues(attr.getValues());
+                            scriptContext.setAttribute(attr.getId(), copy, ScriptContext.ENGINE_SCOPE);
                         }
                     }
                 } else if (plugin instanceof AttributeDefinition) {

Modified: branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/dataConnector/StaticDataConnector.java
URL: http://svn.shibboleth.net/view/java-shib-common/branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/dataConnector/StaticDataConnector.java?rev=1117&r1=1116&r2=1117&view=diff
==============================================================================
--- branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/dataConnector/StaticDataConnector.java (original)
+++ branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/resolver/provider/dataConnector/StaticDataConnector.java Fri Oct 31 12:29:52 2014
@@ -29,6 +29,7 @@
 /** Data connector implementation that returns statically defined attributes. */
 public class StaticDataConnector extends BaseDataConnector {
 
+
     /** Source Data. */
     private Map<String, BaseAttribute> attributes;
 
@@ -51,20 +52,20 @@
     public Map<String, BaseAttribute> resolve(ShibbolethResolutionContext resolutionContext)
             throws AttributeResolutionException {
         
+        if (null == attributes) {
+            return null;
+        }
         // Do a deep copy of the map, excluding the attribute values, which are copied by reference.
-        
-        Map<String,BaseAttribute> newMap = new HashMap(attributes.size());
-        
-        for (final Map.Entry<String, BaseAttribute> entry : attributes.entrySet()) {
-            final BasicAttribute copy = new BasicAttribute(entry.getKey());
-            newMap.put(entry.getKey(), copy);
-            copy.getDisplayDescriptions().putAll(entry.getValue().getDisplayDescriptions());
-            copy.getDisplayNames().putAll(entry.getValue().getDisplayNames());
-            copy.setValueComparator(entry.getValue().getValueComparator());
-            copy.setValues(entry.getValue().getValues());

[... 16 lines stripped ...]


More information about the commits mailing list