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

string include single quote etc for messagformat will get error result

XMLWordPrintable

    • b14
    • generic, x86
    • generic, windows_2000

      A example which lead to this error is file XPATHErrorResource_<local>.java under org/apache/xpath/res and XSLTErrorResource_<local>.java under org/apache/xalan/res especially in european locale such as fr and it etc.

      For example, in XSLTErrorResource_it.java line 2017 for ER_ATTR_NOT_ALLOWED=209, which message looks like:

        /** attribute is not allowed on the element */
        public static final int ER_ATTR_NOT_ALLOWED = 209;

        static
        {
          contents[ER_ATTR_NOT_ALLOWED][1] =
              "\"{0}\": questo attributo non \u00e8 consentito sull'elemento {1}.";
        }

      between "sull" and "elemento" there have a single quote, which will lead to the error result(the final message miss that character)

      reproduce by fellow:
      1.get the attachment file 2.xsl
      2.run "java org.apache.xalan.xslt.Process -XSL 2.xsl
      3.will see the error result on the console which is the 209 error message and miss the single quote.

      The reason is descripted in fellow url:
      http://java.sun.com/j2se/1.4/docs/api/java/text/MessageFormat.html

      should use double single quote "''" represents a single quote.

            duke J. Duke
            lefan Leon Fan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: