-
Bug
-
Resolution: Fixed
-
P2
-
None
-
b25
-
Verified
Consider the following code with the specs quoted
URLConnection c = new URL("file:/usr").openConnection();
c.connect();
System.out.println("c = " + c);
// "The Map keys are Strings that represent the response-header field names"
System.out.println(c.getHeaderFields().keySet());
// Returns the key for the nth header field.
// It returns null if there are fewer than n+1 fields.
System.out.println(c.getHeaderFieldKey(0));
// "It returns null if there are fewer than n+1 fields."
System.out.println(c.getHeaderField(0));
The output would be:
c = sun.net.www.protocol.file.FileURLConnection:file:/usr
[]
content-type
text/plain
::getHeaderFields indicates that there are zero header fields while getHeaderField/Key(index) say the opposite
FtpURLConnection seem to be affected as well as FileURLConnection
URLConnection c = new URL("file:/usr").openConnection();
c.connect();
System.out.println("c = " + c);
// "The Map keys are Strings that represent the response-header field names"
System.out.println(c.getHeaderFields().keySet());
// Returns the key for the nth header field.
// It returns null if there are fewer than n+1 fields.
System.out.println(c.getHeaderFieldKey(0));
// "It returns null if there are fewer than n+1 fields."
System.out.println(c.getHeaderField(0));
The output would be:
c = sun.net.www.protocol.file.FileURLConnection:file:/usr
[]
content-type
text/plain
::getHeaderFields indicates that there are zero header fields while getHeaderField/Key(index) say the opposite
FtpURLConnection seem to be affected as well as FileURLConnection
- clones
-
JDK-8241378 j.net.URLConnection::getHeaderFieldKey(int) behavior does not reliably conform to its specification
-
- Closed
-
- relates to
-
JDK-8253696 WebEngine refuses to load local "file:///" CSS stylesheets when using JDK 15
-
- Closed
-