1 package com.teamkonzept.lib; 2 3 import org.apache.log4j.Category; 4 import com.teamkonzept.db.*; 5 import com.teamkonzept.web.*; 6 import java.util.*; 7 import java.sql.SQLException ; 8 9 14 public class DefaultExceptionHandler implements ConfigurationErrorCodes 15 { 16 17 21 public static boolean handleException(TKException e, TKEvent evt) 22 { 23 return false; 24 } 25 26 public static TKException getException(Throwable t) 27 { 28 if (t instanceof TKSQLError) 30 { 31 SQLException sqlEx = ((TKSQLError)t).getSQLException(); 32 if (sqlEx != null) 33 return DatabaseErrorAnalyzer.getInstance().analyzeSQLError(sqlEx); 34 else 35 return new TKDatabaseException(t.getMessage(),UNDEFINED, NORMAL_SEVERITY, false, t); 36 } 37 else if (t instanceof SQLException ) 38 { 39 return DatabaseErrorAnalyzer.getInstance().analyzeSQLError((SQLException )t); 40 } 41 else if (t instanceof java.lang.OutOfMemoryError ) 42 { 43 return new TKConfigurationException("Speicher unzureichend", OUT_OF_MEMORY, HIGH_SEVERITY, false, t); 44 } 45 else if (t instanceof MissingResourceException) 46 { 47 Integer key = new Integer (((MissingResourceException)t).getKey()); 48 return new TKConfigurationException("Ressource missing", key.intValue(), HIGH_SEVERITY, false, t); 49 } 50 else if (t instanceof TKException) 51 { 52 return (TKException)t; } 54 return new TKException("Unbekannter Fehler", UNDEFINED, NORMAL_SEVERITY, false, t); } 56 57 } | Popular Tags |