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

Error messages in JAXP resource files (*.properties) truncated in the build process

    XMLWordPrintable

Details

    • 7
    • generic
    • generic

    Description

      FULL PRODUCT VERSION :
      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

      (Have also visually inspected corresponding file on 7u55 and 8u5)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]
      (Don't believe to be OS specific)

      A DESCRIPTION OF THE PROBLEM :
      The message definition for InvalidCharRef in com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties has been corrupted. In Java 7 and 8 it is defined as

      InvalidCharRef = Character reference \"&#

      while in Java 6 is was

      InvalidCharRef=Character reference "&\#{0}" is an invalid XML character.

      This makes the error less useful in Java 7 and 8.

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.6.0_45"
      Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
      Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See executable test case.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      [Fatal Error] :1:12: Character reference "&#x1" is an invalid XML character.
      Exception in thread "main" org.xml.sax.SAXParseException: Character reference "&#x1" is an invalid XML character.
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
      at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
      at XMLTest.main(XMLTest.java:10)


      (witnessed in Java 6u45)
      ACTUAL -
      [Fatal Error] :1:12: Character reference "&#
      Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 12; Character reference "&#
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
      at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
      at XMLTest.main(XMLTest.java:10)


      (witnessed in Java 7u51 and appears to be the case from inspecting the properties file in 7u55 and 8u5).

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.xml.parsers.DocumentBuilderFactory;
      import java.io.ByteArrayInputStream;
      public class XMLTest {
          public static void main(String []args) throws Exception{
              DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream("<test>&#x1;</test>".getBytes()));
          }
      }


      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: