1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.verifier.exc;
18
19
20 /***
21 * Instances of this class are thrown by BCEL's class file verifier "JustIce"
22 * whenever
23 * verification proves that some constraint of a class file (as stated in the
24 * Java Virtual Machine Specification, Edition 2) is violated.
25 * This is roughly equivalent to the VerifyError the JVM-internal verifiers
26 * throw.
27 *
28 * @version $Id: VerifierConstraintViolatedException.java 386056 2006-03-15 11:31:56Z tcurdt $
29 * @author Enver Haase
30 */
31 public abstract class VerifierConstraintViolatedException extends RuntimeException{
32 /*** The name of the offending class that did not pass the verifier. */
33
34
35 /*** The specified error message. */
36 private String detailMessage;
37 /***
38 * Constructs a new VerifierConstraintViolatedException with null as its error message string.
39 */
40 VerifierConstraintViolatedException(){
41 super();
42 }
43 /***
44 * Constructs a new VerifierConstraintViolatedException with the specified error message.
45 */
46 VerifierConstraintViolatedException(String message){
47 super(message);
48 detailMessage = message;
49 }
50
51
52 /*** Extends the error message with a string before ("pre") and after ("post") the
53 'old' error message. All of these three strings are allowed to be null, and null
54 is always replaced by the empty string (""). In particular, after invoking this
55 method, the error message of this object can no longer be null.
56 */
57 public void extendMessage(String pre, String post){
58 if (pre == null) {
59 pre="";
60 }
61 if (detailMessage == null) {
62 detailMessage="";
63 }
64 if (post == null) {
65 post="";
66 }
67 detailMessage = pre+detailMessage+post;
68 }
69 /***
70 * Returns the error message string of this VerifierConstraintViolatedException object.
71 * @return the error message string of this VerifierConstraintViolatedException.
72 */
73 public String getMessage(){
74 return detailMessage;
75 }
76 }