KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > neu > ccs > jmk > ParseError


1 // $Id: ParseError.java,v 1.1.1.1 2000/09/26 11:20:34 ramsdell Exp $
2

3 // The exception raised by parse errors.
4

5 /*
6  * Copyright 1997 by John D. Ramsdell
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 package edu.neu.ccs.jmk;
24
25 import java.io.File JavaDoc;
26
27 /**
28  * The parse error exception.
29  * @version November 1997
30  * @author John D. Ramsdell
31  */

32 public class ParseError
33 extends Exception JavaDoc
34 {
35   private File JavaDoc file;
36   private int lineNumber;
37
38   ParseError(File JavaDoc file, int lineNumber, String JavaDoc msg) {
39     super(msg);
40     this.file = file;
41     // LineNumberReader starts a 0 and counts line terminators
42
this.lineNumber = lineNumber + 1;
43   }
44
45   /**
46    * Returns the line number at which the parse error occured.
47    */

48   public int getLineNumber() {
49     return lineNumber;
50   }
51
52   /**
53    * Returns the file name in which the parse error occured.
54    */

55   public String JavaDoc getFileName() {
56     return file == null ? "" : file.getPath();
57   }
58 }
59
Popular Tags