|
From: <otm...@us...> - 2010-06-24 22:16:49
|
Revision: 7068
http://jython.svn.sourceforge.net/jython/?rev=7068&view=rev
Author: otmarhumbel
Date: 2010-06-24 22:16:42 +0000 (Thu, 24 Jun 2010)
Log Message:
-----------
accept directories containing + signs,
both during installation and at runtime in standalone mode
Modified Paths:
--------------
trunk/installer/src/java/org/python/util/install/JarInfo.java
trunk/jython/src/org/python/core/PySystemState.java
Modified: trunk/installer/src/java/org/python/util/install/JarInfo.java
===================================================================
--- trunk/installer/src/java/org/python/util/install/JarInfo.java 2010-06-23 20:25:08 UTC (rev 7067)
+++ trunk/installer/src/java/org/python/util/install/JarInfo.java 2010-06-24 22:16:42 UTC (rev 7068)
@@ -111,7 +111,13 @@
URL url = getClass().getResource(className + ".class");
// we expect an URL like:
// jar:file:/C:/stuff/jython21i.jar!/org/python/util/install/JarInfo.class
- String urlString = URLDecoder.decode(url.toString(), "UTF-8");
+ // escape plus signs, since the URLDecoder would turn them into spaces
+ final String plus = "\\+";
+ final String escapedPlus = "__ppluss__";
+ String rawUrl = url.toString();
+ rawUrl = rawUrl.replaceAll(plus, escapedPlus);
+ String urlString = URLDecoder.decode(rawUrl, "UTF-8");
+ urlString = urlString.replaceAll(escapedPlus, plus);
int jarSeparatorIndex = urlString.lastIndexOf(JAR_SEPARATOR);
if (!urlString.startsWith(JAR_URL_PREFIX) || jarSeparatorIndex <= 0) {
throw new InstallerException(Installation.getText(TextKeys.UNEXPECTED_URL, urlString));
Modified: trunk/jython/src/org/python/core/PySystemState.java
===================================================================
--- trunk/jython/src/org/python/core/PySystemState.java 2010-06-23 20:25:08 UTC (rev 7067)
+++ trunk/jython/src/org/python/core/PySystemState.java 2010-06-24 22:16:42 UTC (rev 7068)
@@ -1073,14 +1073,18 @@
// we expect an URL like jar:file:/install_dir/jython.jar!/org/python/core/PySystemState.class
if (url != null) {
try {
- String urlString = URLDecoder.decode(url.toString(),
- Charset.defaultCharset().name());
+ // escape plus signs, since the URLDecoder would turn them into spaces
+ final String plus = "\\+";
+ final String escapedPlus = "__ppluss__";
+ String rawUrl = url.toString();
+ rawUrl = rawUrl.replaceAll(plus, escapedPlus);
+ String urlString = URLDecoder.decode(rawUrl, "UTF-8");
+ urlString = urlString.replaceAll(escapedPlus, plus);
int jarSeparatorIndex = urlString.lastIndexOf(JAR_SEPARATOR);
if (urlString.startsWith(JAR_URL_PREFIX) && jarSeparatorIndex > 0) {
jarFileName = urlString.substring(JAR_URL_PREFIX.length(), jarSeparatorIndex);
}
- } catch (Exception e) {
- }
+ } catch (Exception e) {}
}
return jarFileName;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|