01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id: PropertyException.java 426576 2006-07-28 15:44:37Z jeremias $ */
19:
20: package org.apache.fop.fo.expr;
21:
22: import org.apache.fop.apps.FOPException;
23:
24: /**
25: * Class for managing exceptions that are raised in Property processing.
26: */
27: public class PropertyException extends FOPException {
28: private String propertyName;
29:
30: /**
31: * Constructor
32: * @param detail string containing the detail message
33: */
34: public PropertyException(String detail) {
35: super (detail);
36: }
37:
38: /**
39: * Sets the property context information.
40: * @param propInfo the property info instance
41: */
42: public void setPropertyInfo(PropertyInfo propInfo) {
43: setLocator(propInfo.getFO().getLocator());
44: propertyName = propInfo.getPropertyMaker().getName();
45: }
46:
47: /**
48: * Sets the name of the property.
49: * @param propertyName the property name
50: */
51: public void setPropertyName(String propertyName) {
52: this .propertyName = propertyName;
53: }
54:
55: /** @see java.lang.Throwable#getMessage()*/
56: public String getMessage() {
57: if (propertyName != null) {
58: return super .getMessage() + "; property:'" + propertyName
59: + "'";
60: } else {
61: return super.getMessage();
62: }
63: }
64: }
|