KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > InvalidBytecodeException


1 /*
2  * Bytecode Analysis Framework
3  * Copyright (C) 2005, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 JavaDoc {
35     private static final long serialVersionUID = 1L;
36     
37     /**
38      * Constructor.
39      *
40      * @param msg reason for the exception
41      */

42     public InvalidBytecodeException(String JavaDoc 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 JavaDoc msg, Throwable JavaDoc 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 JavaDoc message, MethodGen methodGen, InstructionHandle handle) {
64         super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle);
65     }
66
67     /**
68      * Constructor from method and instruction.
69      *
70      * @param message reason for the error
71      * @param methodGen the method
72      * @param handle the instruction
73      * @param cause another exception that is the cause of this exception
74      */

75     public InvalidBytecodeException(
76             String JavaDoc message,
77             MethodGen methodGen,
78             InstructionHandle handle,
79             Throwable JavaDoc cause) {
80         super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle,
81                 cause);
82     }
83 }
84
Popular Tags