[java-identity-provider COMMIT] /trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolve...

noreply at shibboleth.net noreply at shibboleth.net
Mon Aug 19 11:52:10 EDT 2013


Author: tzeller
Date: Mon Aug 19 11:52:09 2013
New Revision: 4707

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4707&view=rev
Log:
Reworked variable declarations. Added TODO to pre-compile source value Patterns.

Modified:
    trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/mapped/ValueMap.java

Modified: trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/mapped/ValueMap.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/mapped/ValueMap.java?rev=4707&r1=4706&r2=4707&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/mapped/ValueMap.java (original)
+++ trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/mapped/ValueMap.java Mon Aug 19 11:52:09 2013
@@ -113,9 +113,8 @@
         final Set<StringAttributeValue> mappedValues = new HashSet<StringAttributeValue>();
 
         for (SourceValue sourceValue : sourceValues) {
-            final Matcher m;
-            String newValue;
-            newValue = null;
+            String newValue = null;
+
             if (sourceValue.isPartialMatch()) {
                 log.debug("Performing partial match comparison.");
                 if (attributeValue.contains(sourceValue.getValue())) {
@@ -130,7 +129,8 @@
                     if (sourceValue.isIgnoreCase()) {
                         flags = Pattern.CASE_INSENSITIVE;
                     }
-                    m = Pattern.compile(sourceValue.getValue(), flags).matcher(attributeValue);
+                    // TODO pre-compile Pattern in setter ?
+                    final Matcher m = Pattern.compile(sourceValue.getValue(), flags).matcher(attributeValue);
                     if (m.matches()) {
                         newValue = m.replaceAll(returnValue);
                         log.debug("Attribute value '{}' matches regular expression it will be mapped to '{}'",



More information about the commits mailing list