OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] SAXException, checked, buy why?

[ Lists Home | Date Index | Thread Index ]

* David Megginson <david.megginson@gmail.com> [2005-01-01 22:03]:
> On Sat, 1 Jan 2005 19:42:20 -0500, Alan Gutierrez
> <alan-xml-dev@engrm.com> wrote:
> 
> >     What was the thinking behind making SAXException a checked
> >     exception?
> 
> We talked about a few different strategies -- having all of the
> callbacks throw Exception, having SAXException extend
> RuntimeException, and having SAXException as a distinct base type.  
> No one less than James Gosling got in touch with me through an
> intermediary to argue against throwing Exception.  RuntimeException
> was generally felt not to be the Java way (after all, IOException is
> checked, and XML parsing is a kind of IO).
> 
> My single greatest regret about SAX, and one that I can never fix
> without breaking backwards compatibility, is not having SAXException
> extend IOException.  I originally wanted to, but was too easily talked
> out of it.

    I'm going to get rid of checked exceptions. It just occured to
    me why they don't make sense in the case of SAX.

    SAX is a observer pattern. The logic is defined as a bunch of
    callbacks. The contents of the callbacks are specific to the
    application implementing the call backs. The exception thrown is
    unlikely to be a SAXException, since SAX is so simple. It is
    either a parse exception or an application exception.

    Checked exceptions might make sense on the IO library, because
    the exception will originate from within the IO library, not
    beyond the IO library.

    In STAX, an iterator pattern, a checked STAXException, makes
    a lot more sense.

--
Alan Gutierrez - alan@engrm.com




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS