If encoding specified is null or empty, the basic XML parser will fail to start.
Test:
String encoding = null; //or ""
Properties props = new Properties();
props.put("k1", "foo");
props.put("k2", "bar");
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
props.storeToXML(out, null, encoding);
} catch (Exception e) {
//fail
}
Expected:
save the properties using default encoding (UTF-8)
Actual:
NullPointerException when encoding = null
UnsupportedEncodingException when encoding = ""
Test:
String encoding = null; //or ""
Properties props = new Properties();
props.put("k1", "foo");
props.put("k2", "bar");
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
props.storeToXML(out, null, encoding);
} catch (Exception e) {
//fail
}
Expected:
save the properties using default encoding (UTF-8)
Actual:
NullPointerException when encoding = null
UnsupportedEncodingException when encoding = ""
- relates to
-
JDK-8042889 (props) Properties.loadFromXML/storeToXML should consistently use the UKit parser
-
- Closed
-