1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.sf.xframe.xsddoc;
22
23 import javax.xml.transform.TransformerException;
24
25 import net.sf.xframe.ex.XFrameException;
26 import net.sf.xframe.xsddoc.util.XMLUtil;
27
28 import org.xml.sax.SAXParseException;
29
30 /***
31 * Exception class for excpetions occuring in the xsddoc processor.
32 *
33 * @author <a href="mailto:kriede@users.sourceforge.net">Kurt Riede</a>
34 *
35 */
36 public class ProcessorException extends XFrameException {
37
38 /***
39 * Construct a new <code>ProcessorException</code> instance.
40 *
41 * @param message The detail message for this exception.
42 */
43 public ProcessorException(final String message) {
44 super(message);
45 }
46
47 /***
48 * Construct a new <code>ProcessorException</code> instance.
49 *
50 * @param throwable the root cause of the exception
51 */
52 public ProcessorException(final Throwable throwable) {
53 super(throwable);
54 }
55
56 /***
57 * Construct a new <code>ProcessorException</code> instance.
58 *
59 * @param message The detail message for this exception.
60 * @param throwable the root cause of the exception
61 */
62 public ProcessorException(final String message, final Throwable throwable) {
63 super(message, throwable);
64 }
65
66 /***
67 * @see java.lang.Throwable#getLocalizedMessage()
68 */
69 public final String getLocalizedMessage() {
70 if (getCause() == null) {
71 return super.getLocalizedMessage();
72 } if (this.getCause() instanceof TransformerException) {
73 return XMLUtil.getLocallizedMessageAndLocation((TransformerException) getCause());
74 } else if (this.getCause() instanceof SAXParseException) {
75 return XMLUtil.getLocallizedMessageAndLocation((SAXParseException) getCause());
76 } else {
77 return getCause().getLocalizedMessage();
78 }
79 }
80
81 /***
82 * @see java.lang.Throwable#getMessage()
83 */
84 public final String getMessage() {
85 if (getCause() == null) {
86 return super.getMessage();
87 } if (this.getCause() instanceof TransformerException) {
88 return XMLUtil.getLocallizedMessageAndLocation((TransformerException) getCause());
89 }
90 return getCause().getMessage();
91 }
92 }