I'm checking this in.
This fixes PR 28095.
I added a Mauve test. I also tested to make sure Error is not caught
here.
Tom
2006-06-20 Tom Tromey <[EMAIL PROTECTED]>
PR classpath/28095:
* java/net/URL.java (URL): Throw MalformedURLException if a
RuntimeException is caught. Chain exceptions.
Index: java/net/URL.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URL.java,v
retrieving revision 1.53
diff -u -r1.53 URL.java
--- java/net/URL.java 2 Mar 2006 00:25:21 -0000 1.53
+++ java/net/URL.java 20 Jun 2006 21:27:43 -0000
@@ -482,7 +482,17 @@
}
catch (URLParseError e)
{
- throw new MalformedURLException(e.getMessage());
+ MalformedURLException mue = new MalformedURLException(e.getMessage());
+ mue.initCause(e);
+ throw mue;
+ }
+ catch (RuntimeException e)
+ {
+ // This isn't documented, but the JDK also catches
+ // RuntimeExceptions here.
+ MalformedURLException mue = new MalformedURLException(e.getMessage());
+ mue.initCause(e);
+ throw mue;
}
if (hashAt >= 0)