1 18 19 package de.gulden.framework.amoda.generic.interaction; 20 21 import de.gulden.framework.amoda.generic.option.*; 22 import de.gulden.framework.amoda.model.interaction.ErrorMessage; 23 import java.lang.*; 24 import java.util.*; 25 26 32 public class GenericErrorMessage extends GenericLogMessage implements ErrorMessage { 33 34 38 public boolean exit; 39 40 protected volatile Throwable cause; 41 42 43 47 public GenericErrorMessage() { 48 setType(ERROR_MESSAGE); 49 } 50 51 52 56 public void perform() { 57 ((de.gulden.framework.amoda.generic.core.GenericApplicationEnvironment)getApplication().getEnvironment()).doErrorMessage(this); 58 } 59 60 public Throwable getCause() { 61 return cause; 62 } 63 64 public void setCause(Throwable _cause) { 65 cause = _cause; 66 } 67 68 public boolean exitApplication() { 69 return exit; 70 } 71 72 public void setExitApplication(boolean _exit) { 73 exit = _exit; 74 } 75 76 public String toString() { 77 String s=""; 78 if (getText()!=null) { 79 s+=getText(); 80 } 81 if (getCause()!=null) { 82 s+=getCause().getClass().getName()+": "+getCause().getMessage()+"\n"; 83 java.io.StringWriter sw=new java.io.StringWriter (); 84 getCause().printStackTrace(new java.io.PrintWriter (sw)); 85 s+=sw.toString()+"\n"; 86 if (getCause() instanceof de.gulden.util.xml.XMLException) { 87 Throwable wrapped=((de.gulden.util.xml.XMLException)getCause()).getWrappedThrowable(); 88 if (wrapped!=null) { 89 s+="*** WRAPPED EXCEPTION ***\n"; 90 s+=wrapped.getClass().getName()+": "+wrapped.getMessage()+"\n"; 91 sw=new java.io.StringWriter (); 92 wrapped.printStackTrace(new java.io.PrintWriter (sw)); 93 s+=sw.toString()+"\n"; 94 } 95 } 96 } 97 if (s.equals("")) { 98 s="Unknown Error"; 99 } 100 return s; 101 } 102 103 } | Popular Tags |