1 31 32 package com.opencms.legacy; 33 34 import org.opencms.i18n.CmsMessageContainer; 35 import org.opencms.main.CmsException; 36 import org.opencms.main.I_CmsThrowable; 37 38 import java.util.Locale ; 39 40 51 public class CmsLegacyException extends CmsException implements I_CmsThrowable { 52 53 54 private static final long serialVersionUID = -276358443570364537L; 55 56 60 private static class CmsLegacyMessageContainer extends CmsMessageContainer { 61 62 67 public CmsLegacyMessageContainer(String message) { 68 69 super(Messages.get(), message); 70 } 71 72 77 public String key() { 78 79 return getKey(); 80 } 81 82 89 public String key(Locale locale) { 90 91 return getKey(); 92 } 93 94 } 95 96 100 public static final String [] C_ERROR_DESCRIPTION = { 101 "Unknown exception", 102 "Access denied", 103 null, 104 "Bad name", 105 null, 106 null, 107 "Admin access required", 108 null, 109 "Unknown User Group", 110 "Group not empty", 111 "Unknown User", 112 "No removal from Default Group", 113 null, 114 "File not found exception", 115 "Filesystem exception", 116 "Internal use only", 117 "Deprecated exception: File-property is mandatory", 118 "Service unavailable", 119 "Unknown XML datablock", 120 "Corrupt internal structure", 121 "Wrong XML content type", 122 "XML parsing error", 123 "Could not process OpenCms special XML tag", 124 "Could not call user method", 125 "Could not call process method", 126 "XML tag missing", 127 "Wrong XML template class", 128 "No XML template class", 129 null, 130 "OpenCms class loader error", 131 "New password is too short", 132 null, 133 null, 134 "DriverManager init error", 135 "Registry error", 136 "Security Manager initialization error", 137 null, 138 "Wrong scheme for http resource", 139 "Wrong scheme for https resource", 140 "Error in Flex cache", 141 "Error in Flex loader", 142 "Group already exists", 143 "User already exists", 144 "Import error", 145 "Export error", 146 "Resource is not locked", 147 "Insufficient lock to edit content of resource", 148 "Resource locked by another user", 149 "Administrator priviledges are required to perform this operation", 150 "Project manager priviledges are required to perform this operation", 151 "Modify operation not allowed in 'Online' project", 152 "No permissions to perform this operation", 153 "Invalid password", 154 "OpenCms login validation failed", 155 "Error while loading invoking resource loader", 156 "Resource loader not template enabled", 157 "Unknown resource type requested!"}; 158 159 160 161 public static final int C_UNKNOWN_EXCEPTION = 0; 162 163 164 public static final int C_NOT_FOUND = 2; 165 166 167 public static final int C_BAD_NAME = 3; 168 169 170 public static final int C_SQL_ERROR = 4; 171 172 173 public static final int C_NOT_EMPTY = 5; 174 175 176 public static final int C_NOT_ADMIN = 6; 177 178 179 public static final int C_LOADER_GENERIC_ERROR = 54; 180 181 182 public static final int C_NO_GROUP = 8; 183 184 185 public static final int C_NO_USER = 10; 186 187 188 public static final int C_SERVICE_UNAVAILABLE = 17; 189 190 191 public static final int C_XML_UNKNOWN_DATA = 18; 192 193 194 public static final int C_XML_CORRUPT_INTERNAL_STRUCTURE = 19; 195 196 197 public static final int C_XML_WRONG_CONTENT_TYPE = 20; 198 199 200 public static final int C_XML_NO_PROCESS_METHOD = 24; 201 202 203 public static final int C_XML_PARSING_ERROR = 21; 204 205 206 public static final int C_XML_PROCESS_ERROR = 22; 207 208 209 public static final int C_XML_NO_USER_METHOD = 23; 210 211 212 public static final int C_XML_TAG_MISSING = 25; 213 214 215 public static final int C_XML_WRONG_TEMPLATE_CLASS = 26; 216 217 218 public static final int C_XML_NO_TEMPLATE_CLASS = 27; 219 220 221 public static final int C_CLASSLOADER_ERROR = 29; 222 223 224 public static final int C_REGISTRY_ERROR = 34; 225 226 227 public static final int C_RESOURCE_UNLOCKED = 45; 228 229 230 public static final int C_RESOURCE_LOCKED_NON_EXCLUSIVE = 46; 231 232 233 public static final int C_RESOURCE_LOCKED_BY_OTHER_USER = 47; 234 235 236 public static final int C_SECURITY_INVALID_PASSWORD = 52; 237 238 239 protected int m_type; 240 241 246 public CmsLegacyException(CmsMessageContainer message) { 247 248 super(message); 249 } 250 251 257 public CmsLegacyException(CmsMessageContainer message, Throwable cause) { 258 259 super(message, cause); 260 } 261 262 268 public CmsLegacyException(int type) { 269 270 super(new CmsLegacyMessageContainer(CmsLegacyException.getErrorDescription(type))); 271 m_type = type; 272 } 273 274 283 public CmsLegacyException(int type, Throwable cause) { 284 285 super(new CmsLegacyMessageContainer(CmsLegacyException.getErrorDescription(type))); 286 initCause(cause); 287 m_type = type; 288 } 289 290 295 public CmsLegacyException(String message) { 296 297 super(new CmsLegacyMessageContainer(message)); 298 } 299 300 306 public CmsLegacyException(String message, int type) { 307 308 super(new CmsLegacyMessageContainer(message)); 309 m_type = type; 310 } 311 312 320 public CmsLegacyException(String message, int type, Throwable cause) { 321 322 super(new CmsLegacyMessageContainer(message)); 323 initCause(cause); 324 m_type = type; 325 } 326 327 334 public CmsLegacyException(String message, Throwable cause) { 335 336 super(new CmsLegacyMessageContainer(message)); 337 initCause(cause); 338 } 339 340 348 public CmsException createException(CmsMessageContainer container, Throwable cause) { 349 350 return new CmsLegacyException(container, cause); 351 } 352 353 358 public int getType() { 359 360 return m_type; 361 } 362 363 370 protected static String getErrorDescription(int type) { 371 372 if ((type < CmsLegacyException.C_ERROR_DESCRIPTION.length) && (type > 0)) { 373 return CmsLegacyException.C_ERROR_DESCRIPTION[type]; 374 } else { 375 return CmsLegacyException.class.getName(); 376 } 377 } 378 } | Popular Tags |