Source code: com/sun/syndication/io/ParsingFeedException.java
1 /*
2 * Copyright 2004 Sun Microsystems, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17 package com.sun.syndication.io;
18
19 import org.jdom.input.JDOMParseException;
20
21 /**
22 * Exception thrown by WireFeedInput instance if it can not parse a feed.
23 * <p>
24 * @author Elaine Chien
25 *
26 */
27 public class ParsingFeedException extends FeedException {
28
29 /**
30 * Creates a FeedException with a message.
31 * <p>
32 * @param msg exception message.
33 *
34 */
35 public ParsingFeedException(String msg) {
36 super(msg);
37 }
38
39 /**
40 * Creates a FeedException with a message and a root cause exception.
41 * <p>
42 * @param msg exception message.
43 * @param rootCause root cause exception.
44 *
45 */
46 public ParsingFeedException(String msg, Throwable rootCause) {
47 super(msg, rootCause);
48 }
49
50 /**
51 * Returns the line number of the end of the text where the
52 * parse error occurred.
53 * <p>
54 * The first line in the document is line 1.</p>
55 *
56 * @return an integer representing the line number, or -1
57 * if the information is not available.
58 */
59 public int getLineNumber() {
60 return (getCause() instanceof JDOMParseException)?
61 ((JDOMParseException)getCause()).getLineNumber(): -1;
62 }
63
64 /**
65 * Returns the column number of the end of the text where the
66 * parse error occurred.
67 * <p>
68 * The first column in a line is position 1.</p>
69 *
70 * @return an integer representing the column number, or -1
71 * if the information is not available.
72 */
73 public int getColumnNumber() {
74 return (getCause() instanceof JDOMParseException)?
75 ((JDOMParseException)getCause()).getColumnNumber(): -1;
76 }
77
78 }