luehe       2003/01/27 15:15:34

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        ParserController.java Validator.java
  Log:
  Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as identical when comparing
  - the detected XML encoding of a JSP document
    (as per section 4.3.3 of the XML specification),
  - the encoding specified in the 'pageEncoding' attribute of the page
    directive of the JSP document, and
  - the encoding specified in a JSP configuration
    element whose URL pattern matches the document.
  
  This fixes JSP 2.0 TCK test "i18nXmlPageResponseEncodingTest".
  
  Revision  Changes    Path
  1.31      +5 -2      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java
  
  Index: ParserController.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ParserController.java     27 Jan 2003 18:10:47 -0000      1.30
  +++ ParserController.java     27 Jan 2003 23:15:33 -0000      1.31
  @@ -201,10 +201,13 @@
        if (isTopFile) {
            if (isXml) {
                // Make sure the encoding determined from the XML prolog
  -             // matches that in the JSP config element, if present
  +             // matches that in the JSP config element, if present.
  +             // Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as identical.
                String jspConfigPageEnc = pageInfo.getPageEncoding();
                if (jspConfigPageEnc != null
  -                     && !jspConfigPageEnc.equals(sourceEnc)) {
  +                     && !jspConfigPageEnc.equals(sourceEnc)
  +                     && (!jspConfigPageEnc.startsWith("UTF-16")
  +                         || !sourceEnc.startsWith("UTF-16"))) {
                    err.jspError("jsp.error.prolog_config_encoding_mismatch",
                                 sourceEnc, jspConfigPageEnc);
                }
  
  
  
  1.70      +9 -4      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java
  
  Index: Validator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- Validator.java    27 Jan 2003 18:10:47 -0000      1.69
  +++ Validator.java    27 Jan 2003 23:15:34 -0000      1.70
  @@ -257,13 +257,18 @@
                     * attribute of the page directive of the JSP page, and in
                     * a JSP configuration element (whose URL pattern matches
                     * the page).
  +                  *
                     * At this point, we've already verified (in 
                     * ParserController.parse()) that the page character
                     * encodings specified in a JSP config element and XML
                     * prolog match.
  +                  *
  +                  * Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as identical.
                     */
                    String compareEnc = pageInfo.getPageEncoding();
  -                 if (!value.equals(compareEnc)) {
  +                 if (!value.equals(compareEnc) 
  +                         && (!value.startsWith("UTF-16")
  +                             || !compareEnc.startsWith("UTF-16"))) {
                        if (pageInfo.isXml()) {
                            err.jspError(n,
                                         "jsp.error.prolog_pagedir_encoding_mismatch",
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to