01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: CircularIncludesException.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.template.exceptions;
09:
10: import com.uwyn.rife.datastructures.DocumentPosition;
11: import com.uwyn.rife.tools.StringUtils;
12: import java.util.Stack;
13:
14: public class CircularIncludesException extends ProcessingException {
15: private static final long serialVersionUID = 3472405981484449892L;
16:
17: private String mTemplateName = null;
18: private DocumentPosition mErrorLocation = null;
19: private String mIncluded = null;
20: private Stack<String> mPreviousIncludes = null;
21:
22: public CircularIncludesException(String templateName,
23: DocumentPosition errorLocation, String included,
24: Stack<String> previousIncludes) {
25: super (
26: formatError(
27: templateName,
28: errorLocation,
29: "the template '"
30: + included
31: + "' has already been included, the include stack was : '"
32: + StringUtils.join(previousIncludes,
33: ", ") + "'"));
34:
35: mTemplateName = templateName;
36: mErrorLocation = errorLocation;
37: mIncluded = included;
38: mPreviousIncludes = previousIncludes;
39: }
40:
41: public String getTemplateName() {
42: return mTemplateName;
43: }
44:
45: public DocumentPosition getErrorLocation() {
46: return mErrorLocation;
47: }
48:
49: public String getIncluded() {
50: return mIncluded;
51: }
52:
53: public Stack<String> getPreviousIncludes() {
54: return mPreviousIncludes;
55: }
56: }
|