Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8028868 | port-stage-ppc-aix | Michael McMahon | P3 | Resolved | Fixed | master |
Description
Following two constructors did not throw "IllegalArgumentExceptions" when given invalid url.
public URLPermission(String url, String actions)
public URLPermission(String url)
The behavior is not consistent with Javadoc descriptios:
IllegalArgumentException - if url does not result in a valid URI
-------------------------------------------------------------------------------------------------------------
Ran test below with latest promoted binaries and test failed:
import java.net.*;
public class TestConstructor {
public static void main(String args[]){
String invalidURI="http:\\www.oracle.com";
try{
URI u = URI.create(invalidURI);
}catch(IllegalArgumentException e){
System.out.println(invalidURI+" is an invalid URI");
}
try{
URLPermission permission = new URLPermission(invalidURI);
System.out.println("test fail");
}catch (IllegalArgumentException e){
System.out.println("test pass");
}
}
}
commands & results:
-bash-4.1$ /java/re/jdk/8/promoted/latest/binaries/linux-amd64/bin/java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b114)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b56, mixed mode)
bash-4.1$ /java/re/jdk/8/promoted/latest/binaries/linux-amd64/bin/javac TestConstructor.java
-bash-4.1$ /java/re/jdk/8/promoted/latest/binaries/linux-amd64/bin/java TestConstructor
http:\www.oracle.com is an invalid URI
test fail
public URLPermission(String url, String actions)
public URLPermission(String url)
The behavior is not consistent with Javadoc descriptios:
IllegalArgumentException - if url does not result in a valid URI
-------------------------------------------------------------------------------------------------------------
Ran test below with latest promoted binaries and test failed:
import java.net.*;
public class TestConstructor {
public static void main(String args[]){
String invalidURI="http:\\www.oracle.com";
try{
URI u = URI.create(invalidURI);
}catch(IllegalArgumentException e){
System.out.println(invalidURI+" is an invalid URI");
}
try{
URLPermission permission = new URLPermission(invalidURI);
System.out.println("test fail");
}catch (IllegalArgumentException e){
System.out.println("test pass");
}
}
}
commands & results:
-bash-4.1$ /java/re/jdk/8/promoted/latest/binaries/linux-amd64/bin/java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b114)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b56, mixed mode)
bash-4.1$ /java/re/jdk/8/promoted/latest/binaries/linux-amd64/bin/javac TestConstructor.java
-bash-4.1$ /java/re/jdk/8/promoted/latest/binaries/linux-amd64/bin/java TestConstructor
http:\www.oracle.com is an invalid URI
test fail
Attachments
Issue Links
- backported by
-
JDK-8028868 The constructors of URLPermission class do not behave as described in javadoc
- Resolved