1 | /* |
2 | * Copyright 2007 brunella ltd |
3 | * |
4 | * Licensed under the LGPL Version 3 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * |
7 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
8 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
9 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
10 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
11 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
12 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
13 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
14 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
15 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
16 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
17 | * THE POSSIBILITY OF SUCH DAMAGE. |
18 | */ |
19 | package sf.qof.exception; |
20 | |
21 | /** |
22 | * A parsing exception. |
23 | * Thrown by the <code>SqlParser</code> |
24 | * |
25 | * @see sf.qof.parser.SqlParser |
26 | */ |
27 | public class SqlParserException extends RuntimeException { |
28 | |
29 | private static final long serialVersionUID = -4719857605238942051L; |
30 | |
31 | private int start; |
32 | private int length; |
33 | |
34 | /** |
35 | * Creates a SqlParserException. |
36 | * |
37 | * @param message the error message |
38 | */ |
39 | public SqlParserException(String message) { |
40 | super(message); |
41 | } |
42 | |
43 | /** |
44 | * Creates a SqlParserException. |
45 | * |
46 | * @param message the error message |
47 | * @param start start position in SQL statement |
48 | * @param length length of error in SQL statement |
49 | */ |
50 | public SqlParserException(String message, int start, int length) { |
51 | super(message); |
52 | this.start = start; |
53 | this.length = length; |
54 | } |
55 | |
56 | /** |
57 | * Returns start position of error in SQL statement. |
58 | * |
59 | * @return start position |
60 | */ |
61 | public int getStart() { |
62 | return start; |
63 | } |
64 | |
65 | /** |
66 | * Returns length of error in SQL statement. |
67 | * |
68 | * @return length |
69 | */ |
70 | public int getLength() { |
71 | return length; |
72 | } |
73 | |
74 | } |