1 |
/* ParseException.java -- An error occurred while parsing. |
/* ParseException.java -- an error occurred while parsing |
2 |
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
any later version. |
10 |
|
|
11 |
GNU Classpath is distributed in the hope that it will be useful, but |
GNU Classpath is distributed in the hope that it will be useful, but |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
38 |
|
|
39 |
package java.text; |
package java.text; |
40 |
|
|
|
/* Written using "Java Class Libraries", 2nd edition, plus online |
|
|
* API docs for JDK 1.2 beta from http://www.javasoft.com. |
|
|
* Status: Believed complete and correct. |
|
|
*/ |
|
|
|
|
|
/** |
|
|
* This exception is thrown when an unexpected error occurs during parsing. |
|
|
* |
|
|
* @version 0.0 |
|
|
* |
|
|
* @author Aaron M. Renn (arenn@urbanophile.com) |
|
|
* @author Per Bothner <bothner@cygnus.com> |
|
|
* @date October 25, 1998. |
|
|
*/ |
|
|
public class ParseException extends Exception |
|
|
{ |
|
|
|
|
|
/* |
|
|
* Instance Variables |
|
|
*/ |
|
|
|
|
41 |
/** |
/** |
42 |
* This is the position where the error was encountered. |
* This exception is thrown when an unexpected error occurs during parsing. |
43 |
*/ |
* |
44 |
private int errorOffset; |
* @author Aaron M. Renn (arenn@urbanophile.com) |
45 |
|
* @author Per Bothner <bothner@cygnus.com> |
46 |
/*************************************************************************/ |
* @see Format |
47 |
|
* @see FieldPosition |
48 |
/* |
* @status updated to 1.4 |
|
* Constructors |
|
49 |
*/ |
*/ |
50 |
|
public class ParseException extends Exception |
|
/** |
|
|
* This method initializes a new instance of <code>ParseException</code> |
|
|
* with a detailed error message and a error position. |
|
|
* |
|
|
* @param msg The descriptive message describing the error. |
|
|
* @param offset The position where the error was encountered. |
|
|
*/ |
|
|
public |
|
|
ParseException(String s, int offset) |
|
|
{ |
|
|
super(s); |
|
|
|
|
|
errorOffset = offset; |
|
|
} |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the position where the error occurred. |
|
|
* |
|
|
* @return The position where the error occurred. |
|
|
*/ |
|
|
public int |
|
|
getErrorOffset() |
|
51 |
{ |
{ |
52 |
return(errorOffset); |
/** |
53 |
} |
* Compatible with JDK 1.1+. |
54 |
|
*/ |
55 |
|
private static final long serialVersionUID = 2703218443322787634L; |
56 |
|
|
57 |
|
/** |
58 |
|
* This is the position where the error was encountered. |
59 |
|
* |
60 |
|
* @serial the zero-based offset in the string where the error occurred |
61 |
|
*/ |
62 |
|
private final int errorOffset; |
63 |
|
|
64 |
|
/** |
65 |
|
* This method initializes a new instance of <code>ParseException</code> |
66 |
|
* with a detailed error message and a error position. |
67 |
|
* |
68 |
|
* @param msg the descriptive message describing the error |
69 |
|
* @param offset the position where the error was encountered |
70 |
|
*/ |
71 |
|
public ParseException(String s, int offset) |
72 |
|
{ |
73 |
|
super(s); |
74 |
|
errorOffset = offset; |
75 |
|
} |
76 |
|
|
77 |
|
/** |
78 |
|
* This method returns the position where the error occurred. |
79 |
|
* |
80 |
|
* @return the position where the error occurred |
81 |
|
*/ |
82 |
|
public int getErrorOffset() |
83 |
|
{ |
84 |
|
return errorOffset; |
85 |
|
} |
86 |
} // class ParseException |
} // class ParseException |
|
|
|