[9] RFC JDK-8068373: (prefs) FileSystemPreferences writes \0 to XML storage, causing loss of all preferences
Paul Sandoz
paul.sandoz at oracle.com
Thu Feb 12 12:37:30 UTC 2015
Hi Brian,
What do existing XML APIs do?
My guess from looking at your webrev APIs such as DOM allow such invalid characters when writing and reading? If so that would seem to be more of a fundamental issue with those APIs and not specifically with preferences.
I think there should be an error if a key or value contains a the U+0000 character when writing out the set of property entries to XML, otherwise it just propagates the error to who or what is consuming that XML file.
Paul.
On Feb 12, 2015, at 2:33 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> This is a request for comment only, at this point. There is no associated formal test but there is one in the issue description.
>
> Issue: https://bugs.openjdk.java.net/browse/JDK-8068373
> Patch: http://cr.openjdk.java.net/~bpb/8068373/webrev.02/
>
> I mostly want to know how out to lunch this approach is, for the moment only in the context of FileSystemPreferences, not exporting/importing to/from XML in general from generic Preferences.
>
> Two things should be noted here. The Preferences (and Properties) can be exported to and imported from an XML format on all platforms. In the case of Unix (Linux and Solaris, I believe) this is also the format used to store the Preferences whereas on other platforms that is not the case. Therefore for these Unix cases there is the possibility of loss if things are not losslessly round trip encoded into XML. The present issue is one such case with dire consequences.
>
> The main problems as I see them are 1) how to maintain compatibility across Java versions, and 2) how to preserve what can be added as a Preference. With respect to the latter item, this should not be constrained because the datum happens to be cached in XML.
>
> This particular solution is data-preserving with respect to the issue addressed if the same or later version of a JVM is used, and does not cause older Java versions reading the XML cache to fail.
>
> Thanks,
>
> Brian
More information about the core-libs-dev
mailing list