|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
DocumentParseException.java | 50% | 54.5% | 50% | 52% |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.tapestry.util.xml;
|
|
16 |
|
|
17 |
import org.apache.hivemind.ApplicationRuntimeException;
|
|
18 |
import org.apache.hivemind.Location;
|
|
19 |
import org.apache.hivemind.Resource;
|
|
20 |
import org.apache.hivemind.impl.LocationImpl;
|
|
21 |
import org.xml.sax.SAXParseException;
|
|
22 |
|
|
23 |
/**
|
|
24 |
* Exception thrown if there is any kind of error parsing the an XML document.
|
|
25 |
*
|
|
26 |
* @see org.apache.tapestry.parse.SpecificationParser
|
|
27 |
* @author Howard Lewis Ship
|
|
28 |
* @since 0.2.10
|
|
29 |
*/
|
|
30 |
|
|
31 |
public class DocumentParseException extends ApplicationRuntimeException |
|
32 |
{ |
|
33 |
private Resource _documentLocation;
|
|
34 |
|
|
35 | 0 |
public DocumentParseException(String message, Throwable rootCause)
|
36 |
{ |
|
37 | 0 |
this(message, null, null, rootCause); |
38 |
} |
|
39 |
|
|
40 | 1 |
public DocumentParseException(String message, Resource documentLocation)
|
41 |
{ |
|
42 | 1 |
this(message, documentLocation, null); |
43 |
} |
|
44 |
|
|
45 | 20 |
public DocumentParseException(String message, Resource documentLocation, Throwable rootCause)
|
46 |
{ |
|
47 | 20 |
this(message, documentLocation, null, rootCause); |
48 |
} |
|
49 |
|
|
50 | 21 |
public DocumentParseException(String message, Location location, Throwable rootCause)
|
51 |
{ |
|
52 | 21 |
this(message, location == null ? null : location.getResource(), location, rootCause); |
53 |
} |
|
54 |
|
|
55 | 42 |
private DocumentParseException(String message, Resource documentLocation, Location location,
|
56 |
Throwable rootCause) |
|
57 |
{ |
|
58 | 42 |
super(message, null, location, rootCause); |
59 |
|
|
60 | 42 |
_documentLocation = documentLocation; |
61 |
} |
|
62 |
|
|
63 | 1 |
public DocumentParseException(String message, Resource documentLocation,
|
64 |
SAXParseException rootCause) |
|
65 |
{ |
|
66 | 1 |
this(message, documentLocation, rootCause == null || documentLocation == null ? null |
67 |
: new LocationImpl(documentLocation, rootCause.getLineNumber(), rootCause
|
|
68 |
.getColumnNumber()), rootCause); |
|
69 |
} |
|
70 |
|
|
71 | 0 |
public DocumentParseException(String message)
|
72 |
{ |
|
73 | 0 |
this(message, null, null, null); |
74 |
} |
|
75 |
|
|
76 | 0 |
public DocumentParseException(Throwable rootCause)
|
77 |
{ |
|
78 | 0 |
this(rootCause.getMessage(), rootCause);
|
79 |
} |
|
80 |
|
|
81 | 0 |
public DocumentParseException(SAXParseException rootCause)
|
82 |
{ |
|
83 | 0 |
this(rootCause.getMessage(), rootCause);
|
84 |
} |
|
85 |
|
|
86 | 0 |
public Resource getDocumentLocation()
|
87 |
{ |
|
88 | 0 |
return _documentLocation;
|
89 |
} |
|
90 |
} |
|