On 18/11/2014 03:48, Konstantin Kolinko wrote: > 2014-11-18 5:30 GMT+03:00 Konstantin Kolinko <knst.koli...@gmail.com>: >> 2014-11-17 11:06 GMT+03:00 <ma...@apache.org>: >>> Author: markt >>> Date: Mon Nov 17 08:06:24 2014 >>> New Revision: 1640089 >>> >>> URL: http://svn.apache.org/r1640089 >>> Log: >>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57216 >>> Catch "/" as an invalid setting for context path and improve handling of >>> null values. >>> >>> Modified: >>> tomcat/tc8.0.x/trunk/ (props changed) >>> tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/StandardContext.java >>> tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml >>> >>> Propchange: tomcat/tc8.0.x/trunk/ >>> ------------------------------------------------------------------------------ >>> Merged /tomcat/trunk:r1640088 >>> >>> Modified: >>> tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/StandardContext.java >>> URL: >>> http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1640089&r1=1640088&r2=1640089&view=diff >>> ============================================================================== >>> --- tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/StandardContext.java >>> (original) >>> +++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/StandardContext.java >>> Mon Nov 17 08:06:24 2014 >>> @@ -2008,13 +2008,20 @@ public class StandardContext extends Con >>> */ >>> @Override >>> public void setPath(String path) { >>> - if (path == null || (!path.equals("") && !path.startsWith("/"))) { >>> + boolean invalid = false; >>> + if (path == null || path.equals("/")) { >>> + path = ""; >> >> this.path = ""; >> >>> + invalid = true; >>> + } else if (!path.equals("") && !path.startsWith("/")) { >>> this.path = "/" + path; >>> - log.warn(sm.getString( >>> - "standardContext.pathInvalid", path, this.path)); >>> + invalid = true; >>> } else { >>> this.path = path; >>> } >>> + if (invalid) { >>> + log.warn(sm.getString( >>> + "standardContext.pathInvalid", path, this.path)); >>> + } >>> encodedPath = urlEncoder.encode(this.path); >>> if (getName() == null) { >>> setName(this.path); >> >> >> A number of test are failing at Gump. >> (They are failing at Buildbot as well, but none e-mails were received). >> >> E.g. >> Test org.apache.catalina.startup.TestListener FAILED >> >> and I see >> [junit] 18-Nov-2014 01:21:53.447 WARNING [main] >> org.apache.catalina.core.StandardContext.setPath A context path must >> either be an empty string or start with a '/'. The path [] does not >> meet these criteria and has been changed to [null] > > Fixed by r1640276
Thanks. > Remaining issues: > a) I think that context paths that end with "/" shall be prohibited as well. Agreed. > b) Run the whole testsuite and fix tests to do not use "/" as context path. Also agreed. Mark > > E.g. org.apache.catalina.startup.TestListener now prints the warning > > WARNING [main] org.apache.catalina.core.StandardContext.setPath A > context path must either be an empty string or start with a '/'. The > path [/] does not meet these criteria and has been changed to [] > > Its code does > Context context = tomcat.addContext("/", > System.getProperty("java.io.tmpdir")); > > Best regards, > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org