KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > framework > InvalidSyntaxException


1 /*
2  * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/InvalidSyntaxException.java,v 1.16 2007/02/20 00:15:00 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.osgi.framework;
20
21 /**
22  * A Framework exception used to indicate that a filter string has an invalid
23  * syntax.
24  *
25  * <p>
26  * An <code>InvalidSyntaxException</code> object indicates that a filter
27  * string parameter has an invalid syntax and cannot be parsed. See
28  * {@link Filter} for a description of the filter string syntax.
29  *
30  * <p>
31  * This exception is updated to conform to the general purpose exception
32  * chaining mechanism.
33  *
34  * @version $Revision: 1.16 $
35  */

36
37 public class InvalidSyntaxException extends Exception JavaDoc {
38     static final long serialVersionUID = -4295194420816491875L;
39     /**
40      * The invalid filter string.
41      */

42     private final String JavaDoc filter;
43     /**
44      * Nested exception.
45      */

46     private final Throwable JavaDoc cause;
47
48     /**
49      * Creates an exception of type <code>InvalidSyntaxException</code>.
50      *
51      * <p>
52      * This method creates an <code>InvalidSyntaxException</code> object with
53      * the specified message and the filter string which generated the
54      * exception.
55      *
56      * @param msg The message.
57      * @param filter The invalid filter string.
58      */

59     public InvalidSyntaxException(String JavaDoc msg, String JavaDoc filter) {
60         super(msg);
61         this.filter = filter;
62         this.cause = null;
63     }
64
65     /**
66      * Creates an exception of type <code>InvalidSyntaxException</code>.
67      *
68      * <p>
69      * This method creates an <code>InvalidSyntaxException</code> object with
70      * the specified message and the filter string which generated the
71      * exception.
72      *
73      * @param msg The message.
74      * @param filter The invalid filter string.
75      * @param cause The cause of this exception.
76      * @since 1.3
77      */

78     public InvalidSyntaxException(String JavaDoc msg, String JavaDoc filter, Throwable JavaDoc cause) {
79         super(msg);
80         this.filter = filter;
81         this.cause = cause;
82     }
83
84     /**
85      * Returns the filter string that generated the
86      * <code>InvalidSyntaxException</code> object.
87      *
88      * @return The invalid filter string.
89      * @see BundleContext#getServiceReferences
90      * @see BundleContext#addServiceListener(ServiceListener,String)
91      */

92     public String JavaDoc getFilter() {
93         return filter;
94     }
95
96     /**
97      * Returns the cause of this exception or <code>null</code> if no cause
98      * was specified when this exception was created.
99      *
100      * @return The cause of this exception or <code>null</code> if no cause
101      * was specified.
102      * @since 1.3
103      */

104     public Throwable JavaDoc getCause() {
105         return cause;
106     }
107
108     /**
109      * The cause of this exception can only be set when constructed.
110      *
111      * @param cause Cause of the exception.
112      * @return This object.
113      * @throws java.lang.IllegalStateException This method will always throw an
114      * <code>IllegalStateException</code> since the cause of this
115      * exception can only be set when constructed.
116      * @since 1.3
117      */

118     public Throwable JavaDoc initCause(Throwable JavaDoc cause) {
119         throw new IllegalStateException JavaDoc();
120     }
121 }
122
Popular Tags