[java-identity-provider COMMIT] /trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationConte...

noreply at shibboleth.net noreply at shibboleth.net
Tue May 12 10:31:47 EDT 2015


Author: rdw
Date: Tue May 12 10:31:47 2015
New Revision: 7514

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7514&view=rev
Log:
IDP-722 revert previous

Modified:
    trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java

Modified: trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java?rev=7514&r1=7513&r2=7514&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java	(original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java	Tue May 12 10:31:47 2015
@@ -18,8 +18,6 @@
 package net.shibboleth.idp.spring;
 
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.nio.file.Paths;
 import java.util.Properties;
 import java.util.TreeSet;
@@ -52,7 +50,7 @@
 
     /** IdP home property. */
     @Nonnull @NotEmpty public static final String IDP_HOME_PROPERTY = "idp.home";
-
+    
     /** Property that points to more property sources. */
     @Nonnull @NotEmpty public static final String IDP_ADDITIONAL_PROPERTY = "idp.additionalProperties";
 
@@ -60,39 +58,27 @@
     @Nonnull public static final String IDP_PROPERTIES = "/conf/idp.properties";
 
     /** Well known search locations. */
-    @Nonnull public static final String[] SEARCH_LOCATIONS = {System.getProperty("idp.home", "/opt/shibboleth-idp"),};
+    @Nonnull public static final String[] SEARCH_LOCATIONS =
+        {
+            System.getProperty("idp.home", "/opt/shibboleth-idp"),
+        };
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(IdPPropertiesApplicationContextInitializer.class);
 
-    // Checkstyle: CyclomaticComplexity OFF
-    // Checkstyle: MethodLength OFF
+// Checkstyle: CyclomaticComplexity OFF
     /** {@inheritDoc} */
     @Override public void initialize(@Nonnull final ConfigurableApplicationContext applicationContext) {
         log.debug("Initializing application context '{}'", applicationContext);
 
         log.debug("Attempting to find '{}' at well known locations '{}'", getSearchTarget(), getSearchLocations());
-        for (final String location : getSearchLocations()) {
-            
-            String searchLocation = location;
-            String searchPath = searchLocation + getSearchTarget();
+        for (String searchLocation : getSearchLocations()) {
+
+            final String searchPath = searchLocation + getSearchTarget();
 
             log.debug("Attempting to find resource '{}'", searchPath);
-            Resource resource = applicationContext.getResource(searchPath);
-            final boolean decoded;
-
-            if (!resource.exists()) {
-                try {
-                    searchLocation = URLDecoder.decode(searchLocation, "UTF-8");
-                    searchPath = searchLocation + getSearchTarget();
-                } catch (UnsupportedEncodingException e) {
-                    continue;
-                }
-                resource = applicationContext.getResource(searchPath);
-                decoded = true;
-            } else {
-                decoded = false;
-            }
+            final Resource resource = applicationContext.getResource(searchPath);
+
             if (resource.exists()) {
                 log.debug("Found resource '{}' at search path '{}'", resource, searchPath);
 
@@ -103,12 +89,12 @@
                 }
 
                 if ("classpath:".equals(searchLocation) || (resource instanceof ClassPathResource)) {
-                    setIdPHomeProperty(searchLocation, properties, decoded);
+                    setIdPHomeProperty(searchLocation, properties);
                 } else {
                     final String searchLocationAbsolutePath = Paths.get(searchLocation).toAbsolutePath().toString();
-                    setIdPHomeProperty(searchLocationAbsolutePath, properties, decoded);
+                    setIdPHomeProperty(searchLocationAbsolutePath, properties);
                 }
-
+                
                 // Load any additional property sources.
                 final String additionalSources = properties.getProperty(IDP_ADDITIONAL_PROPERTY);
                 if (additionalSources != null) {
@@ -140,14 +126,12 @@
                 applicationContext.getEnvironment().getPropertySources().addLast(propertySource);
 
                 return;
-            }// loop
+            }
         }
 
         log.warn("Unable to find '{}' at well known locations '{}'", getSearchTarget(), getSearchLocations());
     }
-    // Checkstyle: CyclomaticComplexity ON
-    // Checkstyle: MethodLength ON
-
+// Checkstyle: CyclomaticComplexity ON
 
     /**
      * Get the target resource to be searched for {@link #IDP_PROPERTIES}.

[... 63 lines stripped ...]


More information about the commits mailing list