KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Bytecode Analysis Framework
3  * Copyright (C) 2003,2004 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
20 package edu.umd.cs.findbugs.ba;
21
22 import org.apache.bcel.generic.Instruction;
23 import org.apache.bcel.generic.InstructionHandle;
24 import org.apache.bcel.generic.MethodGen;
25
26 /**
27  * A kind of runtime exception that can be thrown to indicate
28  * a fatal error in an analysis. It would be nice to make this a
29  * checked exception, but we can't throw those from BCEL visitors.
30  */

31 public class AnalysisException extends RuntimeException JavaDoc {
32     /**
33      *
34      */

35     private static final long serialVersionUID = 1L;
36
37     /**
38      * Constructor.
39      *
40      * @param message reason for the error
41      */

42     public AnalysisException(String JavaDoc message) {
43         super(message);
44     }
45
46     /**
47      * Constructor from another Throwable object.
48      * This is useful for chaining exceptions.
49      *
50      * @param message reason for the error
51      * @param throwable cause of the error
52      */

53     public AnalysisException(String JavaDoc message, Throwable JavaDoc throwable) {
54         super(message, throwable);
55     }
56
57     /**
58      * Constructor from MethodGen and another Throwable object.
59      * This is useful for chaining exceptions.
60      *
61      * @param message reason for the error
62      * @param methodGen the method
63      * @param throwable cause of the error
64      */

65     public AnalysisException(String JavaDoc message, MethodGen methodGen, Throwable JavaDoc throwable) {
66         super(message + " in " + SignatureConverter.convertMethodSignature(methodGen), throwable);
67     }
68
69     /**
70      * Constructor from method and instruction.
71      *
72      * @param message reason for the error
73      * @param methodGen the method
74      * @param handle the instruction
75      */

76     public AnalysisException(String JavaDoc message, MethodGen methodGen, InstructionHandle handle) {
77         super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle);
78     }
79
80     /**
81      * Constructor from method and instruction.
82      *
83      * @param message reason for the error
84      * @param methodGen the method
85      * @param ins the instruction
86      */

87     public AnalysisException(String JavaDoc message, MethodGen methodGen, Instruction ins) {
88         super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + ins);
89     }
90
91     /**
92      * Constructor from method, instruction, and causing Throwable object.
93      *
94      * @param message reason for the error
95      * @param methodGen the method
96      * @param handle the instruction
97      * @param throwable the cause of the error
98      */

99     public AnalysisException(String JavaDoc message, MethodGen methodGen, InstructionHandle handle,
100                              Throwable JavaDoc throwable) {
101         super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle, throwable);
102     }
103
104     /**
105      * Constructor from method, instruction, and causing Throwable object.
106      *
107      * @param message reason for the error
108      * @param methodGen the method
109      * @param ins the instruction
110      * @param throwable the cause of the error
111      */

112     public AnalysisException(String JavaDoc message, MethodGen methodGen, Instruction ins,
113                              Throwable JavaDoc throwable) {
114         super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + ins, throwable);
115     }
116 }
117
118 // vim:ts=4
119
Popular Tags