001: /*
002: * Copyright Aduna (http://www.aduna-software.com/) (c) 2007.
003: *
004: * Licensed under the Aduna BSD-style license.
005: */
006: package org.openrdf.query.resultio;
007:
008: import org.openrdf.OpenRDFException;
009:
010: /**
011: * A parse exception that can be thrown by a query result parser when it
012: * encounters an error from which it cannot or doesn't want to recover.
013: *
014: * @author Arjohn Kampman
015: */
016: public class QueryResultParseException extends OpenRDFException {
017:
018: /*-----------*
019: * Constants *
020: *-----------*/
021:
022: private static final long serialVersionUID = -6212290295459157916L;
023:
024: /*-----------*
025: * Variables *
026: *-----------*/
027:
028: private int lineNo = -1;
029:
030: private int columnNo = -1;
031:
032: /*--------------*
033: * Constructors *
034: *--------------*/
035:
036: /**
037: * Creates a new QueryResultParseException.
038: *
039: * @param msg
040: * An error message.
041: */
042: public QueryResultParseException(String msg) {
043: super (msg);
044: }
045:
046: /**
047: * Creates a new QueryResultParseException.
048: *
049: * @param msg
050: * An error message.
051: * @param lineNo
052: * A line number associated with the message.
053: * @param columnNo
054: * A column number associated with the message.
055: */
056: public QueryResultParseException(String msg, int lineNo,
057: int columnNo) {
058: super (msg);
059: this .lineNo = lineNo;
060: this .columnNo = columnNo;
061: }
062:
063: /**
064: * Creates a new QueryResultParseException wrapping another exception. The
065: * QueryResultParseException will inherit its message from the supplied
066: * source exception.
067: *
068: * @param t
069: * The source exception.
070: */
071: public QueryResultParseException(Throwable t) {
072: super (t);
073: }
074:
075: /**
076: * Creates a new QueryResultParseException wrapping another exception. The
077: * QueryResultParseException will inherit its message from the supplied
078: * source exception.
079: *
080: * @param t
081: * The source exception.
082: * @param lineNo
083: * A line number associated with the message.
084: * @param columnNo
085: * A column number associated with the message.
086: */
087: public QueryResultParseException(Throwable t, int lineNo,
088: int columnNo) {
089: super (t);
090: this .lineNo = lineNo;
091: this .columnNo = columnNo;
092: }
093:
094: /*-----------*
095: * Variables *
096: *-----------*/
097:
098: /**
099: * Gets the line number associated with this parse exception.
100: *
101: * @return A line number, or <tt>-1</tt> if no line number is available or
102: * applicable.
103: */
104: public int getLineNumber() {
105: return lineNo;
106: }
107:
108: /**
109: * Gets the column number associated with this parse exception.
110: *
111: * @return A column number, or <tt>-1</tt> if no column number is available
112: * or applicable.
113: */
114: public int getColumnNumber() {
115: return columnNo;
116: }
117: }
|