1 24 package org.ofbiz.base.util; 25 26 import java.io.PrintStream ; 27 import java.io.PrintWriter ; 28 29 36 public class GeneralRuntimeException extends RuntimeException { 37 38 Throwable nested = null; 39 40 43 public GeneralRuntimeException() { 44 super(); 45 } 46 47 51 public GeneralRuntimeException(String msg) { 52 super(msg); 53 } 54 55 59 public GeneralRuntimeException(Throwable nested) { 60 super(); 61 this.nested = nested; 62 } 63 64 68 public GeneralRuntimeException(String msg, Throwable nested) { 69 super(msg); 70 this.nested = nested; 71 } 72 73 74 public String getMessage() { 75 if (nested != null) 76 return super.getMessage() + " (" + nested.getMessage() + ")"; 77 else 78 return super.getMessage(); 79 } 80 81 82 public String getNonNestedMessage() { 83 return super.getMessage(); 84 } 85 86 87 public Throwable getNested() { 88 return nested; 89 } 90 91 92 public void printStackTrace() { 93 super.printStackTrace(); 94 if (nested != null) nested.printStackTrace(); 95 } 96 97 98 public void printStackTrace(PrintStream ps) { 99 super.printStackTrace(ps); 100 if (nested != null) nested.printStackTrace(ps); 101 } 102 103 104 public void printStackTrace(PrintWriter pw) { 105 super.printStackTrace(pw); 106 if (nested != null) nested.printStackTrace(pw); 107 } 108 } 109 | Popular Tags |