You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2003/10/10 14:06:22 UTC

cvs commit: cocoon-2.1/src/blocks/html/java/org/apache/cocoon/generation HTMLGenerator.java

bruno       2003/10/10 05:06:22

  Modified:    .        status.xml
               src/blocks/html/java/org/apache/cocoon/generation
                        HTMLGenerator.java
  Log:
  Fixed NullPointerException in HTMLGenerator in case the parsed HTML file contained an XML declaration. (bugzilla 23648)
  
  Revision  Changes    Path
  1.173     +4 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.172
  retrieving revision 1.173
  diff -u -r1.172 -r1.173
  --- status.xml	9 Oct 2003 12:01:07 -0000	1.172
  +++ status.xml	10 Oct 2003 12:06:22 -0000	1.173
  @@ -192,6 +192,9 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +   <action dev="BRD" type="fix" fixes-bug="23648" due-to="Alfred Fuchs" due-to-email="email@alfred-fuchs.de">
  +     HTMLGenerator: fixed NullPointerException in case the "HTML" file contained an XML declaration.
  +   </action>
      <action dev="UC" type="fix">
       Fixed ResolverImplTestCase so that the "test" build target does not fail (it still depends on the
       deprecated block, though).
  
  
  
  1.9       +7 -2      cocoon-2.1/src/blocks/html/java/org/apache/cocoon/generation/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/html/java/org/apache/cocoon/generation/HTMLGenerator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- HTMLGenerator.java	4 Sep 2003 09:38:39 -0000	1.8
  +++ HTMLGenerator.java	10 Oct 2003 12:06:22 -0000	1.9
  @@ -330,7 +330,12 @@
                   contentHandler.endDocument();
               } else {
                   DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
  -                streamer.stream(doc);
  +                // If the HTML document contained a <?xml ... declaration, tidy would have recognized
  +                // this as a processing instruction (with a 'null' target), giving problems further
  +                // on in the pipeline. Therefore we only serialize the document element.
  +                this.contentHandler.startDocument();
  +                streamer.stream(doc.getDocumentElement());
  +                this.contentHandler.endDocument();
               }
           } catch (IOException e){
               throw new ResourceNotFoundException("Could not get resource "