bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/28095] New: Suns JDK handles exceptions in URLStreamHandl


From: jan at gatespacetelematics dot com
Subject: [Bug classpath/28095] New: Suns JDK handles exceptions in URLStreamHandler.parseURL differently
Date: 20 Jun 2006 11:52:10 -0000

If a RuntimeException is thrown by URLStreamHandler.parseURL during a "new
URL(...)" then Classpath lets the exception through. Suns JDK seems to catch
RuntimeExceptions in the URL constructor and turn them into a
MalformedURLException. This doesn't seems to be documented. So this is not bug
but a difference from SUN based implemenations.

Example code to test with:

import java.net.*;

class u extends URLStreamHandler {

    public static void main(String [] v) throws MalformedURLException  {
        new URL(null, "blah://", new u());
    }

    protected URLConnection openConnection(URL u) {
        return null;
    }

    protected void parseURL(URL url, String spec, int start, int end) {
        throw new RuntimeException();
    }
}

With Sun JDK it generates:
Exception in thread "main" java.net.MalformedURLException
        at java.net.URL.<init>(URL.java:571)
        at u.main(u.java:6)

With Cacao it generates:
Exception in thread "main" java.lang.RuntimeException
   at u.parseURL(u.java:14)
   at java.net.URL.<init>(URL.java:480)
   at u.main(u.java:6)


-- 
           Summary: Suns JDK handles exceptions in URLStreamHandler.parseURL
                    differently
           Product: classpath
           Version: 0.91
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan at gatespacetelematics dot com
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28095





reply via email to

[Prev in Thread] Current Thread [Next in Thread]