Bug 945 - GlueGen's IOUtil does not consider file URI's authority when converting to file-path or URL (Windows UNC / share host)
Summary: GlueGen's IOUtil does not consider file URI's authority when converting to fi...
Status: RESOLVED FIXED
Alias: None
Product: Gluegen
Classification: JogAmp
Component: core (show other bugs)
Version: 2
Hardware: All windows
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2014-01-20 17:22 CET by Julien Gouesse
Modified: 2014-01-22 22:44 CET (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
gluegen efb7c478fda04336292104b10c3adf985d59b173 jogl dff056e512f2ec732fadb24c3ed8176626ab5c27
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Gouesse 2014-01-20 17:22:51 CET
GlueGen doesn't handle file locations starting with \\, it is unable to retrieve them. Maybe it has been caused bu the fixes of the bugs 820 and 857. As you can see below, as a result, it tries to look at a local directory instead of looking at the correct remote directory on a network disk:
Catched FileNotFoundException: \srv-16\bases-xm\BXM-ed\srv-16.orcl.DM99_ED\lib\jogl\gluegen-rt-natives-windows-i586.jar (Le chemin d’accès spécifié est introuvable),
while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform,
classJarURI jar:file:////srv-16/bases-xm/BXM-ed/srv-16.orcl.DM99_ED/lib/jogl/gluegen-rt.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName gluegen-rt-natives-windows-i586.jar):
[ file:////srv-16/bases-xm/BXM-ed/srv-16.orcl.DM99_ED/lib/jogl/gluegen-rt.jar -> file:////srv-16/bases-xm/BXM-ed/srv-16.orcl.DM99_ED/lib/jogl/ ]
+ gluegen-rt-natives-windows-i586.jar -> slim: jar:file:////srv-16/bases-xm/BXM-ed/srv-16.orcl.DM99_ED/lib/jogl/gluegen-rt-natives-windows-i586.jar!/

However, if the network disk is mounted as a shared disk, as its path starts with a letter (for example R:\), it works.
Comment 1 Sven Gothel 2014-01-22 17:37:04 CET
JNLP application work via 'file://servername/path/to/file' notation.

However, referencing class files via Windows UNC does not, i.e.:
  java -classpath .;\\risa.goethel.localnet\deployment\test\jogamp\jogl\build-win32\jar\jogl-all.jar .. etc
Comment 2 Sven Gothel 2014-01-22 17:55:49 CET
Test referencing class files via Windows UNC does not, i.e.:
  java -classpath .;\\risa.goethel.localnet\deployment\test\jogamp\jogl\build-win32\jar\jogl-all.jar .. etc

Result:

OK:

getJarURI Default jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt.jar!/com/jogamp/common/os/Platform.class
  -> jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt.jar!/com/jogamp/common/os/Platform.class
getJarURI res: com.jogamp.common.os.Platform 
  -> jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt.jar!/com/jogamp/common/os/Platform.class -> jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt.jar!/com/jogamp/common/os/Platform.class

+++

ERROR

getJarFile.0: jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/
getJarSubURI res: jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/ 
  -> file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/ -> file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar 
  -> file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar
IOUtil.toURL.0: isJAR true, hasSubURI true
        , uri jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/
         str -> file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar
         ascii -> file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar
         ssp -> //risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar
         frag -> null
         path -> /deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar
         path.decoded -> /deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar

^^^ Still fine (path)

Below, we loose the host part:

IOUtil.toURL.1b: fUri file:/C:/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar
        , fUrl file:/C:/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar^M
getJarEntry res: jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/ -> file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/ -> 107 -> /

IOUtil.toURL.2: fPath \deployment\test\jogamp\gluegen\build-win32\gluegen-rt-natives-windows-i586.jar
         -> /deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar
        , jarEntry /
        , post !/
         -> jar:file:/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/

IOUtil.toURL.X: mode 2, jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/
         -> jar:file:/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/
getJarFile.1: jar:file:/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/

Catched FileNotFoundException: \deployment\test\jogamp\gluegen\build-win32\gluegen-rt-natives-windows-i586.jar 

(The system cannot find the path specified), while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform, classJarURI jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName gluegen-rt-natives-windows-i586.jar): [ file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt.jar -> file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/ ] + gluegen-rt-natives-windows-i586.jar -> slim: jar:file://risa.goethel.localnet/deployment/test/jogamp/gluegen/build-win32/gluegen-rt-natives-windows-i586.jar!/^M
java.io.FileNotFoundException: \deployment\test\jogamp\gluegen\build-win32\gluegen-rt-natives-windows-i586.jar (The system cannot find the path specified)^M
Comment 3 Sven Gothel 2014-01-22 20:17:37 CET
gluegen efb7c478fda04336292104b10c3adf985d59b173

    Note: Authority for 'file-scheme' URI's is used on Windows 
               to denote the host of the shared resource -> UNC
    
    Following methods of IOUtil didn't consider the authority for file-scheme URI:
      'URL toURL(final URI uri)'
      'String decodeURIToFilePath(final String uriPath)'
      'String decodeURIIfFilePath(final URI uri)'
    
    Further more, the patterns 'patternSingleFS' and 'patternSingleBS'
    converted multiple '\' '/' to one replacement.
    However, we should not change the separator count and replace them one-by-one.
    
    TestIOUtilURIHandling:
      - Added shared-file-host 'filehost' test cases to file URIs and plain file path tests.
      - Passed on Unix and Windows.
    
    Added 'make/scripts/test-win32-smb_share.bat'
      - Testing actual windows share usage
      - Passed on Windows

jogl dff056e512f2ec732fadb24c3ed8176626ab5c27
   Add test script to launch unit test from samba share on windows
Comment 4 Julien Gouesse 2014-01-22 20:44:45 CET
Nice job. Thank you very much.