Hi Jeremias,

Jeremias Maerki wrote:
> That's actually one of the requirements, I just haven't discussed this
> explicitely on the Wiki page. I assumed everyone can throw any unchecked
> exception in the listener. Introducing a checked exception for this
> purpose would be horrible as it would go through all of FOP which I
> don't think would be useful. Does anyone see that differently?

No it’s ok to me if particular implementations of FopEventListener throw 
unchecked exceptions.

But that mentioning of exceptions just makes me wondering of the 
following: what if an unrecoverable error occurs (say, too many cells on 
a table row)? I guess I’ll trigger an event of severity 
EventSeverity.ERROR and I absolutely expect that /every/ listener will 
throw an exception in such a case? Otherwise the processing will become 
hazardous.


As to the best approach, the extended one looks good to me. May I ask 
you to keep Java 1.5 in mind when designing your classes? It’s not far 
away now and there are things which are likely to become much more 
elegant with genericity. Just to take your example on the wiki page:
    in EventBroadcaster:
    public <T extends EventProducer> T getEventProducerFor(Class<T> class)

    then I can make
    BasicFOValidationEventProducer producer =
      getUserAgent().getEventBroadcaster().getEventProducerFor(
         BasicFOValidationEventProducer.class);
Exit the hazardous cast and potential run-time exception :-)

Vincent


> On 24.01.2008 16:33:23 Max Berger wrote:
>> Jeremias,
>>
>> on the message consumer side it would be nice if message handlers could
>> throw exceptions - this would allow "strict" handlers to immediately
>> cancel processing of a fo file, a more lenient handlers could just emit
>> warnings (similar to sax handlers), and a batch system could ignore it.
>>
>> However, this would require every function which uses logging to throw a
>> common exception (FopFeedbackException, or something like that).
>>
>> Max
<snip/>

-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Reply via email to