mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-12 06:29:37 +00:00
6339649: URI.create should include a detail message when throwing IllegalArgumentException
Create enclosing exception with message of enclosed Reviewed-by: alanb, chegar
This commit is contained in:
parent
a33a3ae92b
commit
8eca7db307
@ -856,9 +856,7 @@ public final class URI
|
||||
try {
|
||||
return new URI(str);
|
||||
} catch (URISyntaxException x) {
|
||||
IllegalArgumentException y = new IllegalArgumentException();
|
||||
y.initCause(x);
|
||||
throw y;
|
||||
throw new IllegalArgumentException(x.getMessage(), x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1536,6 +1536,7 @@ public class Test {
|
||||
serial();
|
||||
urls();
|
||||
npes();
|
||||
bugs();
|
||||
}
|
||||
|
||||
|
||||
@ -1572,6 +1573,19 @@ public class Test {
|
||||
}
|
||||
|
||||
|
||||
// miscellaneous bugs/rfes that don't fit in with the test framework
|
||||
|
||||
static void bugs() {
|
||||
// 6339649 - include detail message from nested exception
|
||||
try {
|
||||
URI uri = URI.create("http://nowhere.net/should not be permitted");
|
||||
} catch (IllegalArgumentException e) {
|
||||
if ("".equals(e.getMessage()) || e.getMessage() == null) {
|
||||
throw new RuntimeException ("No detail message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
switch (args.length) {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user