1 30 31 package com.caucho.ejb; 32 33 import com.caucho.util.ExceptionWrapper; 34 35 38 public class DuplicateKeyWrapper extends javax.ejb.DuplicateKeyException 39 implements ExceptionWrapper { 40 private Throwable rootCause; 41 42 47 public DuplicateKeyWrapper(String msg) 48 { 49 super(msg); 50 } 51 52 57 public DuplicateKeyWrapper(Throwable rootCause) 58 { 59 super(rootCause.getMessage()); 60 61 this.rootCause = rootCause; 62 } 63 64 69 public Throwable getRootCause() 70 { 71 return rootCause; 72 } 73 74 77 public String getMessage() 78 { 79 if (rootCause != null) 80 return rootCause.getMessage(); 81 else 82 return super.getMessage(); 83 } 84 85 88 public String toString() 89 { 90 if (rootCause == null) 91 return super.toString(); 92 else 93 return getClass().getName() + ": " + rootCause; 94 } 95 } 96 97 | Popular Tags |