01: /*
02: * Bytecode Analysis Framework
03: * Copyright (C) 2005, University of Maryland
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19: package edu.umd.cs.findbugs.ba;
20:
21: import org.apache.bcel.generic.InstructionHandle;
22: import org.apache.bcel.generic.MethodGen;
23:
24: /**
25: * An exception that may be thrown by frame modeling visitor
26: * classes to indicate that the method being analyzed contains
27: * invalid bytecode. For example, this can be thrown to indicate
28: * that a method invocation requires more stack operands than
29: * are available. AbstractFrameModelingVisitor will catch
30: * this exception and rethrow it as a checked DataflowAnalysisException.
31: *
32: * @author David Hovemeyer
33: */
34: public class InvalidBytecodeException extends RuntimeException {
35: private static final long serialVersionUID = 1L;
36:
37: /**
38: * Constructor.
39: *
40: * @param msg reason for the exception
41: */
42: public InvalidBytecodeException(String msg) {
43: super (msg);
44: }
45:
46: /**
47: * Constructor.
48: *
49: * @param msg reason for the exception
50: * @param cause another exception that is the cause of this exception
51: */
52: public InvalidBytecodeException(String msg, Throwable cause) {
53: super (msg, cause);
54: }
55:
56: /**
57: * Constructor from method and instruction.
58: *
59: * @param message reason for the error
60: * @param methodGen the method
61: * @param handle the instruction
62: */
63: public InvalidBytecodeException(String message,
64: MethodGen methodGen, InstructionHandle handle) {
65: super (message + " in "
66: + SignatureConverter.convertMethodSignature(methodGen)
67: + " at " + handle);
68: }
69:
70: /**
71: * Constructor from method and instruction.
72: *
73: * @param message reason for the error
74: * @param methodGen the method
75: * @param handle the instruction
76: * @param cause another exception that is the cause of this exception
77: */
78: public InvalidBytecodeException(String message,
79: MethodGen methodGen, InstructionHandle handle,
80: Throwable cause) {
81: super (message + " in "
82: + SignatureConverter.convertMethodSignature(methodGen)
83: + " at " + handle, cause);
84: }
85: }
|