Sean Story created HADOOP-15326:
-----------------------------------
Summary: ClassUtil usage of URLDecode precludes '+' in jar path
Key: HADOOP-15326
URL: https://issues.apache.org/jira/browse/HADOOP-15326
Project: Hadoop Common
Issue Type: Bug
Components: util
Environment: Java: 1.8.0_111
hadoop: 2.5.2
OSX: 10.13.3
Reporter: Sean Story
h3. Problem
ClassUtil utilizes {{URLDecoder}} to decode the path to the jar containing the
provided {{Class}}. However, as noted here:
https://bugs.openjdk.java.net/browse/JDK-8179507?focusedCommentId=14074306&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14074306
{{URLDecoder}} should only be used for HTML forms, because it causes issues
with plus signs (and other characters).
I can demonstrate the issue in the below Spock Specification:
{noformat}
import spock.lang.Specification
class Testy extends Specification{
def "testy"(){
setup:
URL url = new
URL("jar:file:/path/to/some+dir/hadoop-archives-2.5.2.jar!/org/apache/hadoop/tools/HadoopArchives.class")
when:
println url
def path = url.getPath()
println path
def other = URLDecoder.decode(path, "UTF-8")
println other
then:
path.contains("+")
other.contains("+")
}
}
{noformat}
This was run into while attempting to create a HAR file, while my
{{hadoop-archives.jar}} was in a directory that had a {{+}} char in its name.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]