[ 
https://issues.apache.org/jira/browse/MAPREDUCE-714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727883#action_12727883
 ] 

Todd Lipcon commented on MAPREDUCE-714:
---------------------------------------

Here's a potential fix, which is really klugey. If no one objects to this I'll 
upload it as a real patch in the next couple of days:

{code}
diff --git a/src/mapred/org/apache/hadoop/mapred/JobConf.java 
b/src/mapred/org/apache/hadoop/mapred/JobConf.java
index 11be95a..4794eab 100644
--- a/src/mapred/org/apache/hadoop/mapred/JobConf.java
+++ b/src/mapred/org/apache/hadoop/mapred/JobConf.java
@@ -1452,6 +1452,13 @@ public class JobConf extends Configuration {
           if (toReturn.startsWith("file:")) {
             toReturn = toReturn.substring("file:".length());
           }
+          // URLDecoder is a misnamed class, since it actually decodes
+          // x-www-form-urlencoded MIME type rather than actual
+          // URL encoding (which the file path has). Therefore it would
+          // decode +s to ' 's which is incorrect (spaces are actually
+          // either unencoded or encoded as "%20"). Replace +s first, so
+          // that they are kept sacred during the decoding process.
+          toReturn = toReturn.replaceAll("\\+", "%2B");
           toReturn = URLDecoder.decode(toReturn, "UTF-8");
           return toReturn.replaceAll("!.*$", "");
         }
{code}

> JobConf.findContainingJar unescapes unnecessarily on Linux
> ----------------------------------------------------------
>
>                 Key: MAPREDUCE-714
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-714
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>            Reporter: Todd Lipcon
>
> In JobConf.findContainingJar, the path name is decoded using 
> URLDecoder.decode(...). This was done by Doug in r381794 (commit msg 
> "Un-escape containing jar's path, which is URL-encoded.  This fixes things 
> primarily on Windows, where paths are likely to contain spaces.") 
> Unfortunately, jar paths do not appear to be URL encoded on Linux. If you try 
> to use "hadoop jar" on a jar with a "+" in it, this function decodes it to a 
> space and then the job cannot be submitted.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to