[java-idp-testbed COMMIT] in /trunk/src/main: java/Main.java java/common/PathPropertySupport.java webapp/WEB-INF/web.xml

noreply at shibboleth.net noreply at shibboleth.net
Wed May 7 14:16:21 EDT 2014


Author: scantor
Date: Wed May  7 14:16:20 2014
New Revision: 217

URL: http://svn.shibboleth.net/view/java-idp-testbed?rev=217&view=rev
Log:
IDP-352: add extra slash to file:// URIs to account for Windows.

Modified:
    trunk/src/main/java/Main.java
    trunk/src/main/java/common/PathPropertySupport.java
    trunk/src/main/webapp/WEB-INF/web.xml

Modified: trunk/src/main/java/Main.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/main/java/Main.java?rev=217&r1=216&r2=217&view=diff
==============================================================================
--- trunk/src/main/java/Main.java (original)
+++ trunk/src/main/java/Main.java Wed May  7 14:16:20 2014
@@ -46,7 +46,7 @@
             
             // Configure Jetty from jetty.xml.
             final Path pathToJettyXML =
-                    Paths.get(System.getProperty(PathPropertySupport.IDP_HOME_RAW), "system", "conf", "jetty.xml");
+                    Paths.get(System.getProperty(PathPropertySupport.IDP_HOME), "system", "conf", "jetty.xml");
             final Resource fileserver_xml = Resource.newResource(pathToJettyXML.toString());
             final XmlConfiguration configuration = new XmlConfiguration(fileserver_xml.getInputStream());
             final Server server = (Server) configuration.configure();

Modified: trunk/src/main/java/common/PathPropertySupport.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/main/java/common/PathPropertySupport.java?rev=217&r1=216&r2=217&view=diff
==============================================================================
--- trunk/src/main/java/common/PathPropertySupport.java (original)
+++ trunk/src/main/java/common/PathPropertySupport.java Wed May  7 14:16:20 2014
@@ -17,7 +17,6 @@
 
 package common;
 
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -35,9 +34,6 @@
     /** The name of the system property defining the normalized path to configuration files for the IdP. */
     public final static String IDP_HOME = "idp.home";
 
-    /** The name of the system property defining the raw path to configuration files for the IdP. */
-    public final static String IDP_HOME_RAW = "idp.home.raw";
-
     /** The name of the system property defining the normalized path to testbed-only configuration. */
     public final static String TESTBED_HOME = "testbed.home";
     
@@ -50,15 +46,12 @@
     public static void setupIdPHomeProperties() {
 
         String raw = System.getProperty(IDP_HOME);
-
         if (raw != null) {
             normalizeProperty(IDP_HOME, raw);
-            System.setProperty(IDP_HOME_RAW, raw);
         } else {
             raw = Paths.get(Paths.get("").toAbsolutePath().getParent().toAbsolutePath().toString(),
                     "java-identity-provider", "idp-conf", "src", "main", "resources").toString();
             normalizeProperty(IDP_HOME, raw);
-            System.setProperty(IDP_HOME_RAW, raw);
         }
     }
 
@@ -70,13 +63,12 @@
     public static void setupTestbedHomeProperty() {
         
         String raw = System.getProperty(TESTBED_HOME);
-
         if (raw != null) {
             normalizeProperty(TESTBED_HOME, raw);
+        } else {
+            raw = Paths.get("src", "main", "resources").toAbsolutePath().toString();
+            normalizeProperty(TESTBED_HOME, raw);
         }
-
-        raw = Paths.get("src", "main", "resources").toAbsolutePath().toString();
-        normalizeProperty(TESTBED_HOME, raw);
     }
     
     /**
@@ -89,7 +81,7 @@
      */
     public static Properties setupIdPProperties() throws FileNotFoundException,
             IOException {
-        final Path pathToIdPProperties = Paths.get(System.getProperty(IDP_HOME_RAW), "conf", "idp.properties");
+        final Path pathToIdPProperties = Paths.get(System.getProperty(IDP_HOME), "conf", "idp.properties");
         final Properties idpProperties = new Properties();
         idpProperties.load(new FileInputStream(pathToIdPProperties.toFile()));
         for (String propertyName : idpProperties.stringPropertyNames()) {
@@ -105,7 +97,6 @@
      * 
      * @param name system property name
      * @param path path to normalize and set
-     * @return the normalized path
      */
     public static void normalizeProperty(@Nullable final String name, @Nullable final String path) {
         String value = path;
@@ -117,53 +108,28 @@
             value = Paths.get("").toAbsolutePath().toString();
         }
 
-        final String normalizedValue;
-        if (needsNormalized(value)) {
-            normalizedValue = normalizePath(value);
-        } else {
-            normalizedValue = value;
-        }
-
-        System.setProperty(name, normalizedValue);
+        System.setProperty(name, normalizePath(value));
     }
 
     /**
-     * Normalize a path for windows.<br/>
+     * Normalize a path with multiple leading slashes and convert backslashes to forward slashes.
      * 
-     * On operating systems which present filesystems not rooted in '\', we need to be careful about the construction of

[... 71 lines stripped ...]


More information about the commits mailing list