01: /*
02: * Copyright 2004-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.springframework.binding.expression;
17:
18: import org.springframework.core.NestedRuntimeException;
19:
20: /**
21: * Base class for exceptions thrown during expression parsing.
22: *
23: * @author Keith Donald
24: */
25: public class ParserException extends NestedRuntimeException {
26:
27: /**
28: * The expression string that could not be parsed.
29: */
30: private String expressionString;
31:
32: /**
33: * Creates a new expression parsing exception.
34: * @param expressionString the expression string that could not be parsed
35: * @param cause the underlying cause of this exception
36: */
37: public ParserException(String expressionString, Throwable cause) {
38: this (expressionString, "Unable to parse expression string '"
39: + expressionString + "'", cause);
40: }
41:
42: /**
43: * Creates a new expression parsing exception.
44: * @param expressionString the expression string that could not be parsed
45: * @param message a descriptive message
46: * @param cause the underlying cause of this exception
47: */
48: public ParserException(String expressionString, String message,
49: Throwable cause) {
50: super (message, cause);
51: this .expressionString = expressionString;
52: }
53:
54: /**
55: * Returns the expression string that could not be parsed.
56: */
57: public Object getExpressionString() {
58: return expressionString;
59: }
60: }
|