Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6308768

java.util.Properties.storeToXML() and loadFromXML() is not working for encoding type Cp875

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 1.4.0
    • Component/s: xml

      Description

      Test Scenario :
      Creating property XML file using java.util.Properties.storeToXML() method by passing an encoding type (say "Cp875") . At the time of retrieving the same XML file using java.util.Properties.loadFromXML() method, its throwing the exception.

      The same scenario works fine with encoding type "UTF-16" (and "UTF-8" too).

      Notes :
      1. Testcase is attached
      2. Thrown Exception :
      java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
              at java.util.XMLUtils.load(XMLUtils.java:59)
              at java.util.Properties.loadFromXML(Properties.java:753)
              at PropertiesWithOtherEncodings.storeAndLoadPropertyFile(PropertiesWithOtherEncodings.java:70)
              at PropertiesWithOtherEncodings.runTest(PropertiesWithOtherEncodings.java:28)
              at PropertiesWithOtherEncodings.main(PropertiesWithOtherEncodings.java:19)
      Caused by: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
              at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1419)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:927)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:664)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:524)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:844)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:774)
              at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
              at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:266)
              at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
              at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:85)
              at java.util.XMLUtils.load(XMLUtils.java:57)

        Attachments

          Activity

            People

            Assignee:
            sreddysunw Sunitha Reddy (Inactive)
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: