diff options
author | Sven Gothel <[email protected]> | 2013-10-18 22:09:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-18 22:09:43 +0200 |
commit | c9093e491d4b78b12973ec1614bf3146fce26a83 (patch) | |
tree | af084b8ab527a574a35ca390ac9d089595382d43 /src/junit/com/jogamp/common/net/URIDumpUtil.java | |
parent | a2a71139e6d8dc1527cd45df5c710b1ad1f2f611 (diff) |
Fix Bug 857: GlueGen produces erroneous file URI on Windows, which breaks Netbeans's JarURLStreamHandler
- 'URL IOUtil.toURL(URI)'
- Needs to encode the file-path portion on Windows(*) if exists.
The file-path here shall only be encoded as follows:
- backslash -> slash
- ensure starting with slash
(*) We perform above action for all OS,
if 'false == File.separator.equals("/")'
- Added high verbosity in DEBUG mode to easy debugging
for future cases ..
- Cleanup URI/URL unit tests, i.e. split URLCompositionTest into:
- TestIOUtilURICompose
- TestIOUtilURIHandling (Now covers Bug 857 as well)
- TestUrisWithAssetHandler
- TestURIQueryProps
Tested all unit tests manually on GNU/Linux and Windows w/ JRE 7u45
Diffstat (limited to 'src/junit/com/jogamp/common/net/URIDumpUtil.java')
-rw-r--r-- | src/junit/com/jogamp/common/net/URIDumpUtil.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/junit/com/jogamp/common/net/URIDumpUtil.java b/src/junit/com/jogamp/common/net/URIDumpUtil.java new file mode 100644 index 0000000..132a19c --- /dev/null +++ b/src/junit/com/jogamp/common/net/URIDumpUtil.java @@ -0,0 +1,49 @@ +package com.jogamp.common.net; + +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; + +public class URIDumpUtil { + public static void showURX(String urx) throws MalformedURLException, URISyntaxException { + System.err.println("XXXXXX "+urx); + showURL(new URL(urx)); + showURI(new URI(urx)); + System.err.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); + } + + public static void showURL(URL url) { + System.err.println("YYYYYY URL "+url); + System.err.println("protocol: "+url.getProtocol()); + System.err.println("auth: "+url.getAuthority()); + System.err.println("host: "+url.getHost()); + System.err.println("port: "+url.getPort() + " ( " + url.getDefaultPort() + " ) " ); + System.err.println("file: "+url.getFile() + " ( path " + url.getPath() + ", query " + url.getQuery() + " ) " ); + System.err.println("ref: "+url.getRef()); + } + public static void showURI(URI uri) { + System.err.println("ZZZZZZ URI "+uri); + // 1 [scheme:]scheme-specific-part[#fragment] + System.err.println("1 scheme: "+uri.getScheme()); + System.err.println("1 scheme-part: "+uri.getRawSchemeSpecificPart()); + System.err.println("1 fragment: "+uri.getRawFragment()); + + // 2 [scheme:][//authority][path][?query][#fragment] + System.err.println("2 scheme: "+uri.getScheme()); + System.err.println("2 auth: "+uri.getRawAuthority()); + System.err.println("2 path: "+uri.getRawPath()); + System.err.println("2 query: "+uri.getRawQuery()); + System.err.println("2 fragment: "+uri.getRawFragment()); + + // 3 [scheme:][//authority][path][?query][#fragment] + // authority: [user-info@]host[:port] + System.err.println("3 scheme: "+uri.getScheme()); + System.err.println("3 user-info: "+uri.getRawUserInfo()); + System.err.println("3 host: "+uri.getHost()); + System.err.println("3 port: "+uri.getPort()); + System.err.println("3 path: "+uri.getRawPath()); + System.err.println("3 query: "+uri.getRawQuery()); + System.err.println("3 fragment: "+uri.getRawFragment()); + } +} |