Souvik Banerjee
2015-11-24 06:11:37 UTC
On Windows, opening file:/ URLs with question marks in their name does not work as expected. On Unix-like operating systems, a URL like "file:///var/www/index.html?search=query" would open the file "/var/www/index.html". But on Windows the equivalent URL (using drive letters instead) would open "index.html?search=query" which does not exist. I expect "index.html" to be opened on Windows.
I think I have traced this issue to the following file:
https://github.com/openjdk-mirror/jdk7u-jdk/blob/f4d80957e89a19a29bb9f9807d2a28351ed7f7df/src/windows/classes/sun/net/www/protocol/file/Handler.java
On line 79 the getFile() method is called and is decoded with ParseUtil.decode(). According to line 808 of src/share/classes/java/net/URL.java getFile() returns the concatenation of getURL() and getQuery().
However, in src/solaris/classes/sun/net/www/protocol/file/Handler.java at line 80, getPath() is used instead (which removes the query part of the URL). I think getPath() should be used in the Windows file handler as well.
I tried checking the Java Bug Database to see if this issue had been reported, but I could not find any similar issues. Please let me know if this is actually what is supposed to happen.
Souvik Banerjee
I think I have traced this issue to the following file:
https://github.com/openjdk-mirror/jdk7u-jdk/blob/f4d80957e89a19a29bb9f9807d2a28351ed7f7df/src/windows/classes/sun/net/www/protocol/file/Handler.java
On line 79 the getFile() method is called and is decoded with ParseUtil.decode(). According to line 808 of src/share/classes/java/net/URL.java getFile() returns the concatenation of getURL() and getQuery().
However, in src/solaris/classes/sun/net/www/protocol/file/Handler.java at line 80, getPath() is used instead (which removes the query part of the URL). I think getPath() should be used in the Windows file handler as well.
I tried checking the Java Bug Database to see if this issue had been reported, but I could not find any similar issues. Please let me know if this is actually what is supposed to happen.
Souvik Banerjee