[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: SAX2: Should SAXException extend IOException?

  • From: David Brownell <david-b@p...>
  • To: David Megginson <david@m...>
  • Date: Sun, 02 Jan 2000 14:33:17 -0800

ioexception derive
David Megginson wrote:
> 
> Rajiv Mordani <Rajiv.Mordani@e...> writes:
> 
> > java.util.zip.ZipException deriving from IOException is
> > appropriate. It is related to i/o so it makes sense to have that.

Also, the only place it's documented to be thrown is in a constructor
which also throws IOException.  I expect the documentation is missing
a fair number of uses though -- which often happens when an exception
inherits from another one.


> I'd be interested in a clear statement of the criteria for this
> distinction

I doubt you'll get such a clear statement.  Organizational politics
have come in, as well as sloppiness on the part of some developers.
That's not just at Sun; many organizations get that way for any
particular category of design decision you can identify.

I'll just say that questions get asked if an exception has strange
inheritance, which can permit it to masquerade as something it isn't,
and defining new categories of RuntimeException is really perceived
as undesirable.  Increasingly, those questions need good answers if
such exceptions are expected to become parts of public APIs.


>	 -- you get a ZipException, presumably, because of an error
> in the format of the zip file you're reading from;

Curious example.  java.util.zip.DataFormatException is what I'd
expect to get when faced with bad ZIP data.  (Recalling some of
the chaos involved in seeing JDK 1.1 get ZIP/JAR support, it's
no surprise that its exception architecture seems pretty odd.)

That's not an IOException.


>	 you get a
> SAXException because of an error in the format of the XML file you're
> reading from.

Looking at the JDK 1.2 javadocs, I also see these data format style
exceptions, which don't derive from IOException:

	java.security.certificate.CertificateEncodingException
	java.security.certificate.CertificateParsingException
	java.text.ParseException
	java.lang.NumberFormatException
	java.awt.image.RasterFormatException
	org.omg.CORBA. ... several ...

As with XML format errors, higher layers won't usually see those;
they get morphed by intermediate layers into diagnostics that are
more task-relevant.  (A few of those are RuntimeExceptions though.)

- Dave

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.