[jboss-jira] [JBoss JIRA] Updated: (JBVFS-160) FileSystemContext.getFileURI returns wrong URI for UNC paths on Windows

James Livingston (JIRA) jira-events at lists.jboss.org
Thu Aug 5 03:53:49 EDT 2010


     [ https://jira.jboss.org/browse/JBVFS-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Livingston updated JBVFS-160:
-----------------------------------

    Attachment: JBVFS-160.diff


Okay, this definitely seems to be a JRE bug. The JavaDoc for URI states that:
"For any URI u that does not contain redundant syntax such as two slashes before an empty authority (as in file:///tmp/ )
...
     new URI(u.getScheme(),
            u.getUserInfo(), u.getAuthority(),
            u.getPath(), u.getQuery(),
            u.getFragment())
    .equals(u) 

if u is hierarchical"

and this doesn't hold for u=new File("\\\\localhost\shared").toURI().


It's possible to work around this by using file.toURL().toURI() instead, and changing line 132 of FileSystemContext.getFileURI(File file) to be "URL url = file.toURI().toURL();", which makes having "file:////..." in conf/bootstrap/profile.xml's applicationURIs work.



> FileSystemContext.getFileURI returns wrong URI for UNC paths on Windows
> -----------------------------------------------------------------------
>
>                 Key: JBVFS-160
>                 URL: https://jira.jboss.org/browse/JBVFS-160
>             Project: JBoss VFS
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 2.1.3.SP1
>         Environment: Windows
>            Reporter: James Livingston
>            Assignee: John Bailey
>         Attachments: JBVFS-160.diff, UncPathTest.java
>
>
> When passed a File for something with a UNC path (e.g. \\127.0.0.1\shared), FileSystemContext.getFileURI() return a URI like "file://127.0.0.1/shared" (which is what Windows itself uses) rather than "file:////127.0.0.1/shared" (which Java uses, and converts for OS calls). This will cause JBoss to fail to deploy things if they are located on an unmapped UNC location.
> I'm attaching a test case for this. To use it, you need to run it on a Windows system and have access to a something with a UNC path. The code as written expects there to be a SMB share called "shared" on the machine it is run on, but it can easily be change to point elsewhere.

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

        


More information about the jboss-jira mailing list