All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.boot.transport.CommunicationException Maven / Gradle / Ivy

There is a newer version: 1.16.0
Show newest version
/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

/*
 * Created on 16.05.2003
 */
package at.spardat.xma.boot.transport;

import java.io.IOException;

/**
 * Thrown by Transport, if anything goes wrong in the communication with the server.
 *
 * @author s2877
 * @version $Id: CommunicationException.java 2084 2007-11-27 14:53:31Z s3460 $
 */
public class CommunicationException extends IOException {
    /** the http-returncode of the failed communication */
    int returnCode;

    /**
     * Constructs an CommunicationException with the specified detail
     * Exception. The message of the detail exception is used as message of the
     * CommunicationException.
     *
     * @param exc the detail exception.
     */
    public CommunicationException(Exception exc) {
        super(exc.toString());
        initCause(exc);
    }

    /**
     * Constructs an CommunicationException with the specified detail
     * message.
     *
     * @param   message the detail message.
     */
    public CommunicationException(String message) {
        super(message);
    }

    /**
     * Constructs an CommunicationException with the specified mesage and detail
     * Exception.
     *
     * @param   message the detail message.
     * @param exc the detail exception.
     */
    public CommunicationException(String message,Exception exc) {
        super(message);
        initCause(exc);
    }

    /**
     * Constructs an CommunicationException with the specified message, detail
     * Exception and Http-Returncode. The message of the CommunicationException
     * is composed of the detail message and the returncode.
     *
     * @param message the detail message
     * @param exc the detail exception
     * @param returnCode the HTTP-Returncode send by the server
     */
    public CommunicationException(String message,Exception exc,int returnCode) {
        super(returnCode==0 ? message : message+", return code: "+Integer.toString(returnCode)); //$NON-NLS-1$
        initCause(exc);
        this.returnCode=returnCode;
    }

    /**
     * Constructs an CommunicationException with the specified detail
     * Exception and Http-Returncode. The message of the CommunicationException
     * is composed of the message of the detail exception and the returncode.
     *
     * @param exc the detail exception
     * @param returnCode the HTTP-Returncode send by the server
     */
    public CommunicationException(Exception exc,int returnCode) {
        super(returnCode==0 ? exc.toString() : exc.toString()+", return code: "+Integer.toString(returnCode)); //$NON-NLS-1$
        initCause(exc);
        this.returnCode=returnCode;
    }

    /**
     * Constructs an CommunicationException with the specified detail
     * message and Http-Returncode. The message of the CommunicationException
     * is composed of the detail message and the returncode.
     *
     * @param message the detail message
     * @param returnCode the HTTP-Returncode send by the server
     */
    public CommunicationException(String message,int returnCode) {
        super(returnCode==0 ? message : message+", return code: "+Integer.toString(returnCode)); //$NON-NLS-1$
        this.returnCode=returnCode;
    }

    /**
     * Constructs an CommunicationException with the specified Http-Returncode.
     * The message of the CommunicationException
     * is composed of the returncode.
     *
     * @param returnCode the HTTP-Returncode send by the server
     */
    public CommunicationException(int returnCode) {
        super("return code: "+Integer.toString(returnCode)); //$NON-NLS-1$
        this.returnCode=returnCode;
    }


    /**
     * @return Returns the returnCode.
     */
    public int getReturnCode() {
        return returnCode;
    }
    /**
     * @param returnCode The returnCode to set.
     */
    public void setReturnCode(int returnCode) {
        this.returnCode = returnCode;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy