diff options
author | aclement <aclement> | 2005-10-14 08:39:32 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-10-14 08:39:32 +0000 |
commit | 999d9b0c88d4cae8f94025a09641343714cf5d83 (patch) | |
tree | 2b2fe8e6cdbabc00db0cbf5db79996daa84d9966 /bcel-builder/src | |
parent | bddd3ad903c3e4ecf20272def9af2c979035a2dd (diff) | |
download | aspectj-999d9b0c88d4cae8f94025a09641343714cf5d83.tar.gz aspectj-999d9b0c88d4cae8f94025a09641343714cf5d83.zip |
pr112514: better diagnostics when class format exception occurs.
Diffstat (limited to 'bcel-builder/src')
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java index e2508a00d..ae7f8c92e 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java @@ -70,7 +70,7 @@ import java.util.zip.*; * JVM specification 1.0</a>. See this paper for * further details about the structure of a bytecode file. * - * @version $Id: ClassParser.java,v 1.3 2005/09/14 11:10:57 aclement Exp $ + * @version $Id: ClassParser.java,v 1.4 2005/10/14 08:39:32 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> */ public final class ClassParser { @@ -252,7 +252,16 @@ public final class ClassParser { */ private final void readConstantPool() throws IOException, ClassFormatException { - constant_pool = new ConstantPool(file); + try { + constant_pool = new ConstantPool(file); + } catch (ClassFormatException cfe) { + // add some context if we can + if (file_name!=null) { + String newmessage = "File: '"+file_name+"': "+cfe.getMessage(); + throw new ClassFormatException(newmessage); // this loses the old stack trace but I dont think that matters! + } + throw cfe; + } } /** |