You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2004/03/15 19:37:35 UTC

DO NOT REPLY [Bug 27678] New: - AbstractXMLProducer.setConsumer implementation is incorrect

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27678

AbstractXMLProducer.setConsumer implementation is incorrect

           Summary: AbstractXMLProducer.setConsumer implementation is
                    incorrect
           Product: Cocoon 2
           Version: Current CVS 2.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: core
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: peter.brant@courts.state.wi.us


The implementation of org.apache.cocoon.xml.AbstractXMLProducer.setConsumer does
not match its Javadoc.  Patch is below.  

Current workaround is to include implementation specified in Javadoc in subclass.

Index: AbstractXMLProducer.java
===================================================================
RCS file:
/home/cvspublic/cocoon-2.1/src/java/org/apache/cocoon/xml/AbstractXMLProducer.java,v
retrieving revision 1.1
diff -u -r1.1 AbstractXMLProducer.java
--- AbstractXMLProducer.java	9 Mar 2003 00:09:45 -0000	1.1
+++ AbstractXMLProducer.java	15 Mar 2004 18:24:27 -0000
@@ -84,8 +84,8 @@
      */
     public void setConsumer(XMLConsumer consumer) {
         this.xmlConsumer = consumer;
-        this.contentHandler = consumer;
-        this.lexicalHandler = consumer;
+        setContentHandler(consumer);
+        setLexicalHandler(consumer);
     }
 
     /**

Re: DO NOT REPLY [Bug 27678] New: - AbstractXMLProducer.setConsumer implementation is incorrect

Posted by Joerg Heinicke <jo...@gmx.de>.
On 17.03.2004 02:09, Vadim Gritsenko wrote:

>>> -        this.contentHandler = consumer;
>>> -        this.lexicalHandler = consumer;
>>> +        setContentHandler(consumer);
>>> +        setLexicalHandler(consumer);
>>
>> This can make indeed a difference when subclassing 
>> AbstractXMLProducer, but the question is if it's useful usable. Shall 
>> we apply it? I guess we can break someone's code who implemented the 
>> both functions incorrectly, but never called them himself, but I don't 
>> fear this.
> 
> Will it break AbstractTextSerializer?

No AFAICS.

> It should be fixed or changed then 
> too - currently it overrides all three methods (and calls super). May be 
> we simply need to change javadoc?

For avoiding code duplication - even if it is the simplest one here - 
the patch would be good. If either setContentHandler() or 
setLexicalHandler() are changed setConsumer() would profit from this 
change too.

Joerg

Re: DO NOT REPLY [Bug 27678] New: - AbstractXMLProducer.setConsumer implementation is incorrect

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Joerg Heinicke wrote:

> On 15.03.2004 19:37, bugzilla@apache.org wrote:
>
>> http://issues.apache.org/bugzilla/show_bug.cgi?id=27678
>>
>> AbstractXMLProducer.setConsumer implementation is incorrect
>>
>> The implementation of 
>> org.apache.cocoon.xml.AbstractXMLProducer.setConsumer does
>> not match its Javadoc.  Patch is below. 
>> Current workaround is to include implementation specified in Javadoc 
>> in subclass.
>>
>> -        this.contentHandler = consumer;
>> -        this.lexicalHandler = consumer;
>> +        setContentHandler(consumer);
>> +        setLexicalHandler(consumer);
>
>
> This can make indeed a difference when subclassing 
> AbstractXMLProducer, but the question is if it's useful usable. Shall 
> we apply it? I guess we can break someone's code who implemented the 
> both functions incorrectly, but never called them himself, but I don't 
> fear this.


Will it break AbstractTextSerializer? It should be fixed or changed then 
too - currently it overrides all three methods (and calls super). May be 
we simply need to change javadoc?

Vadim



Re: DO NOT REPLY [Bug 27678] New: - AbstractXMLProducer.setConsumer implementation is incorrect

Posted by Joerg Heinicke <jo...@gmx.de>.
On 15.03.2004 19:37, bugzilla@apache.org wrote:

> http://issues.apache.org/bugzilla/show_bug.cgi?id=27678
> 
> AbstractXMLProducer.setConsumer implementation is incorrect
> 
> The implementation of org.apache.cocoon.xml.AbstractXMLProducer.setConsumer does
> not match its Javadoc.  Patch is below.  
> 
> Current workaround is to include implementation specified in Javadoc in subclass.
> 
> -        this.contentHandler = consumer;
> -        this.lexicalHandler = consumer;
> +        setContentHandler(consumer);
> +        setLexicalHandler(consumer);

This can make indeed a difference when subclassing AbstractXMLProducer, 
but the question is if it's useful usable. Shall we apply it? I guess we 
can break someone's code who implemented the both functions incorrectly, 
but never called them himself, but I don't fear this.

Joerg