FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Wersja 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Acording to documentation multi parameter java.net.URI constructors should escape any illegal uri characters. But this seems not to be the case for [] (square brackets) in path.
Try to run the following code:
import java.net.URI;
public class BugReproduction {
public static void main(String[] args) throws Exception {
new URI("file","/temp/a[1].txt", null);
}
}
According to documentation it should be working fine, all illegal characters should be escaped/quoted. But instead it throws:
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to run the following code:
import java.net.URI;
public class BugReproduction {
public static void main(String[] args) throws Exception {
new URI("file","/temp/a[1].txt", null);
}
}
According to documentation it should be working fine, all illegal characters should be escaped/quoted. But instead it throws:
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception is thrown
ACTUAL -
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.URI;
public class BugReproduction {
public static void main(String[] args) throws Exception {
new URI("file","/temp/a[1].txt", null);
}
}
---------- END SOURCE ----------
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Wersja 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Acording to documentation multi parameter java.net.URI constructors should escape any illegal uri characters. But this seems not to be the case for [] (square brackets) in path.
Try to run the following code:
import java.net.URI;
public class BugReproduction {
public static void main(String[] args) throws Exception {
new URI("file","/temp/a[1].txt", null);
}
}
According to documentation it should be working fine, all illegal characters should be escaped/quoted. But instead it throws:
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to run the following code:
import java.net.URI;
public class BugReproduction {
public static void main(String[] args) throws Exception {
new URI("file","/temp/a[1].txt", null);
}
}
According to documentation it should be working fine, all illegal characters should be escaped/quoted. But instead it throws:
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception is thrown
ACTUAL -
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.net.URISyntaxException: Illegal character in path at index 11: file:/temp/[1].txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:824)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.URI;
public class BugReproduction {
public static void main(String[] args) throws Exception {
new URI("file","/temp/a[1].txt", null);
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8140634 URI getSchemeSpecificPart returns incorrect value
-
- Open
-
- relates to
-
JDK-8140634 URI getSchemeSpecificPart returns incorrect value
-
- Open
-
-
JDK-6933879 URISyntaxException when non-alphanumeric characters are present in scope_id
-
- Closed
-
-
JDK-8054024 URI constructor violates guaranteed identity for URI with [brackets] in path
-
- Closed
-