You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/10/07 12:55:18 UTC
svn commit: r1529816 - in /tomcat/trunk: conf/catalina.properties
java/org/apache/catalina/startup/Bootstrap.java
test/org/apache/catalina/startup/TestBootstrap.java
webapps/docs/changelog.xml
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("(\".*?\")|(([^,])*)");
+
static {
// Will always be non-null
String userDir = System.getProperty("user.dir");
@@ -172,13 +170,9 @@ public final class Bootstrap {
List<Repository> repositories = new ArrayList<>();
- StringTokenizer tokenizer = new StringTokenizer(value, ",");
- while (tokenizer.hasMoreElements()) {
- String repository = tokenizer.nextToken().trim();
- if (repository.length() == 0) {
- continue;
- }
+ String[] repositoryPaths = getPaths(value);
+ for (String repository : repositoryPaths) {
// Check for a JAR URL repository
try {
@SuppressWarnings("unused")
@@ -208,6 +202,7 @@ public final class Bootstrap {
return ClassLoaderFactory.createClassLoader(repositories, parent);
}
+
/**
* System property replacement in the given string.
*
@@ -562,4 +557,30 @@ public final class Bootstrap {
}
// All other instances of Throwable will be silently swallowed
}
+
+
+ // Protected for unit testing
+ protected static String[] getPaths(String value) {
+
+ List<String> result = new ArrayList<>();
+ Matcher matcher = PATH_PATTERN.matcher(value);
+
+ while (matcher.find()) {
+ String path = value.substring(matcher.start(), matcher.end());
+
+ path = path.trim();
+
+ if (path.startsWith("\"") && path.length() > 1) {
+ path = path.substring(1, path.length() - 1);
+ path = path.trim();
+ }
+
+ if (path.length() == 0) {
+ continue;
+ }
+
+ result.add(path);
+ }
+ return result.toArray(new String[result.size()]);
+ }
}
Added: tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java?rev=1529816&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java (added)
+++ tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java Mon Oct 7 10:55:18 2013
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.startup;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import org.junit.Test;
+
+
+public class TestBootstrap {
+
+ @Test
+ public void testEmptyNonQuoted() {
+ doTest("");
+ }
+
+ @Test
+ public void testOneNonQuoted() {
+ doTest("a", "a");
+ }
+
+ @Test
+ public void testTwoNonQuoted01() {
+ doTest("a,b", "a", "b");
+ }
+
+ @Test
+ public void testTwoNonQuoted02() {
+ doTest("a,,b", "a", "b");
+ }
+
+ @Test
+ public void testTwoNonQuoted03() {
+ doTest(",a,b", "a", "b");
+ }
+
+ @Test
+ public void testTwoNonQuoted04() {
+ doTest("a,b,", "a", "b");
+ }
+
+ @Test
+ public void testThreeNonQuoted() {
+ doTest("a,b,c", "a", "b", "c");
+ }
+
+ @Test
+ public void testEmptyQuoted() {
+ doTest("\"\"");
+ }
+
+ @Test
+ public void testOneQuoted01() {
+ doTest("\"a\"", "a");
+ }
+
+ @Test
+ public void testOneQuoted02() {
+ doTest("\"aaa\"", "aaa");
+ }
+
+ @Test
+ public void testOneQuoted03() {
+ doTest("\"a,aa\"", "a,aa");
+ }
+
+ @Test
+ public void testOneQuoted04() {
+ doTest("\",aaa\"", ",aaa");
+ }
+
+ @Test
+ public void testOneQuoted05() {
+ doTest("\"aaa,\"", "aaa,");
+ }
+
+ @Test
+ public void testTwoQuoted01() {
+ doTest("\"aaa\",bbb", "aaa", "bbb");
+ }
+
+ @Test
+ public void testTwoQuoted02() {
+ doTest("\"a,aa\",bbb", "a,aa", "bbb");
+ }
+
+ @Test
+ public void testTwoQuoted03() {
+ doTest("\"aaa\",\"bbb\"", "aaa", "bbb");
+ }
+
+ @Test
+ public void testTwoQuoted04() {
+ doTest("\"aaa\",\",bbb\"", "aaa", ",bbb");
+ }
+
+ @Test
+ public void testTwoQuoted05() {
+ doTest("aaa,\"bbb,\"", "aaa", "bbb,");
+ }
+
+ private void doTest(String input, String... expected) {
+ String[] result = Bootstrap.getPaths(input);
+
+ assertArrayEquals(expected, result);
+ }
+}
Propchange: tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1529816&r1=1529815&r2=1529816&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Oct 7 10:55:18 2013
@@ -173,6 +173,10 @@
<bug>55317</bug>: Facilitate weaving by allowing ClassFileTransformer to
be added to WebppClassLoader. Patch by Nick Williams. (markt)
</add>
+ <fix>
+ <bug>55620</bug>: Enable Tomcat to start when either $CATALINA_HOME
+ and/or $CATALINA_BASE contains a comma character. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1529816 - in /tomcat/trunk: conf/catalina.properties
java/org/apache/catalina/startup/Bootstrap.java test/org/apache/catalina/startup/TestBootstrap.java
webapps/docs/changelog.xml
Posted by Mark Thomas <ma...@apache.org>.
On 07/10/2013 14:26, Tim Funk wrote:
> Will this work with [insert "poorly", 'very'" poorly name'd 'directory'
> here] ?
:)
It should be better than what was there before. I doubt it covers all
possible edge cases, not least because it has to work with both Windows
and *nix file systems.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1529816 - in /tomcat/trunk: conf/catalina.properties
java/org/apache/catalina/startup/Bootstrap.java test/org/apache/catalina/startup/TestBootstrap.java
webapps/docs/changelog.xml
Posted by Tim Funk <fu...@apache.org>.
Will this work with [insert "poorly", 'very'" poorly name'd 'directory'
here] ?
-Tim
On Mon, Oct 7, 2013 at 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"
>
>
Re: svn commit: r1529816 - in /tomcat/trunk: conf/catalina.properties
java/org/apache/catalina/startup/Bootstrap.java test/org/apache/catalina/startup/TestBootstrap.java
webapps/docs/changelog.xml
Posted by Mark Thomas <ma...@apache.org>.
On 07/10/2013 14:54, Christopher Schultz wrote:
> 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, markt@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.
Go and look at the commit message again.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1529816 - in /tomcat/trunk: conf/catalina.properties
java/org/apache/catalina/startup/Bootstrap.java test/org/apache/catalina/startup/TestBootstrap.java
webapps/docs/changelog.xml
Posted by Christopher Schultz <ch...@christopherschultz.net>.
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, markt@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
Re: svn commit: r1529816 - in /tomcat/trunk: conf/catalina.properties
java/org/apache/catalina/startup/Bootstrap.java test/org/apache/catalina/startup/TestBootstrap.java
webapps/docs/changelog.xml
Posted by Mark Thomas <ma...@apache.org>.
On 07/10/2013 14:38, Christopher Schultz wrote:
> Mark,
>
> On 10/7/13 6:55 AM, markt@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.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1529816 - in /tomcat/trunk: conf/catalina.properties
java/org/apache/catalina/startup/Bootstrap.java test/org/apache/catalina/startup/TestBootstrap.java
webapps/docs/changelog.xml
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,
On 10/7/13 6:55 AM, markt@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 .*
Also, what does ".*? produce? Something looks fishy to me there...
-chris