leosimons 2002/09/08 05:16:04
Added: assembly/src/java/org/apache/excalibur/merlin/activation
ActivationException.java
ActivationRuntimeException.java
Log:
add missing exception classes.
Revision Changes Path
1.1
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/activation/ActivationException.java
Index: ActivationException.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.merlin.assembly;
import java.util.Enumeration;
import java.util.Dictionary;
import java.util.Hashtable;
import org.apache.avalon.framework.CascadingException;
/**
* Exception to indicate that there was an error during activation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leo Simons</a>
* @version $Revision: 1.1 $
*/
public class ActivationException
extends CascadingException
{
private static final Hashtable EMPTY_TABLE = new Hashtable();
private Dictionary m_errors;
/**
* Construct a new <code>ActivationException</code> instance.
*
* @param message The detail message for this exception.
*/
public ActivationException( final String message )
{
this( null, message, null );
}
/**
* Construct a new <code>AssemblyRuntimeException</code> instance.
*
* @param errors a list of warning messages related to the exception.
* @param message The detail message for this exception.
*/
public ActivationException( final Dictionary errors, final String message )
{
this( errors, message, null );
}
/**
* Construct a new <code>ActivationException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public ActivationException( final String message, final Throwable throwable )
{
this( null, message, throwable );
}
/**
* Construct a new <code>ActivationException</code> instance.
*
* @param errors a list of warning messages related to the exception.
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public ActivationException( final Dictionary errors, final String message,
final Throwable throwable )
{
super( message, throwable );
if( errors != null )
{
m_errors = errors;
}
else
{
m_errors = EMPTY_TABLE;
}
}
/**
* Return the table of supplimentary messages.
* @return the messages table
*/
public Dictionary getDictionary()
{
return m_errors;
}
/**
* Returns a stringified representation of the exception.
* @return the exception as a string.
*/
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append( super.toString() );
buffer.append( " Errors: " + m_errors.size() );
Enumeration keys = m_errors.keys();
while( keys.hasMoreElements() )
{
Object key = keys.nextElement();
buffer.append( "\n source: " + key.toString() + " cause: " +
m_errors.get( key ) );
}
return buffer.toString();
}
}
1.1
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/activation/ActivationRuntimeException.java
Index: ActivationRuntimeException.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.merlin.activation;
import java.util.Enumeration;
import java.util.Dictionary;
import java.util.Hashtable;
import org.apache.avalon.framework.CascadingRuntimeException;
/**
* Exception to indicate that there was a runtime error during activation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leo Simons</a>
* @version $Revision: 1.1 $
*/
public final class ActivationRuntimeException
extends CascadingRuntimeException
{
private static final Hashtable EMPTY_TABLE = new Hashtable();
private Dictionary m_errors;
/**
* Construct a new <code>ActivationRuntimeException</code> instance.
*
* @param message The detail message for this exception.
*/
public ActivationRuntimeException( final String message )
{
this( null, message, null );
}
/**
* Construct a new <code>ActivationRuntimeException</code> instance.
*
* @param errors a list of warning messages related to the exception.
* @param message The detail message for this exception.
*/
public ActivationRuntimeException( final Dictionary errors, final String message
)
{
this( errors, message, null );
}
/**
* Construct a new <code>ActivationRuntimeException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public ActivationRuntimeException( final String message, final Throwable
throwable )
{
this( null, message, throwable );
}
/**
* Construct a new <code>ActivationRuntimeException</code> instance.
*
* @param errors a list of warning messages related to the exception.
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public ActivationRuntimeException( final Dictionary errors, final String message,
final Throwable throwable )
{
super( message, throwable );
if( errors != null )
{
m_errors = errors;
}
else
{
m_errors = EMPTY_TABLE;
}
}
/**
* Return the table of supplimentary messages.
* @return the messages table
*/
public Dictionary getDictionary()
{
return m_errors;
}
/**
* Returns a stringified representation of the exception.
* @return the exception as a string.
*/
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append( super.toString() );
buffer.append( " Errors: " + m_errors.size() );
Enumeration keys = m_errors.keys();
while( keys.hasMoreElements() )
{
Object key = keys.nextElement();
buffer.append( "\n source: " + key.toString() + " cause: " +
m_errors.get( key ) );
}
return buffer.toString();
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>