Author: markt
Date: Wed Jan 18 11:51:53 2012
New Revision: 1232843
URL: http://svn.apache.org/viewvc?rev=1232843&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52480
When converting class path entries from URLs to files/directories,
ensure that any URL encoded characters are converted. Fixes JSP
compilation with javac when Tomcat is installed at a path that includes
spaces.
Modified:
tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java?rev=1232843&r1=1232842&r2=1232843&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java Wed Jan 18
11:51:53 2012
@@ -28,11 +28,13 @@ import java.io.FilePermission;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.net.URLDecoder;
import java.net.URLStreamHandlerFactory;
import java.util.ArrayList;
import java.util.jar.JarFile;
@@ -1027,9 +1029,9 @@ public class WebappLoader extends Lifecy
for (int i = 0; i < repositories.length; i++) {
String repository = repositories[i].toString();
if (repository.startsWith("file://"))
- repository = repository.substring(7);
+ repository = utf8Decode(repository.substring(7));
else if (repository.startsWith("file:"))
- repository = repository.substring(5);
+ repository = utf8Decode(repository.substring(5));
else if (repository.startsWith("jndi:"))
repository =
servletContext.getRealPath(repository.substring(5));
@@ -1053,6 +1055,16 @@ public class WebappLoader extends Lifecy
}
+ private String utf8Decode(String input) {
+ String result = null;
+ try {
+ result = URLDecoder.decode(input, "UTF-8");
+ } catch (UnsupportedEncodingException uee) {
+ // Impossible. All JVMs are required to support UTF-8.
+ }
+ return result;
+ }
+
// try to extract the classpath from a loader that is not URLClassLoader
private String getClasspath( ClassLoader loader ) {
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]