1 19 20 package org.apache.cayenne; 21 22 import org.apache.cayenne.util.LocalizedStringsHandler; 23 24 30 public class CayenneException extends Exception { 31 32 private static String exceptionLabel; 33 34 static { 35 String version = LocalizedStringsHandler.getString("cayenne.version"); 36 String date = LocalizedStringsHandler.getString("cayenne.build.date"); 37 38 if (version != null || date != null) { 39 exceptionLabel = "[v." + version + " " + date + "] "; 40 } 41 else { 42 exceptionLabel = ""; 43 } 44 } 45 46 public static String getExceptionLabel() { 47 return exceptionLabel; 48 } 49 50 53 public CayenneException() { 54 } 55 56 61 public CayenneException(String message) { 62 super(message); 63 } 64 65 69 public CayenneException(Throwable cause) { 70 super(cause); 71 } 72 73 public CayenneException(String message, Throwable cause) { 74 super(message, cause); 75 } 76 77 82 public String getUnlabeledMessage() { 83 return super.getMessage(); 84 } 85 86 public String getMessage() { 87 String message = super.getMessage(); 88 return (message != null) ? getExceptionLabel() + message : getExceptionLabel() 89 + "(no message)"; 90 } 91 } 92 | Popular Tags |