bodewig 2004/11/16 00:37:41 Modified: src/main/org/apache/tools/zip ZipEntry.java Log: Try to provide more information on an exception occuring in Kaffe Revision Changes Path 1.18 +26 -6 ant/src/main/org/apache/tools/zip/ZipEntry.java Index: ZipEntry.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipEntry.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ZipEntry.java 10 Nov 2004 00:37:31 -0000 1.17 +++ ZipEntry.java 16 Nov 2004 08:37:41 -0000 1.18 @@ -426,13 +426,17 @@ setCompressedSizeMethod.invoke(ze, (Object[])s); } catch (InvocationTargetException ite) { Throwable nested = ite.getTargetException(); + String msg = getDisplayableMessage(nested); + if (msg == null) { + msg = getDisplayableMessage(ite); + } + throw new RuntimeException("InvocationTargetException setting the " + + "compressed size of " + ze + ": " + + msg); + } catch (Exception other) { throw new RuntimeException("Exception setting the compressed size " + "of " + ze + ": " - + nested.getMessage()); - } catch (Throwable other) { - throw new RuntimeException("Exception setting the compressed size " - + "of " + ze + ": " - + other.getMessage()); + + getDisplayableMessage(other)); } } @@ -453,6 +457,22 @@ } } } + } + + /** + * try to get as much single-line information out of the exception + * as possible. + */ + private static String getDisplayableMessage(Throwable e) { + String msg = null; + if (e != null) { + if (e.getMessage() != null) { + msg = e.getClass().getName() + ": " + e.getMessage(); + } else { + msg = e.getClass().getName(); + } + } + return msg; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]