01: /*
02: * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights
03: * Reserved. Use is subject to license terms.
04: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License version
08: * 2 only, as published by the Free Software Foundation.
09: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * General Public License version 2 for more details (a copy is
14: * included at /legal/license.txt).
15: *
16: * You should have received a copy of the GNU General Public License
17: * version 2 along with this work; if not, write to the Free Software
18: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
22: * Clara, CA 95054 or visit www.sun.com if you need additional
23: * information or have any questions.
24: */
25: /*
26: * SdpException.java
27: *
28: * Created on December 18, 2001, 11:08 AM
29: */
30:
31: package gov.nist.javax.sdp;
32:
33: /**
34: * The SdpParseException encapsulates the information thrown when an
35: * error occurs during SDP parsing.
36: * @version 1.0
37: */
38: public class SdpParseException extends SdpException {
39: /** Current line in parsed text. */
40: private int lineNumber;
41: /** Current character offset in the parse buffer. */
42: private int charOffset;
43:
44: /**
45: * Constructs a new SdpParseException when the parser needs to
46: * throw an exception indicating a parsing failure.
47: * @param lineNumber SDP line number that caused the exception.
48: * @param charOffset offset of the character that caused the exception.
49: * @param message a String containing the text of the exception message
50: * @param rootCause the Throwable exception that interfered with the
51: * Codelet's normal operation, making this Codelet exception necessary.
52: */
53: public SdpParseException(int lineNumber, int charOffset,
54: String message, Throwable rootCause) {
55: super (message, rootCause);
56: this .lineNumber = lineNumber;
57: this .charOffset = charOffset;
58: }
59:
60: /**
61: * Constructs a new SdpParseException when the parser needs to
62: * throw an exception indicating a parsing failure.
63: * @param lineNumber SDP line number that caused the exception.
64: * @param charOffset offset of the characeter that caused the exception.
65: * @param message a String containing the text of the exception message
66: */
67: public SdpParseException(int lineNumber, int charOffset,
68: String message) {
69: super (message);
70: this .lineNumber = lineNumber;
71: this .charOffset = charOffset;
72: }
73:
74: /**
75: * Returns the line number where the error occured.
76: * @return the line number where the error occured
77: */
78: public int getLineNumber() {
79: return lineNumber;
80: }
81:
82: /**
83: * Returns the char offset where the error occured.
84: * @return the char offset where the error occured.
85: */
86: public int getCharOffset() {
87: return charOffset;
88: }
89:
90: /**
91: * Returns the message stored when the exception was created.
92: * @return the message stored when the exception was created.
93: */
94: public String getMessage() {
95: return super.getMessage();
96: }
97:
98: }
|