-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b15
Properties::storeToXML method declares that it throws ClassCastException when Properties object contains any keys or values that are not Strings:
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/Properties.html#storeToXML(java.io.OutputStream,java.lang.String,java.lang.String)
The behavior is not matching spec.
Sample Code:
private void storeToXML_01() throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
Properties pr = new Properties();
pr.put("one", "\u7532");
pr.put(new Integer(8), 238923);
pr.put(new Object(), new Double(1.1));
pr.storeToXML(os, "Test", "UTF-8");
}
Not throwing ClassCastException.
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/Properties.html#storeToXML(java.io.OutputStream,java.lang.String,java.lang.String)
The behavior is not matching spec.
Sample Code:
private void storeToXML_01() throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
Properties pr = new Properties();
pr.put("one", "\u7532");
pr.put(new Integer(8), 238923);
pr.put(new Object(), new Double(1.1));
pr.storeToXML(os, "Test", "UTF-8");
}
Not throwing ClassCastException.
- relates to
-
JDK-8252740 java/util/Properties/LoadAndStoreXMLWithDefaults.java fails after JDK-8252354
-
- Resolved
-
-
JDK-6319672 (spec) java.util.Properties.storeToXML throws ClassCastException on a compromised properties
-
- Resolved
-