jdk/src/java.base/share/classes/java/net/URI.java
changeset 35393 12d55e1947f7
parent 34939 4fd867517aec
child 38866 de92f990074f
--- a/jdk/src/java.base/share/classes/java/net/URI.java	Thu Jan 28 09:49:00 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/URI.java	Fri Jan 29 11:35:56 2016 +0100
@@ -1080,11 +1080,8 @@
      *          If a protocol handler for the URL could not be found,
      *          or if some other error occurred while constructing the URL
      */
-    public URL toURL()
-        throws MalformedURLException {
-        if (!isAbsolute())
-            throw new IllegalArgumentException("URI is not absolute");
-        return new URL(toString());
+    public URL toURL() throws MalformedURLException {
+        return URL.fromURI(this);
     }
 
     // -- Component access methods --