-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
7, 8, 9
-
x86_64
-
linux_ubuntu
FULL PRODUCT VERSION :
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 14.04
A DESCRIPTION OF THE PROBLEM :
If unix filename contains question mark (and maybe other special character - untested) attempt to open such file by its URL form (file:/path/to/file) passed as an URL object to method java.net.URLConnection.getInputStream() (delegated to FileURLConnection.getInputStream()) fails. However file is normally accessible via other tools (command line, file manager etc.).
Specific example is introduced in "Steps to reproduce" section.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create file named /tmp/a.b?c: $ touch /tmp/a.b?c
2. verify file is here $ ls -al "/tmp/a.b?c"
-rw-r--r-- 1 user user 0 Jul 15 20:31 /tmp/a.b?c
3. try to open file in java code:
String fn = "file:/tmp/a/a.b?c";
URL u = new URL(fn);
URLConnection c = u.openConnection();
c.getInputStream();
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Opened InputStream should be returned to the caller without throwing exception
ACTUAL -
throws java.io.FileNotFoundException: /tmp/a.b
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
String fn = "file:/tmp/a/a.b?c";
URL u = new URL(fn);
URLConnection c = u.openConnection();
c.getInputStream();
---------- END SOURCE ----------
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 14.04
A DESCRIPTION OF THE PROBLEM :
If unix filename contains question mark (and maybe other special character - untested) attempt to open such file by its URL form (file:/path/to/file) passed as an URL object to method java.net.URLConnection.getInputStream() (delegated to FileURLConnection.getInputStream()) fails. However file is normally accessible via other tools (command line, file manager etc.).
Specific example is introduced in "Steps to reproduce" section.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create file named /tmp/a.b?c: $ touch /tmp/a.b?c
2. verify file is here $ ls -al "/tmp/a.b?c"
-rw-r--r-- 1 user user 0 Jul 15 20:31 /tmp/a.b?c
3. try to open file in java code:
String fn = "file:/tmp/a/a.b?c";
URL u = new URL(fn);
URLConnection c = u.openConnection();
c.getInputStream();
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Opened InputStream should be returned to the caller without throwing exception
ACTUAL -
throws java.io.FileNotFoundException: /tmp/a.b
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
String fn = "file:/tmp/a/a.b?c";
URL u = new URL(fn);
URLConnection c = u.openConnection();
c.getInputStream();
---------- END SOURCE ----------