01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter.rom;
06:
07: import com.sun.portal.rewriter.util.ModuleException;
08: import com.sun.portal.rewriter.util.StringHelper;
09:
10: /**
11: * This exception is thrown when the XML Ruleset edited by the user does not
12: * confirm to the DTD or not well formated.
13: *
14: * @version 1.0 12/15/2001
15: * @author Raja Nagendra Kumar, Nagendra.Raja@sun.com
16: */
17: public class InvalidXMLException extends Exception implements
18: ModuleException {
19: //Localisation ID's
20: public static final int UNKNOWN_EXCEPTION = 1000;
21: public static final int SAX_EXCEPTION = 1001;
22: public static final int KEY_DOES_NOT_EXIST = 1002;
23: public static final int REPEATED_TAG = 1003;
24: public static final int INVALID_ID = 1004;
25:
26: private Throwable cause;
27: private final String xmlString;
28: private final int localeID;
29: private Object errorInfo;
30:
31: public InvalidXMLException(final String aMessage,
32: final String aXMLString, final Object aErrorInfo,
33: final int aLocaleID) {
34: super (aMessage + " XMLString Provided was : " + aXMLString
35: + "\n");
36: xmlString = aXMLString;
37: localeID = aLocaleID;
38: if (aErrorInfo instanceof Throwable) {
39: cause = (Throwable) aErrorInfo;
40: } else {
41: errorInfo = aErrorInfo;
42: }
43: }//constructor
44:
45: public Object getErrorInfo() {
46: return errorInfo;
47: }//getInvalidID()
48:
49: public String getXMLString() {
50: return xmlString;
51: }//getXMLString()
52:
53: public int getLocaleID() {
54: return localeID;
55: }//getLocaleID()
56:
57: public Throwable getCause() {
58: if (cause == null) {
59: return new Exception(getMessage());
60: }
61:
62: return cause;
63: }//getCause()
64:
65: public String toString() {
66: return "Start of InvalidXMLException: " + "\nMessage: "
67: + getMessage() + "\nXML String: " + getXMLString()
68: + "\nCause: "
69: + StringHelper.exceptionStack2String(getCause())
70: + "\nExtraInfo: " + errorInfo
71: + "\nEnd of InvalidXMLException\n";
72: }//toString()
73: }//class InvalidXMLException
|