NormalizedFile and JRubyFile getAbsolutePath() broken for UNC paths (breaks 
ruby_home, loadPath, etc etc)
---------------------------------------------------------------------------------------------------------

                 Key: JRUBY-915
                 URL: http://jira.codehaus.org/browse/JRUBY-915
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 0.9.9
         Environment: Windows XP, OpenAFS client
            Reporter: Mike Wyer


With JRUBY_HOME set to //ms/dist/ruby/PROJ/jruby/0.9.9 (or 
\\ms\dist\ruby\PROJ\jruby\0.9.9 behaviour is the same),
Ruby.getJRubyHome loads the system property jruby.home, then calls verifyHome() 
on that string
verifyHome() creates a NormalizedFile from its string argument, then calls  
getAbsolutePath .
This returns the path "/:/ms/dist/ruby/PROJ/jruby/0.9.9" which is no use at all.

If a plain File (with the same path) is created, getAbsolutePath returns the 
right result, which can then have the separatorChar replaced.
Something in the overridden NormalizedFile methods is confusing 
File.getAbsolutePath, but I haven't been able to determine which one (yet).

As a workaround, I've updated both NormalizedFile and JRubyFile (which has the 
same problem) with a tweaked getAbsolutePath method:
    public String getAbsolutePath() {
        File tmp = new File(super.getPath());
        return tmp.getAbsolutePath().replace(File.separatorChar, '/');
    }

This delegates *all* the getAbsolutePath functionality to the Java File class, 
then fixes the separators of the return value.
This works on UNC paths, without breaking normal C:/foo paths.

-- 
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