jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1500124 - in /jmeter/trunk: ./ res/maven/ src/components/org/apache/jmeter/assertions/gui/ src/core/org/apache/jmeter/testbeans/gui/ src/protocol/java/org/apache/jmeter/protocol/java/control/gui/ xdocs/
Date Sat, 06 Jul 2013 09:12:14 GMT
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 <philippe.mouawad@gmail.com> wrote:
> you need to add a throws in one method, it is in the build output
>

Mime
View raw message