/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.framework.component;
import org.apache.avalon.framework.CascadingException;
The exception thrown to indicate a problem with Components.
It is usually thrown by ComponentManager or ComponentSelector.
Deprecated: Use ServiceException
instead.
Author: Avalon Development Team Version: $Id: ComponentException.java 506231 2007-02-12 02:36:54Z crossley $
/**
* The exception thrown to indicate a problem with Components.
* It is usually thrown by ComponentManager or ComponentSelector.
*
* <p>
* <span style="color: red">Deprecated: </span><i>
* Use {@link org.apache.avalon.framework.service.ServiceException} instead.
* </i>
* </p>
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Id: ComponentException.java 506231 2007-02-12 02:36:54Z crossley $
*/
public class ComponentException
extends CascadingException
{
private final String m_key;
Construct a new ComponentException
instance.
Params: - key – the lookup key
- message – the exception message
- throwable – the throwable
/**
* Construct a new <code>ComponentException</code> instance.
* @param key the lookup key
* @param message the exception message
* @param throwable the throwable
*/
public ComponentException( final String key,
final String message,
final Throwable throwable )
{
super( message, throwable );
m_key = key;
}
Construct a new ComponentException
instance.
Params: - message – the exception message
- throwable – the throwable
Deprecated: use the String, String, Throwable version to record the role
/**
* Construct a new <code>ComponentException</code> instance.
*
* @deprecated use the String, String, Throwable version to record the role
* @param message the exception message
* @param throwable the throwable
*/
public ComponentException( final String message, final Throwable throwable )
{
this( null, message, throwable );
}
Construct a new ComponentException
instance.
Params: - message – the exception message
Deprecated: use the String, String version to record the role
/**
* Construct a new <code>ComponentException</code> instance.
*
* @deprecated use the String, String version to record the role
* @param message the exception message
*/
public ComponentException( final String message )
{
this( null, message, null );
}
Construct a new ComponentException
instance.
Params: - key – the lookup key
- message – the exception message
/**
* Construct a new <code>ComponentException</code> instance.
* @param key the lookup key
* @param message the exception message
*/
public ComponentException( final String key, final String message )
{
this( key, message, null );
}
Get the key which let to the exception. May be null.
Returns: The key which let to the exception.
/**
* Get the key which let to the exception. May be null.
*
* @return The key which let to the exception.
*/
public final String getKey()
{
return m_key;
}
Get the key which let to the exception. May be null.
Returns: The key which let to the exception. Deprecated: Use getKey instead
/**
* Get the key which let to the exception. May be null.
*
* @return The key which let to the exception.
* @deprecated Use getKey instead
*/
public final String getRole()
{
return getKey();
}
Return a message describing the exception.
Returns: exception message.
/**
* Return a message describing the exception.
*
* @return exception message.
*/
public String getMessage()
{
if( m_key == null )
{
return super.getMessage();
}
else
{
return super.getMessage() + " (key [" + m_key + "])";
}
}
}