1 23 24 package javax.resource; 25 26 47 48 public class ResourceException extends java.lang.Exception { 49 50 51 private String errorCode; 52 53 54 private Exception linkedException; 55 56 59 public ResourceException() { super(); } 60 61 66 public ResourceException(String message) { 67 super(message); 68 } 69 70 75 public ResourceException(Throwable cause) { 76 super(cause); 77 } 78 79 86 public ResourceException(String message, Throwable cause) { 87 super(message, cause); 88 } 89 90 96 public ResourceException(String message, String errorCode) { 97 super(message); 98 this.errorCode = errorCode; 99 } 100 101 106 public void setErrorCode(String errorCode) { 107 this.errorCode = errorCode; 108 } 109 110 115 public String getErrorCode() { 116 return this.errorCode; 117 } 118 119 130 public Exception getLinkedException() { 131 return (linkedException); 132 } 133 134 145 public void setLinkedException(Exception ex) { 146 linkedException = ex; 147 } 148 149 154 public String getMessage() { 155 String msg = super.getMessage(); 156 String ec = getErrorCode(); 157 if ((msg == null) && (ec == null)) { 158 return null; 159 } 160 if ((msg != null) && (ec != null)) { 161 return (msg + ", error code: " + ec); 162 } 163 return ((msg != null) ? msg : ("error code: " + ec)); 164 } 165 } 166 | Popular Tags |