author | aefimov |
Fri, 09 Feb 2018 14:49:38 +0000 | |
changeset 48837 | a262b919311a |
parent 47216 | 71c04702a3d5 |
child 57956 | e0b8b019d2f5 |
permissions | -rw-r--r-- |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
1 |
/* |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
4 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
10 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
15 |
* accompanied this code). |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
16 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
20 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
23 |
* questions. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
24 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
25 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
26 |
// SAX exception class. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
27 |
// http://www.saxproject.org |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
28 |
// No warranty; no copyright -- use this as you will. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
29 |
// $Id: SAXException.java,v 1.3 2004/11/03 22:55:32 jsuttor Exp $ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
30 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
31 |
package jdk.internal.org.xml.sax; |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
32 |
|
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
33 |
import java.io.IOException; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
34 |
import java.io.InvalidClassException; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
35 |
import java.io.ObjectInputStream; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
36 |
import java.io.ObjectOutputStream; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
37 |
import java.io.ObjectStreamField; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
38 |
|
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
39 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
40 |
* Encapsulate a general SAX error or warning. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
41 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
42 |
* <blockquote> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
43 |
* <em>This module, both source code and documentation, is in the |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
44 |
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
45 |
* See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
46 |
* for further information. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
47 |
* </blockquote> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
48 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
49 |
* <p>This class can contain basic error or warning information from |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
50 |
* either the XML parser or the application: a parser writer or |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
51 |
* application writer can subclass it to provide additional |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
52 |
* functionality. SAX handlers may throw this exception or |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
53 |
* any exception subclassed from it.</p> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
54 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
55 |
* <p>If the application needs to pass through other types of |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
56 |
* exceptions, it must wrap those exceptions in a SAXException |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
57 |
* or an exception derived from a SAXException.</p> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
58 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
59 |
* <p>If the parser or application needs to include information about a |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
60 |
* specific location in an XML document, it should use the |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
61 |
* {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
62 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
63 |
* @since SAX 1.0 |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
64 |
* @author David Megginson |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
65 |
* @version 2.0.1 (sax2r2) |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
66 |
* @see org.xml.sax.SAXParseException |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
67 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
68 |
public class SAXException extends Exception { |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
69 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
70 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
71 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
72 |
* Create a new SAXException. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
73 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
74 |
public SAXException () |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
75 |
{ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
76 |
super(); |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
77 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
78 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
79 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
80 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
81 |
* Create a new SAXException. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
82 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
83 |
* @param message The error or warning message. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
84 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
85 |
public SAXException (String message) { |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
86 |
super(message); |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
87 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
88 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
89 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
90 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
91 |
* Create a new SAXException wrapping an existing exception. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
92 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
93 |
* <p>The existing exception will be embedded in the new |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
94 |
* one, and its message will become the default message for |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
95 |
* the SAXException.</p> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
96 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
97 |
* @param e The exception to be wrapped in a SAXException. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
98 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
99 |
public SAXException (Exception e) |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
100 |
{ |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
101 |
super(e); |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
102 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
103 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
104 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
105 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
106 |
* Create a new SAXException from an existing exception. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
107 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
108 |
* <p>The existing exception will be embedded in the new |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
109 |
* one, but the new exception will have its own message.</p> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
110 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
111 |
* @param message The detail message. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
112 |
* @param e The exception to be wrapped in a SAXException. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
113 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
114 |
public SAXException (String message, Exception e) |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
115 |
{ |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
116 |
super(message, e); |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
117 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
118 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
119 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
120 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
121 |
* Return a detail message for this exception. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
122 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
123 |
* <p>If there is an embedded exception, and if the SAXException |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
124 |
* has no detail message of its own, this method will return |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
125 |
* the detail message from the embedded exception.</p> |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
126 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
127 |
* @return The error or warning message. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
128 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
129 |
public String getMessage () |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
130 |
{ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
131 |
String message = super.getMessage(); |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
132 |
Throwable cause = super.getCause(); |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
133 |
|
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
134 |
if (message == null && cause != null) { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
135 |
return cause.getMessage(); |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
136 |
} else { |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
137 |
return message; |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
138 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
139 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
140 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
141 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
142 |
* Return the embedded exception, if any. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
143 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
144 |
* @return The embedded exception, or null if there is none. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
145 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
146 |
public Exception getException () |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
147 |
{ |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
148 |
return getExceptionInternal(); |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
149 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
150 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
151 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
152 |
* Return the cause of the exception |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
153 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
154 |
* @return Return the cause of the exception |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
155 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
156 |
public Throwable getCause() { |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
157 |
return super.getCause(); |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
158 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
159 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
160 |
/** |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
161 |
* Override toString to pick up any embedded exception. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
162 |
* |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
163 |
* @return A string representation of this exception. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
164 |
*/ |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
165 |
public String toString () |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
166 |
{ |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
167 |
Throwable exception = super.getCause(); |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
168 |
if (exception != null) { |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
169 |
return super.toString() + "\n" + exception.toString(); |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
170 |
} else { |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
171 |
return super.toString(); |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
172 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
173 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
174 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
175 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
176 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
177 |
////////////////////////////////////////////////////////////////////// |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
178 |
// Internal state. |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
179 |
////////////////////////////////////////////////////////////////////// |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
180 |
|
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
181 |
private static final ObjectStreamField[] serialPersistentFields = { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
182 |
new ObjectStreamField( "exception", Exception.class ) |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
183 |
}; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
184 |
|
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
185 |
/** |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
186 |
* Writes "exception" field to the stream. |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
187 |
* |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
188 |
* @param out stream used for serialization. |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
189 |
* @throws IOException thrown by <code>ObjectOutputStream</code> |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
190 |
*/ |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
191 |
private void writeObject(ObjectOutputStream out) |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
192 |
throws IOException { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
193 |
ObjectOutputStream.PutField fields = out.putFields(); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
194 |
fields.put("exception", getExceptionInternal()); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
195 |
out.writeFields(); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
196 |
} |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
197 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
198 |
/** |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
199 |
* Reads the "exception" field from the stream. |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
200 |
* And initializes the "exception" if it wasn't |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
201 |
* done before. |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
202 |
* |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
203 |
* @param in stream used for deserialization |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
204 |
* @throws IOException thrown by <code>ObjectInputStream</code> |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
205 |
* @throws ClassNotFoundException thrown by <code>ObjectInputStream</code> |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
206 |
*/ |
48837
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
207 |
private void readObject(ObjectInputStream in) |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
208 |
throws IOException, ClassNotFoundException { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
209 |
ObjectInputStream.GetField fields = in.readFields(); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
210 |
Exception exception = (Exception) fields.get("exception", null); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
211 |
Throwable superCause = super.getCause(); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
212 |
|
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
213 |
// if super.getCause() and 'exception' fields present then always use |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
214 |
// getCause() value. Otherwise, use 'exception' to initialize cause |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
215 |
if (superCause == null && exception != null) { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
216 |
try { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
217 |
super.initCause(exception); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
218 |
} catch (IllegalStateException e) { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
219 |
throw new InvalidClassException("Inconsistent state: two causes"); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
220 |
} |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
221 |
} |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
222 |
} |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
223 |
|
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
224 |
// Internal method to guard against overriding of public getException |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
225 |
// method by SAXException subclasses |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
226 |
private Exception getExceptionInternal() { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
227 |
Throwable cause = super.getCause(); |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
228 |
if (cause instanceof Exception) { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
229 |
return (Exception) cause; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
230 |
} else { |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
231 |
return null; |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
232 |
} |
a262b919311a
6857903: SAXException.initCause() does not correctly set Exception
aefimov
parents:
47216
diff
changeset
|
233 |
} |
14908
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
234 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
235 |
// Added serialVersionUID to preserve binary compatibility |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
236 |
static final long serialVersionUID = 583241635256073760L; |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
237 |
} |
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
238 |
|
1d01112e9ce5
8004371: (props) Properties.loadFromXML needs small footprint XML parser as fallback when JAXP is not present
joehw
parents:
diff
changeset
|
239 |
// end of SAXException.java |