1 18 package org.apache.batik.xml; 19 20 32 public class XMLException extends RuntimeException { 33 34 37 protected Exception exception; 38 39 43 public XMLException (String message) { 44 super(message); 45 exception = null; 46 } 47 48 56 public XMLException (Exception e) { 57 exception = e; 58 } 59 60 68 public XMLException (String message, Exception e) { 69 super(message); 70 exception = e; 71 } 72 73 81 public String getMessage () { 82 String message = super.getMessage(); 83 84 if (message == null && exception != null) { 85 return exception.getMessage(); 86 } else { 87 return message; 88 } 89 } 90 91 95 public Exception getException () { 96 return exception; 97 } 98 99 103 public void printStackTrace() { 104 if (exception == null) { 105 super.printStackTrace(); 106 } else { 107 synchronized (System.err) { 108 System.err.println(this); 109 super.printStackTrace(); 110 } 111 } 112 } 113 114 120 public void printStackTrace(java.io.PrintStream s) { 121 if (exception == null) { 122 super.printStackTrace(s); 123 } else { 124 synchronized (s) { 125 s.println(this); 126 super.printStackTrace(); 127 } 128 } 129 } 130 131 137 public void printStackTrace(java.io.PrintWriter s) { 138 if (exception == null) { 139 super.printStackTrace(s); 140 } else { 141 synchronized (s) { 142 s.println(this); 143 super.printStackTrace(s); 144 } 145 } 146 } 147 } 148 | Popular Tags |