diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java index 10a85677936..cc897b7ae10 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java @@ -361,42 +361,25 @@ public class AttributeNormalizer { if(property == null) { - if (LOG.isDebugEnabled()) LOG.debug("getString({}) = ", property); return null; } - String val = null; - // Use war path (if known) if("WAR".equalsIgnoreCase(property)) { - val = warURI.toASCIIString(); - if (LOG.isDebugEnabled()) LOG.debug("getString({})#is(WAR)", property); + return warURI.toASCIIString(); } // Use known path attributes - if (val == null) + for (PathAttribute attr : attributes) { - for (PathAttribute attr : attributes) + if (attr.key.equalsIgnoreCase(property)) { - if (attr.key.equalsIgnoreCase(property)) - { - val = uriSeparators(attr.path.toString()); - if (LOG.isDebugEnabled()) - LOG.debug("getString({})#isPathAttribute({}) = {}", property, attr, val); - return val; - } + return uriSeparators(attr.path.toString()); } } - if(val == null) - { - // Use system properties next - val = System.getProperty(property); - if (LOG.isDebugEnabled()) - LOG.debug("getString({}}#systemProperty = %s", property, val == null ? "" : "\"" + val + "\""); - } - - return val; + // Use system properties next + return System.getProperty(property); } } diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java index 5470e4b93f0..32c94ebcc59 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java @@ -18,9 +18,6 @@ package org.eclipse.jetty.quickstart; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; @@ -32,16 +29,17 @@ import java.nio.file.Path; import java.util.Arrays; import java.util.List; -import org.eclipse.jetty.toolchain.test.OS; import org.eclipse.jetty.util.resource.Resource; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + @RunWith(Parameterized.class) public class AttributeNormalizerPathTest { @@ -67,7 +65,7 @@ public class AttributeNormalizerPathTest *

* Eg: on fedora /etc/init.d is a symlink to /etc/rc.d/init.d */ - private static String toSystemPath(String rawpath) + public static String toSystemPath(String rawpath) { Path path = FileSystems.getDefault().getPath(rawpath); if (Files.exists(path)) diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java index b201b39f0de..ebc365db593 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java @@ -60,10 +60,10 @@ public class AttributeNormalizerTest AttributeNormalizer normalizer = new AttributeNormalizer(webresource); // Setup example from windows - String userhome = AttributeNormalizer.uriSeparators(System.getProperty("user.home")); - LOG.debug("System.getProperty('user.home') = [{}]", System.getProperty("user.home")); - LOG.debug("userhome = [{}]", userhome); - String path = "jar:file:" + userhome + "/.m2/repository/something/somejar.jar!/META-INF/some.tld"; + String javaUserHome = System.getProperty("user.home"); + String realUserHome = AttributeNormalizerPathTest.toSystemPath(javaUserHome); + String userHome = AttributeNormalizer.uriSeparators(realUserHome); + String path = "jar:file:" + userHome + "/.m2/repository/something/somejar.jar!/META-INF/some.tld"; String result = normalizer.normalize(path); assertThat(result, is("jar:file:${user.home}/.m2/repository/something/somejar.jar!/META-INF/some.tld")); diff --git a/tests/test-quickstart/src/test/resources/jetty-logging.properties b/tests/test-quickstart/src/test/resources/jetty-logging.properties index 731fa831b87..aec748c60f8 100644 --- a/tests/test-quickstart/src/test/resources/jetty-logging.properties +++ b/tests/test-quickstart/src/test/resources/jetty-logging.properties @@ -1,3 +1,3 @@ org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog org.eclipse.jetty.LEVEL=INFO -org.eclipse.jetty.quickstart.AttributeNormalizer.LEVEL=DEBUG +# org.eclipse.jetty.quickstart.AttributeNormalizer.LEVEL=DEBUG