|
1 /* |
|
2 * Licensed to the Apache Software Foundation (ASF) under one |
|
3 * or more contributor license agreements. See the NOTICE file |
|
4 * distributed with this work for additional information |
|
5 * regarding copyright ownership. The ASF licenses this file |
|
6 * to you under the Apache License, Version 2.0 (the "License"); |
|
7 * you may not use this file except in compliance with the License. |
|
8 * You may obtain a copy of the License at |
|
9 * |
|
10 * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 * |
|
12 * Unless required by applicable law or agreed to in writing, software |
|
13 * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 * See the License for the specific language governing permissions and |
|
16 * limitations under the License. |
|
17 */ |
|
18 /* |
|
19 * $Id: $ |
|
20 */ |
|
21 |
|
22 package com.sun.org.apache.xml.internal.serializer.dom3; |
|
23 |
|
24 import org.w3c.dom.DOMError; |
|
25 import org.w3c.dom.DOMLocator; |
|
26 |
|
27 /** |
|
28 * Implementation of the DOM Level 3 DOMError interface. |
|
29 * |
|
30 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ERROR-Interfaces-DOMError'>DOMError Interface definition from Document Object Model (DOM) Level 3 Core Specification</a>. |
|
31 * |
|
32 * @xsl.usage internal |
|
33 */ |
|
34 |
|
35 final class DOMErrorImpl implements DOMError { |
|
36 |
|
37 /** private data members */ |
|
38 |
|
39 // The DOMError Severity |
|
40 private short fSeverity = DOMError.SEVERITY_WARNING; |
|
41 |
|
42 // The Error message |
|
43 private String fMessage = null; |
|
44 |
|
45 // A String indicating which related data is expected in relatedData. |
|
46 private String fType; |
|
47 |
|
48 // The platform related exception |
|
49 private Exception fException = null; |
|
50 |
|
51 // |
|
52 private Object fRelatedData; |
|
53 |
|
54 // The location of the exception |
|
55 private DOMLocatorImpl fLocation = new DOMLocatorImpl(); |
|
56 |
|
57 |
|
58 // |
|
59 // Constructors |
|
60 // |
|
61 |
|
62 /** |
|
63 * Default constructor. |
|
64 */ |
|
65 DOMErrorImpl () { |
|
66 } |
|
67 |
|
68 /** |
|
69 * @param severity |
|
70 * @param message |
|
71 * @param type |
|
72 */ |
|
73 DOMErrorImpl(short severity, String message, String type) { |
|
74 fSeverity = severity; |
|
75 fMessage = message; |
|
76 fType = type; |
|
77 } |
|
78 |
|
79 /** |
|
80 * @param severity |
|
81 * @param message |
|
82 * @param type |
|
83 * @param exception |
|
84 */ |
|
85 DOMErrorImpl(short severity, String message, String type, |
|
86 Exception exception) { |
|
87 fSeverity = severity; |
|
88 fMessage = message; |
|
89 fType = type; |
|
90 fException = exception; |
|
91 } |
|
92 |
|
93 /** |
|
94 * @param severity |
|
95 * @param message |
|
96 * @param type |
|
97 * @param exception |
|
98 * @param relatedData |
|
99 * @param location |
|
100 */ |
|
101 DOMErrorImpl(short severity, String message, String type, |
|
102 Exception exception, Object relatedData, DOMLocatorImpl location) { |
|
103 fSeverity = severity; |
|
104 fMessage = message; |
|
105 fType = type; |
|
106 fException = exception; |
|
107 fRelatedData = relatedData; |
|
108 fLocation = location; |
|
109 } |
|
110 |
|
111 |
|
112 /** |
|
113 * The severity of the error, either <code>SEVERITY_WARNING</code>, |
|
114 * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>. |
|
115 * |
|
116 * @return A short containing the DOMError severity |
|
117 */ |
|
118 public short getSeverity() { |
|
119 return fSeverity; |
|
120 } |
|
121 |
|
122 /** |
|
123 * The DOMError message string. |
|
124 * |
|
125 * @return String |
|
126 */ |
|
127 public String getMessage() { |
|
128 return fMessage; |
|
129 } |
|
130 |
|
131 /** |
|
132 * The location of the DOMError. |
|
133 * |
|
134 * @return A DOMLocator object containing the DOMError location. |
|
135 */ |
|
136 public DOMLocator getLocation() { |
|
137 return fLocation; |
|
138 } |
|
139 |
|
140 /** |
|
141 * The related platform dependent exception if any. |
|
142 * |
|
143 * @return A java.lang.Exception |
|
144 */ |
|
145 public Object getRelatedException(){ |
|
146 return fException; |
|
147 } |
|
148 |
|
149 /** |
|
150 * Returns a String indicating which related data is expected in relatedData. |
|
151 * |
|
152 * @return A String |
|
153 */ |
|
154 public String getType(){ |
|
155 return fType; |
|
156 } |
|
157 |
|
158 /** |
|
159 * The related DOMError.type dependent data if any. |
|
160 * |
|
161 * @return java.lang.Object |
|
162 */ |
|
163 public Object getRelatedData(){ |
|
164 return fRelatedData; |
|
165 } |
|
166 |
|
167 public void reset(){ |
|
168 fSeverity = DOMError.SEVERITY_WARNING; |
|
169 fException = null; |
|
170 fMessage = null; |
|
171 fType = null; |
|
172 fRelatedData = null; |
|
173 fLocation = null; |
|
174 } |
|
175 |
|
176 }// class DOMErrorImpl |