Hi Alan,
The webrev looks good to me.
On 5/12/2014 11:02 AM, Alan Bateman wrote:
In JDK 8 we brought in a tiny XML parser to support the Properties
loadFromXML/storeToXML methods. We needed this for the Compact
Profiles work, specifically builds of compact1 as they do not have
JAXP/XML APIs.
At the time we were a bit nervous about switching the XML parser for
anything other than compact1 builds. One reason for this was that the
original javadoc didn't constrain the encodings that has to be
supported, another reason was confidence in the tests as we didn't
have too many tests for these methods in the jdk repository.
Yes, there may be a compatibility concern in case an application
attempts to read a Properties file previously saved with a different
encoding.
I'd like to revisit one and switch over the implementation to always
use the small parser. This allows for some clean-up, specifically it
removes the need for the JDK-internal service type that was needed to
use the JAXP code. On the original concerns then the spec was
clarified in 8 to only require UTF-8 and UTF-16. In addition there
were several tests added to better exercise these methods and the
implementation. Also I think switching this early in JDK 9 means that
we maximize the time to hear about any issues.
Would you think the wordings in the javadoc of Properties could be
stronger in terms of encoding, e.g. instead of:
The |loadFromXML(InputStream)|
<http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#loadFromXML-java.io.InputStream->and
|storeToXML(OutputStream, String, String)|
<http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#storeToXML-java.io.OutputStream-java.lang.String-java.lang.String->methods
load and store properties in a simple XML format. By default the UTF-8
character encoding is used, however a specific encoding may be specified
if required. Implementations are required to support UTF-8 and UTF-16
and may support other encodings.
change it to:
The |loadFromXML(InputStream)|
<http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#loadFromXML-java.io.InputStream->
and |storeToXML(OutputStream, String, String)|
<http://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#storeToXML-java.io.OutputStream-java.lang.String-java.lang.String->
methods load and store properties in a simple XML format. The default
character encoding is UTF-8 which is the recommended encoding for all
Properties files in XML format. Applications should use UTF-8 to avoid
potential encoding errors. Implementations are required to support UTF-8
and UTF-16.
XML specification requires processors to support both UTF-8 and 16. But
UTF-8 is the dominant encoding for XML files. The above suggestion is
"stronger" in terms of using UTF-8, but not as strong as for example,
Google's Sitemap service that was straight forward in their requirement:
"We require your Sitemap file to be UTF-8 encoded".
-Joe
The webrev with the proposed changes is here, mostly red=removal so
easy to review:
http://cr.openjdk.java.net/~alanb/8042889/webrev/
-Alan.