Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2362

Conversion of data type CHAR and CHAR_OBJ to XML not valid for character values < 0x20

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.0
    • None
    • xml store
    • None
    • independent

    Description

      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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            bh928377 Benno Huber
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: