//==============================================================================
// FTPException.java
//==============================================================================
package tribble.net.ftp;
// System imports
import java.io.IOException;
import java.lang.Exception;
import java.lang.String;
import java.lang.Throwable;
/*******************************************************************************
* Simple FTP exception.
* Represents the exceptions thrown by FTP clients and servers.
*
*
* @version $Revision: 1.2 $ $Date: 2006/06/03 20:20:57 $
* @since 2006-05-09
* @author
* David R. Tribble
* (david@tribble.com).
*
*
* Copyright ©2006 by David R. Tribble, all rights reserved.
* Permission is granted to any person or entity except those designated
* by the United States Department of State as a terrorist, or terrorist
* government or agency, to use and distribute this source code provided
* that the original copyright notice remains present and unaltered.
*
* @see FTPClientI
* @see FTPClientAdapter
* @see FTPClient
*/
public class FTPException
extends java.io.IOException
{
// Identification
/** Revision information. */
static final String REV =
"@(#)tribble/net/ftp/FTPException.java $Revision: 1.2 $ $Date: 2006/06/03 20:20:57 $\n";
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Variables
/** Exception that caused this exception (may be null). */
private Throwable m_cause;
/** FTP error code associated with this exception (may be zero). */
private int m_code;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Constructors
/***************************************************************************
* Default constructor.
*
* @since 1.1, 2006-05-09
*/
public FTPException()
{
}
/***************************************************************************
* Constructor.
*
* @param msg
* Message detailing this exception.
*
* @since 1.1, 2006-05-09
*/
public FTPException(String msg)
{
super(msg);
}
/***************************************************************************
* Constructor.
*
* @param code
* FTP error code.
*
* @param msg
* Message detailing this exception.
*
* @since 1.2, 2006-06-03
*/
public FTPException(int code, String msg)
{
super(msg);
m_code = code;
}
/***************************************************************************
* Constructor.
*
* @param cause
* Exception that caused this exception.
*
* @since 1.1, 2006-05-09
*/
public FTPException(Throwable cause)
{
super(cause != null ? cause.toString() : null);
m_cause = cause;
}
/***************************************************************************
* Constructor.
*
* @param msg
* Message detailing this exception.
*
* @param cause
* Exception that caused this exception.
*
* @since 1.1, 2006-05-09
*/
public FTPException(String msg, Throwable cause)
{
super(msg);
m_cause = cause;
}
/***************************************************************************
* Constructor.
*
* @param code
* FTP error code.
*
* @param msg
* Message detailing this exception.
*
* @param cause
* Exception that caused this exception.
*
* @since 1.2, 2006-06-03
*/
public FTPException(int code, String msg, Throwable cause)
{
super(msg);
m_code = code;
m_cause = cause;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods
/***************************************************************************
* Retrieve the exception that caused this exception.
*
* @return
* Causing exception, or null if this exception has none.
*
* @since 1.1, 2006-05-09
*/
public Throwable getCause()
{
return (m_cause);
}
/***************************************************************************
* Retrieve the FTP error code associated with this exception.
*
* @return
* FTP error code, or zero if this exception has none.
*
* @since 1.2, 2006-06-03
*/
public int getErrorCode()
{
return (m_code);
}
}
// End FTPException.java