cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: AbstractXMLProducer patch consequences
Date Sat, 20 Mar 2004 15:23:26 GMT
On 20.03.2004 01:31, Vadim Gritsenko wrote:

>>>   Modified:    src/java/org/apache/cocoon/xml AbstractXMLProducer.java
>>>   Log:
>>>   fixed bug 27678, thanks to Peter Brant: setConsumer() calls 
>>> setContentHandler() + setLexicalHandler()
>>
>>>        public void setConsumer(XMLConsumer consumer) {
>>>            this.xmlConsumer = consumer;
>>>   -        this.contentHandler = consumer;
>>>   -        this.lexicalHandler = consumer;
>>>   +        setContentHandler(consumer);
>>>   +        setLexicalHandler(consumer);
>>>        }
>>
>>
>>
>> Unfortunately this change breaks XSP. I debugged a bit into to see 
>> what happens. The reason is in CocoonMarkupLanguage.PreProcessFilter:

...

>> From an object oriented polymorphism POV this looks really hacky. 
>> Something like "because we have to provide an implementation for 
>> others in a different way, lets use the super implementation that 
>> provides the correct implementation for us".
>>
>> If the changed/patched AbstractXMLProducer is in use, 
>> setContentHandler() and setLexicalHandler() are called with 
>> this.filter as parameter and the code generation fails. If the 
>> implementation of both methods is removed, you can not set the 
>> handlers of the filter.
>>
>> Of course we can just revert the patch, but the above is still what I 
>> would call hacky.
>>
>> WDYT?
> 
> Option 1: Do not call super.setConsumer() above, use
> super.setContent/LexicalHandler.

Chose this one. Though it does not solve my feelings above. Must this be 
by design? Couldn't this.filter in PreProcessFilter given to 
LogicsheetCodeGenerator so that it can call setConsumer() on this object 
directly? Or does this break other parts of the design. I found it 
really confusing ...

> And question, are there more places like this?

I don't hope so.

> PS I use a bit of XSP; JXTG currently does not yet offer everything you 
> need...

I don't want to remove XSP in near future ;)

Joerg

Mime
View raw message