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 should never be thrown. When such an instance is thrown,
22 * this is due to an INTERNAL ERROR of BCEL's class file verifier "JustIce".
23 *
24 * @version $Id: AssertionViolatedException.java 386056 2006-03-15 11:31:56Z tcurdt $
25 * @author Enver Haase
26 */
27 public final class AssertionViolatedException extends RuntimeException{
28 /*** The error message. */
29 private String detailMessage;
30 /*** Constructs a new AssertionViolatedException with null as its error message string. */
31 public AssertionViolatedException(){
32 super();
33 }
34 /***
35 * Constructs a new AssertionViolatedException with the specified error message preceded
36 * by "INTERNAL ERROR: ".
37 */
38 public AssertionViolatedException(String message){
39 super(message = "INTERNAL ERROR: "+message);
40 detailMessage=message;
41 }
42 /*** Extends the error message with a string before ("pre") and after ("post") the
43 'old' error message. All of these three strings are allowed to be null, and null
44 is always replaced by the empty string (""). In particular, after invoking this
45 method, the error message of this object can no longer be null.
46 */
47 public void extendMessage(String pre, String post){
48 if (pre == null) {
49 pre="";
50 }
51 if (detailMessage == null) {
52 detailMessage="";
53 }
54 if (post == null) {
55 post="";
56 }
57 detailMessage = pre+detailMessage+post;
58 }
59 /***
60 * Returns the error message string of this AssertionViolatedException object.
61 * @return the error message string of this AssertionViolatedException.
62 */
63 public String getMessage(){
64 return detailMessage;
65 }
66
67 /***
68 * DO NOT USE. It's for experimental testing during development only.
69 */
70 public static void main(String[] args){
71 AssertionViolatedException ave = new AssertionViolatedException("Oops!");
72 ave.extendMessage("\nFOUND:\n\t","\nExiting!!\n");
73 throw ave;
74 }
75
76 }