Re: SAX2r3 bug: NamespaceSupport.declarePrefix() does not throw exception
Norman Walsh <[email protected]> Thu, 22 Apr 2004 17:00:10 -0400
| Newsgroups | gmane.text.xml.sax.devel |
|---|---|
| Message-ID | <[email protected]> |
/ David Megginson <[email protected]> was heard to say: | Norman Walsh wrote: | |> / David Megginson <[email protected]> was heard to say: |> | I'd appreciate it if anyone interested could look over the prerelease of SAX2r3: |> | |> | http://sourceforge.net/project/showfiles.php?group_id=29449 |> The method |> org.xml.sax.helpers.NamespaceSupport.declarePrefix() |> needs a patch to throw IllegalStateException in cases when a prefix |> is |> declared after looking up a name in the current Namespace context, or |> after pushing another context on top of it. The method should throw |> the exception according to the javadoc. | | Would it be possible to send a patch (or a changed file)? Yes, but this is a little embarrassing. What the heck... After some further conversations with some of the folks who track backwards compatibility issues, it turns out that the patch I'd like to propose is this one. *** /usr/local/java/sax2-r3pre/org/xml/sax/helpers/NamespaceSupport.javaThu Apr 22 10:31:52 2004 --- /tmp/NamespaceSupport.java Thu Apr 22 16:56:46 2004 *************** *** 286,292 **** * @param uri The Namespace URI to associate with the prefix. * @return true if the prefix was legal, false otherwise - * @exception IllegalStateException when a prefix is declared - * after looking up a name in the context, or after pushing - * another context on top of it. * * @see #processName --- 286,289 ---- It turns out there's some existing code that relies on the fact that this exception isn't thrown. So while I prefer to do the right thing, there's a school of thought that says breaking existing code isn't the right thing. Especially if you're trying to get things past the folks that test for compatibility. Given that the user can, if they care, test the result, I'd like to suggest the patch above :-) That is, to remove the JavaDoc that says the exception is thrown since historically it has never actually been thrown. Be seeing you, norm -- Norman Walsh <[email protected]> | http://nwalsh.com/ |
signature.asc
(application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBAiDJbOyltUcwYWjsRAgKwAJ94U3ojtZWWbL8Y56neovdBOJDvbQCcCPra 6A4vRAiC1ZNg6hlbrjwbKq4= =v6Jx -----END PGP SIGNATURE-----