-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
6
-
generic
-
generic
The spec for method getRequestProperty(String key) does not clearly define which property should be returned if request contains more then one values with the same key. Example:
import java.net.*;
public class RequestPropertyTest {
static public void main(String args[]) throws Exception {
URLConnection c = new URL("http:/www.sun.com").openConnection();
c.addRequestProperty("key", "valueOne");
c.addRequestProperty("key", "valueTwo");
System.out.println(c.getRequestProperty("key"));
}
}
This test prints 'valueTwo' now.
But the spec says nothing about what value should be returned. It means that different Java implementations can work differently.
The description of this method should be clarified.
Possibly it makes sense to add explicit note that multiple values can be associated with one key and add 'see also' reference to the 'Map<String,List<String>> getRequestProperties()' method into the description.
Also there is another problem: the description of 'addRequestProperty' has more than one meaning:
- new value added to the values list (current meaning)
- value is not added if there is a value for the given key
import java.net.*;
public class RequestPropertyTest {
static public void main(String args[]) throws Exception {
URLConnection c = new URL("http:/www.sun.com").openConnection();
c.addRequestProperty("key", "valueOne");
c.addRequestProperty("key", "valueTwo");
System.out.println(c.getRequestProperty("key"));
}
}
This test prints 'valueTwo' now.
But the spec says nothing about what value should be returned. It means that different Java implementations can work differently.
The description of this method should be clarified.
Possibly it makes sense to add explicit note that multiple values can be associated with one key and add 'see also' reference to the 'Map<String,List<String>> getRequestProperties()' method into the description.
Also there is another problem: the description of 'addRequestProperty' has more than one meaning:
- new value added to the values list (current meaning)
- value is not added if there is a value for the given key