Mark,

On 10/7/13 9:48 AM, Mark Thomas wrote:
> On 07/10/2013 14:38, Christopher Schultz wrote:
>> Mark,
>>
>> On 10/7/13 6:55 AM, ma...@apache.org wrote:
>>> Author: markt Date: Mon Oct  7 10:55:18 2013 New Revision:
>>> 1529816
>>>
>>> URL: http://svn.apache.org/r1529816 Log: Partial fix for
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55620 Handle
>>> the case of a comma in $CATALINA_HOME or $CATALINA_BASE
>>>
>>> Added: 
>>> tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java
>>> (with props) Modified: tomcat/trunk/conf/catalina.properties 
>>> tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java 
>>> tomcat/trunk/webapps/docs/changelog.xml
>>>
>>> Modified: tomcat/trunk/conf/catalina.properties URL:
>>> http://svn.apache.org/viewvc/tomcat/trunk/conf/catalina.properties?rev=1529816&r1=1529815&r2=1529816&view=diff
>>>
>>>
> ==============================================================================
>>> --- tomcat/trunk/conf/catalina.properties (original) +++
>>> tomcat/trunk/conf/catalina.properties Mon Oct  7 10:55:18 2013 @@
>>> -44,7 +44,10 @@ package.definition=sun.,java.,org.apache #
>>> "foo/*.jar": Add all the JARs of the specified folder as class #
>>> repositories #     "foo/bar.jar": Add bar.jar as a class
>>> repository 
>>> -common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
>>>
>>>
> +#
>>> +# Note: Values are enclosed in double quotes ("...") in case
>>> either the +#       ${catalina.base} path or the ${catalina.home}
>>> path contains a comma. 
>>> +common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar"
>>>
>>>  # # List of comma-separated paths defining the contents of the
>>> "server"
>>>
>>> Modified:
>>> tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java URL:
>>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?rev=1529816&r1=1529815&r2=1529816&view=diff
>>>
>>>
> ==============================================================================
>>> --- tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java
>>> (original) +++
>>> tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java Mon
>>> Oct  7 10:55:18 2013 @@ -24,7 +24,8 @@ import
>>> java.net.MalformedURLException; import java.net.URL; import
>>> java.util.ArrayList; import java.util.List; -import
>>> java.util.StringTokenizer; +import java.util.regex.Matcher; 
>>> +import java.util.regex.Pattern;
>>>
>>> import org.apache.catalina.Globals; import
>>> org.apache.catalina.security.SecurityClassLoad; @@ -51,19 +52,16
>>> @@ public final class Bootstrap {
>>>
>>> private static final Log log =
>>> LogFactory.getLog(Bootstrap.class);
>>>
>>> - -    // -------------------------------------------------------
>>> Static Variables - - /** * Daemon object used by main. */ private
>>> static Bootstrap daemon = null;
>>>
>>> - private static final File catalinaBaseFile; private static
>>> final File catalinaHomeFile;
>>>
>>> +    private static final Pattern PATH_PATTERN =
>>> Pattern.compile("(\".*?\")|(([^,])*)");
>>
>> I think you might want [^"]* instead of .*
> 
> I'm sure there is more than one regexp pattern that achieves the
> objective. If you have a test case that fails with the current
> pattern, please provide it.
> 
>> Also, what does ".*? produce? Something looks fishy to me there...
> 
> See the Javadoc for Pattern.

Okay, that actually makes the whole thing work, then ;) When I read the
pattern at first, I thought "hmm.. that needs a non-greedy quantifier".
I should have checked before I opened my big mouth ;)

Is there already a set of unit tests for that method? If so, I'd like to
take a look and maybe add some more.

-chris

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to