An alternative is to replace
    return super.resolveEntity(publicId, systemId);
with
    return null;
as that is what the super method is documented to always do.

The problem arises from a bug in
org.xml.sax.helpers.DefaultHandler#resolveEntity.
It implements EntityResolver (which throws IOE), but the method does
not throw IOException in Java 1.4
This was fixed in Java 1.5.

The compiler allows one to drop throws clauses from sub classes, but
not add them.
I don't know why it does not warn about unimplemented throws; that
would help catch such issues.

As an aside, I think the code could be fixed by the author to allow
compiling on both.
For example by wrapping IOE in SaxException, and returning null.

Something like (not tested):

                public InputSource resolveEntity(String publicId, String 
systemId)
                                                                throws 
SAXException {
                        if (entityResolver!=null) {
                                try {
                                        return 
entityResolver.resolveEntity(publicId, systemId);
                                } catch (IOException ioe) {
                                    throw new SaxException(ioe);
                                }
                        }
                        return null; // This is the documented behaviour of:
super.resolveEntity(publicId, systemId);
                }

On 6 July 2013 09:38, Philippe Mouawad <[email protected]> wrote:
> you need to add a throws in one method, it is in the build output
>

Reply via email to