JDK-8043929 : The basic XML parser fails with a NPE or UEE if encoding is null or empty
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxp
  • Affected Version: 8,9
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2014-05-24
  • Updated: 2016-05-17
  • Resolved: 2016-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Relates :  
Description
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 = "" 

Comments
Properties has null check.
17-05-2016