01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.channels.error;
07:
08: import org.apache.commons.logging.Log;
09: import org.apache.commons.logging.LogFactory;
10: import org.jasig.portal.ChannelRuntimeData;
11: import org.jasig.portal.ChannelRuntimeProperties;
12: import org.jasig.portal.ChannelStaticData;
13: import org.jasig.portal.IChannel;
14: import org.jasig.portal.PortalEvent;
15: import org.jasig.portal.PortalException;
16: import org.xml.sax.ContentHandler;
17:
18: /**
19: * A channel which exists to throw a deeply nested exception at render time,
20: * in order to give CError a chance to demonstrate its presentation of nested
21: * throwables.
22: * @author andrew.petro@yale.edu
23: * @version $Revision: 35593 $ $Date: 2005-04-17 13:54:14 -0700 (Sun, 17 Apr 2005) $
24: * @since uPortal 2.5
25: */
26: public final class CThrower implements IChannel {
27: private final Log log = LogFactory.getLog(getClass());
28:
29: /**
30: * Do-nothing constructor
31: */
32: public CThrower() {
33: this .log.trace("CThrower()");
34: // nothing to do
35: }
36:
37: public ChannelRuntimeProperties getRuntimeProperties() {
38: this .log.trace("getRuntimeProperties()");
39: return new ChannelRuntimeProperties();
40: }
41:
42: public void receiveEvent(PortalEvent ev) {
43: if (this .log.isTraceEnabled())
44: this .log.trace("received event [" + ev + "]");
45: // no events for this channel
46: }
47:
48: public void setStaticData(ChannelStaticData sd) {
49: if (this .log.isTraceEnabled())
50: this .log.trace("setStaticData(" + sd + ")");
51: }
52:
53: public void setRuntimeData(ChannelRuntimeData rd) {
54: if (this .log.isTraceEnabled())
55: this .log.trace("setRuntimeData(" + rd + ")");
56: }
57:
58: public void renderXML(ContentHandler out) throws PortalException {
59:
60: RuntimeException runtimeException = new RuntimeException(
61: "Deepest exception is a RuntimeException.");
62: PortalException portalException = new PortalException(
63: "Middle exception is a PortalException.",
64: runtimeException);
65: PortalException outerException = new PortalException(
66: "Outer exception is also a PortalException",
67: portalException);
68: throw outerException;
69: }
70:
71: }
|