History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-260
Type: Bug Bug
Status: Open Open
Assignee: Unassigned
Reporter: Scott McFarland
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

PropertiesConverter does not handle tabs and newlines

Created: 19/Dec/05 04:26 PM   Updated: 10/Feb/06 02:08 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Issue Links:
Related
 

JDK version and platform: Sun 1.4.2_08-b03 for Windows


 Description  « Hide
PropertiesConverter makes some bad assumptions about the Strings that
appear in the name-value pairs. From the PropertiesConverter javadoc:

Special converter for java.util.Properties that stores properties in a
more compact form than java.util.Map. Because all entries of a
Properties instance are Strings, a single element is used for each
property with two attributes; one for key and one for value.

The problem is that the XML spec
(http://www.w3.org/TR/REC-xml/#AVNormalize) and the
org.xmlpull.mxp1.MXParser "normalize" attributes to remove tabs,
newlines, and carriage returns.

So a value inside a Properties object called "my<tab>property" gets
normalized to "my<space>property" when reading the attribute (see
MXParser.parseAttribute()).

When writing Properties to a file, Java escapes the tabs with a \t so
that it would appear in the property files as

key=my\tproperty

PropertiesConverter should probably be removed entirely and Properties
should be encoded just like any other Map using XML entities. It could
still use attributes, but it would have to use [[CDATA]] in order to
work with the XML spec.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.