LoadService error in getClassPathResource when file location contains '+'
-------------------------------------------------------------------------

                 Key: JRUBY-4663
                 URL: http://jira.codehaus.org/browse/JRUBY-4663
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.4
         Environment: OS X 10.6.2
            Reporter: Garrett Conaty


Discovered during deployment of jruby-rack webapps.  Was getting no such file 
to load -- rack from vendor/rack.rb which contained this:

"$LOAD_PATH << File.dirname(__FILE__) + '/#{rack_dir}'; require 'rack'"

Here's where it found vendor/rack.rb in the first place

LoadService: found: 
jar:file:/Users/garrett/java/jetty-7+++.0.1/webapps/merbtest/WEB-INF/lib/jruby-rack-0.9.7-SNAPSHOT.jar!/vendor/rack.rb

Notice the + in the name.  TMP dirs under OS X tend to have +, so I first 
noticed when deploying an unexploded .war file.

When this gets passed to ExternalScript.load there was a fix for JRUBY-1965 
which basically does java.net.URLDecoder.decode(name, "ISO-8859-1") on the 
file:/ part, which is incorrect as URLDecoder is too aggressive on the decoding 
(meant to be used for HTML forms) and converts the + to a space.  However, the 
intention is correct as it fixes the issue when spaces are in the path.

I've attached a patch which fixes both issues and fixes this case.  Effectively 
in LoadService.getClassPathResource, decode the path with

path = loc.toURI().getSchemeSpecificPart();  which removes the "jar:" section 
and also decodes the "file:/" section properly, then passes this on to the 
LoadServiceResource constructor.

I believe this may also be the issue for JRUBY-4227 but haven't verified.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to