Benno Huber created OPENJPA-2362:
------------------------------------
Summary: Conversion of data type CHAR and CHAR_OBJ to XML not
valid for character values < 0x20
Key: OPENJPA-2362
URL: https://issues.apache.org/jira/browse/OPENJPA-2362
Project: OpenJPA
Issue Type: Bug
Components: xml store
Affects Versions: 2.3.0
Environment: independent
Reporter: Benno Huber
Saving data with char values below 0x20 will throw runtime execption next time
should be retrieved (Stack trace below).
Code for XMLFileHandler starting line 309 should be modified like this:
case JavaTypes.CHAR:
case JavaTypes.CHAR_OBJ:
// quote chars so we can distinguish whitespace chars; special
// case for \0
char c = ((Character) val).charValue();
out.write("'");
// according to W3C spec
(http://www.w3.org/TR/xml-entity-names/000.html)
// no characters below 0x20 are allowed on document
// execpt tab, lf and cr
if (c <32)
out.write("0x" + Integer.toHexString((int)c));
else
out.write(StringEscapeUtils.escapeXml(val.toString()));
out.write("'");
break;
<openjpa-2.3.0-SNAPSHOT-runknown nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: Ungültiges XML-Zeichen
(Unicode: 0x1) wurde im Elementcontent des Dokuments gefunden.
at
org.apache.openjpa.xmlstore.XMLFileHandler.load(XMLFileHandler.java:93)
at org.apache.openjpa.xmlstore.XMLStore.getMap(XMLStore.java:80)
at org.apache.openjpa.xmlstore.XMLStore.getData(XMLStore.java:67)
at
org.apache.openjpa.xmlstore.XMLStoreManager.executeExtent(XMLStoreManager.java:262)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira