luehe       2004/06/25 12:05:05

  Modified:    jasper2/src/share/org/apache/jasper/compiler Validator.java
  Log:
  Reverted fix for Bugzilla 29763 ("The encoding of jsp document").
  
  We're supposed to throw an error only if there is an encoding declaration in the XML 
prolog that does not match the page encoding from the page directive or jsp-config. We 
must not throw any error if there is no XML prolog or encoding declaration in the 
prolog.
  
  The motivation for this is to make sure that JSP 1.2 pages with a page directive 
specifying a page encoding other than the default will continue to work in JSP 2.0 in 
most cases.
  
  The code is currently going through lots of pains to determine whether the encoding 
was specified in the XML prolog, or autodetected, to decide whether an error should be 
thrown.
  
  Revision  Changes    Path
  1.119     +4 -2      
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.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- Validator.java    24 Jun 2004 19:04:41 -0000      1.118
  +++ Validator.java    25 Jun 2004 19:05:05 -0000      1.119
  @@ -285,10 +285,12 @@
   
               /*
                * Compare the 'pageEncoding' attribute of the page directive with
  -             * the encoding specified in the XML prolog (only for XML syntax!).
  +             * the encoding specified in the XML prolog (only for XML syntax,
  +             * and only if JSP document contains XML prolog with encoding
  +             * declaration).
                * Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as identical.
                */
  -         if (root.isXmlSyntax()) {
  +         if (root.isXmlSyntax() && root.isEncodingSpecifiedInProlog()) {
                String pageEnc = root.getPageEncoding();
                   if (!pageDirEnc.equals(pageEnc) 
                           && (!pageDirEnc.startsWith("UTF-16")
  
  
  

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

Reply via email to