diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2009-06-09 08:50:06 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2009-06-09 08:50:06 +0000 |
commit | ebd545653c4c1d36009db5e6616afede3b65f1c2 (patch) | |
tree | 13dca0fc74a20110244536c1ee661f3e99397c15 /src/main/javassist/expr | |
parent | 29bf701b71069139ccf59868ebcb7352b9f8049f (diff) | |
download | javassist-ebd545653c4c1d36009db5e6616afede3b65f1c2.tar.gz javassist-ebd545653c4c1d36009db5e6616afede3b65f1c2.zip |
fixed JIRA JASSIST-83
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@479 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/expr')
-rw-r--r-- | src/main/javassist/expr/Handler.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main/javassist/expr/Handler.java b/src/main/javassist/expr/Handler.java index 6f8c44cf..5bed0924 100644 --- a/src/main/javassist/expr/Handler.java +++ b/src/main/javassist/expr/Handler.java @@ -20,7 +20,7 @@ import javassist.bytecode.*; import javassist.compiler.*; /** - * Catch clause. + * A <code>catch</code> clause or a <code>finally</code> block. */ public class Handler extends Expr { private static String EXCEPTION_NAME = "$1"; @@ -69,11 +69,24 @@ public class Handler extends Expr { /** * Returns the type handled by the catch clause. + * If this is a <code>finally</code> block, <code>null</code> is returned. */ public CtClass getType() throws NotFoundException { - ConstPool cp = getConstPool(); - String name = cp.getClassInfo(etable.catchType(index)); - return thisClass.getClassPool().getCtClass(name); + int type = etable.catchType(index); + if (type == 0) + return null; + else { + ConstPool cp = getConstPool(); + String name = cp.getClassInfo(type); + return thisClass.getClassPool().getCtClass(name); + } + } + + /** + * Returns true if this is a <code>finally</code> block. + */ + public boolean isFinally() { + return etable.catchType(index) == 0; } /** |