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


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: SAX2: Should SAXException extend IOException?

[ Lists Home | Date Index | Thread Index ]
  • From: David Brownell <david-b@pacbell.net>
  • To: David Megginson <david@megginson.com>
  • Date: Sun, 02 Jan 2000 14:33:17 -0800

David Megginson wrote:
> Rajiv Mordani <Rajiv.Mordani@eng.sun.com> 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:

	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@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


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

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