1 3 56 57 package org.jboss.util.xml.catalog; 58 59 72 public class CatalogException extends Exception { 73 74 public static final int WRAPPER = 1; 75 76 public static final int INVALID_ENTRY = 2; 77 78 public static final int INVALID_ENTRY_TYPE = 3; 79 80 public static final int NO_XML_PARSER = 4; 81 82 public static final int UNKNOWN_FORMAT = 5; 83 84 public static final int UNPARSEABLE = 6; 85 86 public static final int PARSE_FAILED = 7; 87 88 91 private Exception exception = null; 92 private int exceptionType = 0; 93 94 100 public CatalogException (int type, String message) { 101 super(message); 102 this.exceptionType = type; 103 this.exception = null; 104 } 105 106 111 public CatalogException (int type) { 112 super("Catalog Exception " + type); 113 this.exceptionType = type; 114 this.exception = null; 115 } 116 117 126 public CatalogException (Exception e) { 127 super(); 128 this.exceptionType = WRAPPER; 129 this.exception = e; 130 } 131 132 141 public CatalogException (String message, Exception e) { 142 super(message); 143 this.exceptionType = WRAPPER; 144 this.exception = e; 145 } 146 147 156 public String getMessage () 157 { 158 String message = super.getMessage(); 159 160 if (message == null && exception != null) { 161 return exception.getMessage(); 162 } else { 163 return message; 164 } 165 } 166 167 172 public Exception getException () 173 { 174 return exception; 175 } 176 177 182 public int getExceptionType () 183 { 184 return exceptionType; 185 } 186 187 192 public String toString () 193 { 194 if (exception != null) { 195 return exception.toString(); 196 } else { 197 return super.toString(); 198 } 199 } 200 } 201 | Popular Tags |