KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > utils > parser > ParseException


1 package com.daffodilwoods.daffodildb.utils.parser;
2
3 import com.daffodilwoods.database.resource.*;
4 import java.util.Locale JavaDoc;
5    /**
6     * This class is used to throw exception.
7     */

8
9 public class ParseException extends DException implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter{
10
11    /**
12     * Type variable is used to return type used in binary.
13     */

14    int returnType;
15
16    /**
17     * Position variable is used to tell the position of parseException in query.
18     */

19    int position = -1;
20
21    String JavaDoc causeOfFailure;// = "TO BE SET";
22
String JavaDoc query;
23    int causeOfFailurePosition;
24
25    public ParseException(){
26        super("DSE1174",null);
27    }
28
29    /**
30     * Method used to set the return Type of object.
31     */

32
33    void setReturnType(int type){
34         returnType = type;
35    }
36
37    /**
38     * Method used to set the position of exception in query.
39     */

40    void setPosition(int position0){
41      if (position0 > position)
42        position = position0;
43    }
44
45    void setCauseOfParseException(int pst,String JavaDoc cause,int position0){
46       if ( position0 > position ){
47          causeOfFailurePosition = pst;
48       }
49    }
50
51    public Object JavaDoc run(Object JavaDoc object) throws com.daffodilwoods.database.resource.DException{
52       throw this;
53    }
54
55    void setQuery(String JavaDoc query0){
56      query = query0;
57       objarray = new Object JavaDoc[]{query};
58    }
59
60    public String JavaDoc toString(){
61       return getMessage();
62    }
63
64    public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc{
65      throw new RuntimeException JavaDoc("METHOD CLONE NOT SUPPORTED ... ");
66    }
67
68    public int getErrorPosition(){
69      return position;
70    }
71
72    public String JavaDoc getMessage(Locale JavaDoc locale){
73       objarray = new Object JavaDoc[]{new Integer JavaDoc(position),causeOfFailure};
74       return super.getMessage(locale);
75    }
76 }
77
Popular Tags