Trim trailing whitespace from config properties, since this seems to cause hard to...
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 11 Jun 2003 16:22:58 +0000 (16:22 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 11 Jun 2003 16:22:58 +0000 (16:22 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@623 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/AAServlet.java
src/edu/internet2/middleware/shibboleth/hs/HandleServlet.java

index 3acf9d6..6e807af 100755 (executable)
@@ -59,6 +59,7 @@ import java.net.URL;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
@@ -204,6 +205,19 @@ public class AAServlet extends HttpServlet {
                                log.error("Encountered a problem cleaning up resources: could not close debug stream.");
                        }
                }
+               
+               //Be nice and trim "extra" whitespace from config properties
+               Enumeration propNames = properties.propertyNames();
+               while (propNames.hasMoreElements()) {
+                       String propName = (String) propNames.nextElement();
+                       if (properties.getProperty(propName, "").matches(".+\\s$")) {
+                               log.debug(
+                                       "The configuration property ("
+                                               + propName
+                                               + ") contains trailing whitespace.  Trimming... ");
+                               properties.setProperty(propName, properties.getProperty(propName).trim());
+                       }
+               }
 
                return properties;
        }
index 31309ed..00d68c4 100644 (file)
@@ -62,6 +62,7 @@ import java.security.cert.CertificateException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
+import java.util.Enumeration;
 import java.util.Properties;
 
 import javax.servlet.RequestDispatcher;
@@ -167,6 +168,19 @@ public class HandleServlet extends HttpServlet {
                                log.error("Encountered a problem cleaning up resources: could not close debug stream.");
                        }
                }
+               
+               //Be nice and trim "extra" whitespace from config properties
+               Enumeration propNames = properties.propertyNames();
+               while (propNames.hasMoreElements()) {
+                       String propName = (String) propNames.nextElement();
+                       if (properties.getProperty(propName, "").matches(".+\\s$")) {
+                               log.debug(
+                                       "The configuration property ("
+                                               + propName
+                                               + ") contains trailing whitespace.  Trimming... ");
+                               properties.setProperty(propName, properties.getProperty(propName).trim());
+                       }
+               }
 
                return properties;
        }