1 23 24 29 30 package com.sun.jdo.api.persistence.model; 31 32 import java.io.PrintStream ; 33 import java.io.PrintWriter ; 34 35 import com.sun.jdo.spi.persistence.utility.StringHelper; 36 37 42 public class ModelVetoException extends ModelException 43 { 44 48 private Throwable _target; 49 50 54 public ModelVetoException () 55 { 56 } 57 58 63 public ModelVetoException (String msg) 64 { 65 super(msg); 66 } 67 68 71 public ModelVetoException (Throwable target) 72 { 73 super(); 74 _target = target; 75 } 76 77 81 public ModelVetoException (Throwable target, String s) 82 { 83 super(s); 84 _target = target; 85 } 86 87 90 public Throwable getTargetException() { return _target; } 91 92 101 public String getMessage() 102 { 103 String message = super.getMessage(); 104 105 if (StringHelper.isEmpty(message)) 106 { 107 Throwable target = getTargetException(); 108 109 message = target.getMessage(); 110 } 111 112 return message; 113 } 114 115 119 public void printStackTrace () 120 { 121 printStackTrace(System.err); 122 } 123 124 128 public void printStackTrace (PrintStream ps) 129 { 130 synchronized (ps) 131 { 132 Throwable target = getTargetException(); 133 134 if (target != null) 135 { 136 ps.print(getClass() + ": "); target.printStackTrace(ps); 138 } 139 else 140 super.printStackTrace(ps); 141 } 142 } 143 144 148 public void printStackTrace (PrintWriter pw) 149 { 150 synchronized (pw) 151 { 152 Throwable target = getTargetException(); 153 154 if (target != null) 155 { 156 pw.print(getClass() + ": "); target.printStackTrace(pw); 158 } 159 else 160 super.printStackTrace(pw); 161 } 162 } 163 } 164 | Popular Tags |