gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Recent Gump Error and DefaultHandler
Date Wed, 15 Dec 2004 11:24:03 GMT
Hi all,

the last log4j run failed because of

    [javac] /home/gump/workspaces2/public/workspace/logging-log4j/src/java/org/apache/log4j/joran/util/JoranDocument.java:126:
unreported exception java.io.IOException; must be caught or declared to be thrown
    [javac]     return super.resolveEntity(publicId, systemId);
    [javac]                               ^
    [javac] 1 error
    [javac] 5 warnings

and in fact, DefaultHandler throws IOException in JDK 1.5 as well as
the xml-apis.jar produced by xml-commons.  The version that ships with
JDK 1.4 does not throw IOException, even though it is listed in the
@throws part of the javadocs (at least in my copy).

I think DefaultHandler has been modified in SAX 2.0.1 to throw the
exception which has always been part of the EntityResolver interface.

Now to this case.  Log4J should probably deal with the IOException
case for forwards compatibility reasons, but at the same time adding a
simple throws IOException won't compile on JDK 1.4.

You best bet most probably is to do something like

  public InputSource resolveEntity(...) {
    ...
    try {
      return super.resolveEntity(publicId, systemId);
    } catch (Throwable e) {
      if (e instanceof IOException) {
        // legal after JDK 1.4, wrap it into a SAXException
        throw new SAXExcpetion(e);
      } else {
        throw e;
      }
    }
  }

Any other ideas?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message