Issue Details (XML | Word | Printable)

Key: NUCCORE-371
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Todd Lipcon
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

StringUtils.getDecodedStringFromURLString deals with '+' improperly

Created: 26/Aug/09 11:30 PM   Updated: 11/Sep/09 08:40 AM   Resolved: 27/Aug/09 08:39 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0.m2


 Description  « Hide
java.net.URLDecoder is a misnamed class, since it actually decodes x-www-form-urlencoded, which is different than URL encoding. StringUtils.getDecodedStringFromURLString uses this broken class and thus inherits a bug. Specifically, '+' characters in the filename get decoded as ' ' characters.

This manifests itself in NonManagedPluginRegistry if, for example, the jar is in a path that contains a plus:

{noformat}
[datanucleusenhancer] Exception in thread "main" Error reading manifest file "jar:file:/home/todd/cloudera/cdh/build/hive/0.3.99+1/source/src/lib/datanucleus-enhancer-1.1.2.jar!/plugin.xml"
[datanucleusenhancer] org.datanucleus.exceptions.NucleusException: Error reading manifest file "jar:file:/home/todd/cloudera/cdh/build/hive/0.3.99+1/source/src/lib/datanucleus-enhancer-1.1.2.jar!/plugin.xml"
[datanucleusenhancer] at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:392)
[datanucleusenhancer] at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(NonManagedPluginRegistry.java:227)
[datanucleusenhancer] at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(NonManagedPluginRegistry.java:159)
[datanucleusenhancer] at org.datanucleus.plugin.PluginManager.registerExtensionPoints(PluginManager.java:82)
[datanucleusenhancer] at org.datanucleus.OMFContext.<init>(OMFContext.java:164)
[datanucleusenhancer] at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:153)
[datanucleusenhancer] at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1138)
[datanucleusenhancer] Caused by: java.util.zip.ZipException: error in opening zip file
[datanucleusenhancer] at java.util.zip.ZipFile.open(Native Method)
[datanucleusenhancer] at java.util.zip.ZipFile.<init>(ZipFile.java:114)
[datanucleusenhancer] at java.util.jar.JarFile.<init>(JarFile.java:133)
[datanucleusenhancer] at java.util.jar.JarFile.<init>(JarFile.java:97)
[datanucleusenhancer] at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:338)
{noformat}

The fix is to call urlString.replace('+', '%2B') before decoding the URL.

See: https://issues.apache.org/jira/browse/MAPREDUCE-714

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 27/Aug/09 08:39 AM
Thx for the report. SVN trunk has this.