diff options
5 files changed, 26 insertions, 4 deletions
diff --git a/ardor3d-audio/src/main/java/com/ardor3d/audio/FilenameURL.java b/ardor3d-audio/src/main/java/com/ardor3d/audio/FilenameURL.java index eab3749..8fcb116 100644 --- a/ardor3d-audio/src/main/java/com/ardor3d/audio/FilenameURL.java +++ b/ardor3d-audio/src/main/java/com/ardor3d/audio/FilenameURL.java @@ -9,6 +9,7 @@ */ package com.ardor3d.audio; +import java.net.URI; import java.net.URL; /** @@ -123,6 +124,7 @@ public class FilenameURL try { url = new URL( filename ); + //FIXME use this to get rid of a deprecated call: url = new URI( filename ).toURL(); } catch( Exception e ) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java b/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java index 7690b35..02430ce 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java @@ -11,6 +11,8 @@ package com.ardor3d.util; import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URI; import java.net.URL; public class UrlUtils { @@ -28,7 +30,7 @@ public class UrlUtils { * @throws MalformedURLException * if we are unable to create the URL. */ - public static URL resolveRelativeURL(final URL primaryUrl, final String relativeLoc) throws MalformedURLException { + public static URL resolveRelativeURL(final URL primaryUrl, final String relativeLoc) throws MalformedURLException, URISyntaxException { // Because URL(base, string) does not handle correctly URLs that have %2F, we have to manually replace these. // So, we grab the URL as a string String url = primaryUrl.toString(); @@ -37,6 +39,8 @@ public class UrlUtils { url = url.replaceAll("\\%2[F,f]", "/"); // And make our new URL + //FIXME: the line below should get rid of a deprecated call but it throws java.lang.IllegalArgumentException: URI is not absolute + //return new URI(url).resolve(relativeLoc).toURL(); return new URL(new URL(url), relativeLoc); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java index b7a73c3..2505d61 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java @@ -92,6 +92,8 @@ public class SimpleResourceLocator implements ResourceLocator { spec = spec.replaceAll("\\+", "%20"); final URL rVal = new URL(_baseDir.toURL(), spec); + //FIXME use this to get rid of a deprecated call: + //final URL rVal = _baseDir.resolve(spec).toURL(); // open a stream to see if this is a valid resource // XXX: Perhaps this is wasteful? Also, what info will determine validity? rVal.openStream().close(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java index ae1885c..f6bf998 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java @@ -13,6 +13,8 @@ package com.ardor3d.util.resource; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.net.URLDecoder; import java.util.Objects; @@ -89,7 +91,7 @@ public class URLResourceSource implements ResourceSource { return new URLResourceSource(srcURL); } - } catch (final MalformedURLException ex) { + } catch (final MalformedURLException|URISyntaxException ex) { } catch (final IOException ex) { } if (logger.isLoggable(Level.FINEST)) { @@ -192,6 +194,12 @@ public class URLResourceSource implements ResourceSource { if (protocol != null && host != null && file != null) { setURL(new URL(protocol, host, file)); + //FIXME use this to get rid of a deprecated call +// try { +// setURL(new URI(protocol, host, file, null).toURL()); +// } catch (final URISyntaxException urise) { +// throw new IOException(urise); +// } } _type = capsule.readString("type", null); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java index ce426ee..7538071 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java @@ -23,6 +23,8 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; @@ -183,10 +185,12 @@ public final class PropertiesDialog extends JDialog { public void setImage(final String image) { try { final URL file = new URL("file:" + image); + //FIXME use this to get rid of a deprecated call: + //final URL file = new URI("file:" + image).toURL(); setImage(file); // We can safely ignore the exception - it just means that the user // gave us a bogus file - } catch (final MalformedURLException e) { + } catch (final MalformedURLException/*|URISyntaxException*/ e) { } } @@ -521,7 +525,9 @@ public final class PropertiesDialog extends JDialog { URL url = null; try { url = new URL("file:" + file); - } catch (final MalformedURLException e) { + //FIXME use this to get rid of a deprecated call: + //url = new URI("file:" + file).toURL(); + } catch (final MalformedURLException/*|URISyntaxException*/ e) { } return url; } |