KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > walend > somnifugi > sql92 > SelectorFormatException


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
9  * See the License for the specific language governing
10  * permissions and limitations under the License.
11  *
12  * When distributing Covered Code, include this CDDL
13  * HEADER in each file and include the License file at
14  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
15  *
16  * If applicable add the following below this CDDL HEADER,
17  * with the fields enclosed by brackets "[]" replaced with
18  * your own identifying information: Portions Copyright
19  * [year] [name of copyright owner]
20  */

21
22 /*
23  * @(#)SelectorFormatException.java 1.2 05/02/06
24  *
25  * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
26  */

27
28 package net.walend.somnifugi.sql92;
29
30 import net.walend.somnifugi.SomniMessageSelectorException;
31
32 /**
33  * Exception thrown when an invlaid selector is encoutnered.
34  *
35  */

36 public class SelectorFormatException
37     extends SomniMessageSelectorException
38 {
39     private static final long serialVersionUID = 0L;
40
41     String JavaDoc selector = null;
42     int index = -1;
43     
44     SelectorFormatException(String JavaDoc message)
45     {
46         super(message);
47     }
48     
49     SelectorFormatException(String JavaDoc message, String JavaDoc selector)
50     {
51         super(message);
52         this.selector = selector;
53     }
54     
55     SelectorFormatException(String JavaDoc message, String JavaDoc selector, int index)
56     {
57         super(message);
58         this.selector = selector;
59         this.index = index;
60     }
61     
62     public String JavaDoc getSelector()
63     {
64         return selector;
65     }
66     
67     public int getIndex()
68     {
69         return index;
70     }
71     
72     public String JavaDoc getMessage()
73     {
74         
75         if (selector != null)
76         {
77             if (index > -1)
78             {
79                 return super.getMessage() + ": \"" + selector + "\" at pos=" +
80                         index;
81             }
82             else
83             {
84                 return super.getMessage() + ": \"" + selector + "\"" ;
85             }
86         }
87         else
88         {
89             return super.getMessage();
90         }
91     }
92 }
93
Popular Tags