001: /* ====================================================================
002: The Jicarilla Software License
003:
004: Copyright (c) 2003 Leo Simons.
005: All rights reserved.
006:
007: Permission is hereby granted, free of charge, to any person obtaining
008: a copy of this software and associated documentation files (the
009: "Software"), to deal in the Software without restriction, including
010: without limitation the rights to use, copy, modify, merge, publish,
011: distribute, sublicense, and/or sell copies of the Software, and to
012: permit persons to whom the Software is furnished to do so, subject to
013: the following conditions:
014:
015: The above copyright notice and this permission notice shall be
016: included in all copies or substantial portions of the Software.
017:
018: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
019: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
020: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
021: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
022: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
023: TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
024: SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
025: ==================================================================== */
026: package org.jicarilla.container;
027:
028: /**
029: * A {@link JicarillaException} that is thrown by containers, adapters,
030: * factories or resolvers if an attempt to load a class fails. The
031: * {@link org.jicarilla.lang.CascadingRuntimeException#getCause()}
032: * method will normally return the {@link ClassNotFoundException} that caused
033: * the problem.
034: *
035: * @author <a href="mail at leosimons dot com">Leo Simons</a>
036: * @version $Id: JicarillaClassNotFoundException.java,v 1.5 2004/03/23 13:37:51 lsimons Exp $
037: */
038: public class JicarillaClassNotFoundException extends
039: InitializationException {
040: /** The class that could not be found. */
041: protected String m_className;
042:
043: /**
044: * Construct a new <code>JicarillaClassNotFoundException</code> instance.
045: */
046: public JicarillaClassNotFoundException() {
047: super ();
048: }
049:
050: /**
051: * Construct a new <code>JicarillaClassNotFoundException</code> instance.
052: *
053: * @param className the class that could not be found.
054: * @param message the detail message for this exception.
055: */
056: public JicarillaClassNotFoundException(final String className,
057: final String message) {
058: super (message);
059: if (className == null)
060: throw new NullPointerException("className");
061: m_className = className;
062: }
063:
064: /**
065: * Construct a new <code>JicarillaClassNotFoundException</code> instance.
066: *
067: * @param className the class that could not be found.
068: */
069: public JicarillaClassNotFoundException(final String className) {
070: this (className, "The class '" + className
071: + "' is required for operation "
072: + "but it could not be found!");
073: }
074:
075: /**
076: * Construct a new <code>JicarillaClassNotFoundException</code> instance.
077: *
078: * @param throwable the root cause of the exception.
079: */
080: public JicarillaClassNotFoundException(final Throwable throwable) {
081: super (throwable);
082: }
083:
084: /**
085: * Construct a new <code>JicarillaClassNotFoundException</code> instance.
086: *
087: * @param className the class that could not be found.
088: * @param throwable the root cause of the exception.
089: */
090: public JicarillaClassNotFoundException(final String className,
091: final Throwable throwable) {
092: this (className, "The class '" + className
093: + "' is required for operation "
094: + "but it could not be found!", throwable);
095: }
096:
097: /**
098: * Construct a new <code>JicarillaClassNotFoundException</code> instance.
099: *
100: * @param className the class that could not be found.
101: * @param message the detail message for this exception.
102: * @param throwable the root cause of the exception.
103: */
104: public JicarillaClassNotFoundException(final String className,
105: final String message, final Throwable throwable) {
106: super (message, throwable);
107: if (className == null)
108: throw new NullPointerException("className");
109: m_className = className;
110: }
111:
112: /**
113: * Retrieve the name of the class that could not be found.
114: *
115: * @return the name of the class that could not be found.
116: */
117: public String getClassName() {
118: return m_className;
119: }
120: }
|