Thread: [Sax-devel] Nested exceptions in SAX
Brought to you by:
dmegginson
From: Norman W. <nd...@nw...> - 2006-02-23 14:52:33
|
The following bug has been reported against JAXP: SAXException can take a nested exception, but it doesn't implement the getCause method, so it doesn't participate in the exception nesting mechanism introduced in JDK 1.4. Because of this, when one prints out "e.printStackTrace()", it doesn't show exceptions nested inside SAXException. the proposed fix for this is simply to add public Throwable getCause() { return exception; } to org.xml.sax.SAXException. I don't believe that this introduces any compatibility problems (getCause() is already inherited from Throwable). That said, as the spec lead for JAXP, I'm very reluctant to introduce changes into the endorsed API no matter how small without community support. What say you? Be seeing you, norm =2D-=20 Norman Walsh <nd...@nw...> | A life, admirable at first sight, may http://nwalsh.com/ | have cost so much in imposed | liabilities, chores and self-abasement, | that, brilliant though it appears, it | cannot be considered other than a | failure. Another, which seems to have | misfired, is in reality a triumphant | success, because it has cost so | little.--Henry De Montherlant |
From: David M. <dav...@gm...> - 2006-02-23 15:02:42
|
On 23/02/06, Norman Walsh <nd...@nw...> wrote: > the proposed fix for this is simply to add > > public Throwable getCause() { > return exception; > } > > to org.xml.sax.SAXException. > > I don't believe that this introduces any compatibility problems > (getCause() is already inherited from Throwable). I have no objection to this change -- we can batch it up with any other minor fixes and put out a maintenance release. I have two questions for other SAX users: 1. Can you anticipate any problems this change might introduce? 2. Are there other similar, minor problems you'd like to see addressed in a maintenance release? All the best, David -- http://www.megginson.com/ |
From: Jochen W. <joc...@gm...> - 2006-02-23 18:23:33
|
On 2/23/06, David Megginson <dav...@gm...> wrote: > 2. Are there other similar, minor problems you'd like to see addressed > in a maintenance release? While you're at introducing the getCause() method: How about finally implementing the printStackTrace() methods and letting them print the cause as well, just as Throwable does? This has always been a source of problems to me, typically forcing me to compile my own version of the parser. Jochen -- Whenever you find yourself on the side of the majority, it is time to pause and reflect. (Mark Twain) |
From: Chris B. <d0...@hu...> - 2006-02-23 19:23:55
Attachments:
PGP.sig
|
David Megginson wrote: >> the proposed fix for this is simply to add >> >> public Throwable getCause() { >> return exception; >> } >> >> to org.xml.sax.SAXException. >> >> I don't believe that this introduces any compatibility problems >> (getCause() is already inherited from Throwable). > > I have no objection to this change -- we can batch it up with any > other minor fixes and put out a maintenance release. I have two > questions for other SAX users: > > 1. Can you anticipate any problems this change might introduce? It would silently break code that was using initCause but wasn't =20 using the constructor with exception, e.g. throw (SAXException) new SAXException(message).initCause=20 (originalException); because the exception set by the programmer will then be ignored. =20 This is an issue with other APIs developed prior to 1.4, =20 MessagingException and ServletException for instance. Unfortunately, =20 because of the initCause contract and the fact that the cause =20 exception is private, it is not possible simply to call initCause in =20 the constructor with exception, since a subsequent call to initCause =20 (which would have been successful prior to this) will then raise =20 IllegalStateException. > 2. Are there other similar, minor problems you'd like to see addressed > in a maintenance release? Now you come to mention it, there is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D23342 --=20 =E7=8A=AC Chris Burdess "They that can give up essential liberty to obtain a little safety deserve neither liberty nor safety." - Benjamin Franklin |
From: Michael G. <mrg...@ca...> - 2006-02-24 18:42:08
|
On 2/23/06, David Megginson <dav...@gm...> wrote: > 2. Are there other similar, minor problems you'd like to see addressed > in a maintenance release? There are at least a couple of bugs in Attributes2Impl [1][2][3] which are difficult to work around. It would be nice to see them fixed. [1] https://sourceforge.net/tracker/index.php?func=detail&aid=1207064&group_id=29449&atid=396219 [2] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6205431 [3] http://issues.apache.org/bugzilla/show_bug.cgi?id=38316 Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrg...@ca... E-mail: mrg...@ap... |
From: Jochen W. <joc...@gm...> - 2006-02-24 20:55:26
|
>> 2. Are there other similar, minor problems you'd like to see addressed >> in a maintenance release? Oh, and yet another one: How about DefaultHandler.getDocumentLocator()? |
From: Norman W. <nd...@nw...> - 2006-03-06 18:59:15
|
/ Norman Walsh <nd...@nw...> was heard to say: | What say you? Has this discussion bottomed-out? Is a new SAX likely? And in what time frame? Be seeing you, norm =2D-=20 Norman Walsh <nd...@nw...> | Everything should be made as simple as http://nwalsh.com/ | possible, but no simpler. |
From: David M. <dav...@gm...> - 2006-03-12 12:20:24
|
On 06/03/06, Norman Walsh <nd...@nw...> wrote: > Has this discussion bottomed-out? Is a new SAX likely? And in what > time frame? It's clear that this would not be a 100%-backwards-compatible change, but I think it's worth a tiny amount of breakage to bring SAX in line with modern Java. I've just posted an entry to my weblog (with a link to the archive of this discussion) to solicit opinions more widely.=20 If we go ahead, I'd expect a minor SAX release this spring. All the best, David -- http://www.megginson.com/ |