1 16 package com.ibatis.sqlmap.engine.scope; 17 18 21 public class ErrorContext { 22 23 private String resource; 24 private String activity; 25 private String objectId; 26 private String moreInfo; 27 private Throwable cause; 28 29 34 public String getResource() { 35 return resource; 36 } 37 38 43 public void setResource(String resource) { 44 this.resource = resource; 45 } 46 47 52 public String getActivity() { 53 return activity; 54 } 55 56 61 public void setActivity(String activity) { 62 this.activity = activity; 63 } 64 65 70 public String getObjectId() { 71 return objectId; 72 } 73 74 79 public void setObjectId(String objectId) { 80 this.objectId = objectId; 81 } 82 83 88 public String getMoreInfo() { 89 return moreInfo; 90 } 91 92 97 public void setMoreInfo(String moreInfo) { 98 this.moreInfo = moreInfo; 99 } 100 101 106 public Throwable getCause() { 107 return cause; 108 } 109 110 115 public void setCause(Throwable cause) { 116 this.cause = cause; 117 } 118 119 public String toString() { 120 StringBuffer message = new StringBuffer (); 121 122 if (resource != null) { 124 message.append(" \n--- The error occurred in "); 125 message.append(resource); 126 message.append("."); 127 } 128 129 if (activity != null) { 131 message.append(" \n--- The error occurred while "); 132 message.append(activity); 133 message.append("."); 134 } 135 136 if (objectId != null) { 138 message.append(" \n--- Check the "); 139 message.append(objectId); 140 message.append("."); 141 } 142 143 if (moreInfo != null) { 145 message.append(" \n--- "); 146 message.append(moreInfo); 147 } 148 149 if (cause != null) { 151 message.append(" \n--- Cause: "); 152 message.append(cause.toString()); 153 } 154 155 return message.toString(); 156 } 157 158 161 public void reset() { 162 resource = null; 163 activity = null; 164 objectId = null; 165 moreInfo = null; 166 cause = null; 167 } 168 169 170 } 171 | Popular Tags |