diff options
author | Sven Gothel <[email protected]> | 2012-04-02 17:23:31 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-04-02 17:23:31 +0200 |
commit | 924e2eefd99b2c93d50c19db146253c85e04fe6d (patch) | |
tree | 1cec506c776754bd2cfcc03f5691667a8f35d835 /src/java/com/jogamp/common/net | |
parent | 28814ae3946cf13619b70ddaf08c564f88252519 (diff) |
Fix IOUtil: Handle all '../' and './' cases by reducing the path.
Diffstat (limited to 'src/java/com/jogamp/common/net')
-rw-r--r-- | src/java/com/jogamp/common/net/AssetURLContext.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/java/com/jogamp/common/net/AssetURLContext.java b/src/java/com/jogamp/common/net/AssetURLContext.java index 00c7df7..411d986 100644 --- a/src/java/com/jogamp/common/net/AssetURLContext.java +++ b/src/java/com/jogamp/common/net/AssetURLContext.java @@ -8,8 +8,6 @@ import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; -import jogamp.common.Debug; - import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.util.IOUtil; @@ -17,7 +15,7 @@ import com.jogamp.common.util.IOUtil; * See {@link PiggybackURLConnection} for description and examples. */ public abstract class AssetURLContext implements PiggybackURLContext { - private static final boolean DEBUG = Debug.isPropertyDefined("jogamp.debug.IOUtil", true); + private static final boolean DEBUG = IOUtil.DEBUG; /** The <i>asset URL</i> protocol name <code>asset</code> */ public static final String asset_protocol = "asset"; @@ -154,13 +152,14 @@ public abstract class AssetURLContext implements PiggybackURLContext { if(DEBUG) { System.err.println("AssetURLContext.resolve: <"+path+">"); } + path = IOUtil.cleanPathString(path); try { // lookup as valid sub-protocol url = new URL(path); conn = open(url); type = null != conn ? 1 : -1; - } catch(MalformedURLException e1) { if(DEBUG) { System.err.println("ERR: "+e1.getMessage()); } } + } catch(MalformedURLException e1) { if(DEBUG) { System.err.println("ERR(0): "+e1.getMessage()); } } if(null == conn && null != cl) { // lookup via ClassLoader .. cleanup leading '/' @@ -185,7 +184,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { conn = open(url); type = null != conn ? 3 : -1; } - } catch (Throwable e) { if(DEBUG) { System.err.println("ERR: "+e.getMessage()); } } + } catch (Throwable e) { if(DEBUG) { System.err.println("ERR(1): "+e.getMessage()); } } } if(DEBUG) { |