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

noreply at shibboleth.net noreply at shibboleth.net
Mon May 11 05:15:14 EDT 2015


Author: rdw
Date: Mon May 11 05:15:14 2015
New Revision: 7509

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7509&view=rev
Log:
https://issues.shibboleth.net/jira/browse/IDP-722  Workaround space issues for Tomcat.

Modified:
    trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java
    trunk/idp-war/src/main/webapp/WEB-INF/web.xml

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=7509&r1=7508&r2=7509&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	Mon May 11 05:15:14 2015
@@ -18,6 +18,8 @@
 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;
@@ -50,7 +52,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";
 
@@ -58,27 +60,39 @@
     @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: CyclomaticComplexity OFF
+    // Checkstyle: MethodLength 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 (String searchLocation : getSearchLocations()) {
-
-            final String searchPath = searchLocation + getSearchTarget();
+        for (final String location : getSearchLocations()) {
+            
+            String searchLocation = location;
+            String searchPath = searchLocation + getSearchTarget();
 
             log.debug("Attempting to find resource '{}'", searchPath);
-            final Resource resource = applicationContext.getResource(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;
+            }
             if (resource.exists()) {
                 log.debug("Found resource '{}' at search path '{}'", resource, searchPath);
 
@@ -89,12 +103,12 @@
                 }
 
                 if ("classpath:".equals(searchLocation) || (resource instanceof ClassPathResource)) {
-                    setIdPHomeProperty(searchLocation, properties);
+                    setIdPHomeProperty(searchLocation, properties, decoded);
                 } else {
                     final String searchLocationAbsolutePath = Paths.get(searchLocation).toAbsolutePath().toString();
-                    setIdPHomeProperty(searchLocationAbsolutePath, properties);
-                }
-                
+                    setIdPHomeProperty(searchLocationAbsolutePath, properties, decoded);
+                }
+
                 // Load any additional property sources.
                 final String additionalSources = properties.getProperty(IDP_ADDITIONAL_PROPERTY);
                 if (additionalSources != null) {
@@ -126,12 +140,14 @@
                 applicationContext.getEnvironment().getPropertySources().addLast(propertySource);
 
                 return;
-            }
+            }// loop
         }
 
         log.warn("Unable to find '{}' at well known locations '{}'", getSearchTarget(), getSearchLocations());
     }
-// Checkstyle: CyclomaticComplexity ON

[... 78 lines stripped ...]


More information about the commits mailing list