1 3 19 20 package com.sun.org.apache.xml.internal.resolver; 21 22 35 public class CatalogException extends Exception { 36 37 public static final int WRAPPER = 1; 38 39 public static final int INVALID_ENTRY = 2; 40 41 public static final int INVALID_ENTRY_TYPE = 3; 42 43 public static final int NO_XML_PARSER = 4; 44 45 public static final int UNKNOWN_FORMAT = 5; 46 47 public static final int UNPARSEABLE = 6; 48 49 public static final int PARSE_FAILED = 7; 50 51 public static final int UNENDED_COMMENT = 8; 52 53 56 private Exception exception = null; 57 private int exceptionType = 0; 58 59 65 public CatalogException (int type, String message) { 66 super(message); 67 this.exceptionType = type; 68 this.exception = null; 69 } 70 71 76 public CatalogException (int type) { 77 super("Catalog Exception " + type); 78 this.exceptionType = type; 79 this.exception = null; 80 } 81 82 91 public CatalogException (Exception e) { 92 super(); 93 this.exceptionType = WRAPPER; 94 this.exception = e; 95 } 96 97 106 public CatalogException (String message, Exception e) { 107 super(message); 108 this.exceptionType = WRAPPER; 109 this.exception = e; 110 } 111 112 121 public String getMessage () 122 { 123 String message = super.getMessage(); 124 125 if (message == null && exception != null) { 126 return exception.getMessage(); 127 } else { 128 return message; 129 } 130 } 131 132 137 public Exception getException () 138 { 139 return exception; 140 } 141 142 147 public int getExceptionType () 148 { 149 return exceptionType; 150 } 151 152 157 public String toString () 158 { 159 if (exception != null) { 160 return exception.toString(); 161 } else { 162 return super.toString(); 163 } 164 } 165 } 166 | Popular Tags |