1 16 package org.apache.commons.jxpath; 17 18 24 25 public class JXPathException extends RuntimeException { 26 27 28 private Throwable exception; 29 30 34 35 public JXPathException() { 36 super(); 37 this.exception = null; 38 } 39 40 46 public JXPathException(String msg) { 47 super(msg); 48 this.exception = null; 49 } 50 51 52 59 public JXPathException(Throwable e) { 60 super(e.toString()); 61 this.exception = e; 62 } 63 64 72 public JXPathException(String msg, Throwable e) { 73 super(msg); 74 this.exception = e; 75 } 76 77 78 85 public String getMessage() { 86 String message = super.getMessage(); 87 88 if (exception != null) { 89 if (message == null) { 90 if (exception.getMessage() != null) { 91 return exception.getMessage(); 92 } 93 else { 94 return exception.getClass().getName(); 95 } 96 } 97 else { 98 if (exception.getMessage() != null) { 99 return message + "; " + exception.getMessage(); 100 } 101 else { 102 return message + "; " + exception.getClass().getName(); 103 } 104 } 105 } 106 107 return message; 108 } 109 110 116 public Throwable getException() { 117 return exception; 118 } 119 } | Popular Tags |