view geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java @ 1127:ebeb56428409

Added license headers and license file. geo-backend/trunk@1261 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:52:22 +0000
parents d674cef2ca0d
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

package de.intevation.gnv.geobackend.base.connectionpool.exception;

import com.esri.sde.sdk.client.SeError;
import com.esri.sde.sdk.client.SeException;

import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;

import org.apache.log4j.Logger;

/**
 * The class <code>lConnectionException</code> fulfills the following purposes:
 *
 * @author blume
 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
 */
public class ConnectionException extends TechnicalException {

    /**
     * The UID of this Class.
     */
    private static final long serialVersionUID = 102459262123219617L;

    /**
     * Default Logging instance
     */
    private static Logger sLogger = Logger.getLogger(ConnectionException.class);

    /**
     * Constructs a new exception with <code>null</code> as its detail message.
     * The cause is not initialized, and may subsequently be initialized by a
     * call to {@link #initCause}.
     */
    public ConnectionException() {
    }

    /**
     * Constructs a new exception with the specified detail message.  The
     * cause is not initialized, and may subsequently be initialized by
     * a call to {@link #initCause}.
     *
     * @param message the detail message. The detail message is saved for
     *                later retrieval by the {@link #getMessage()} method.
     */
    public ConnectionException(String message) {
        super(message);
    }

    /**
     * Constructor
     * @param pCause the Throwable which cause this exception
     */
    public ConnectionException(Throwable pCause) {
        super(pCause);
    }

    /**
     * Constructs a new exception with the specified detail message and
     * cause.  <p>Note that the detail message associated with
     * <code>cause</code> is <i>not</i> automatically incorporated in
     * this exception's detail message.
     *
     * @param message the detail message (which is saved for later retrieval
     *                by the {@link #getMessage()} method).
     * @param cause   the cause (which is saved for later retrieval by the
     *                {@link #getCause()} method).  (A <tt>null</tt> value is
     *                permitted, and indicates that the cause is nonexistent or
     *                unknown.)
     * @since 1.4
     */
    public ConnectionException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * Displays the details of an SeException (if available).
     *
     */
    public void printError() {
        if (getCause() != null && getCause() instanceof SeException) {
            SeException exception = (SeException) getCause();
            SeError error = exception.getSeError();

            sLogger.debug("\n ArcSDE Error Number        : " + error.getSdeError());
            sLogger.debug(" Error Description          : " + error.getErrDesc());

            int extError = error.getExtError();
            if (extError != 0)
                sLogger.debug(" Extended Error Number      : " + extError);

            String desc = error.getSdeErrMsg();
            if (desc != null && desc.length() != 0)
                sLogger.debug(" Extended Error Description : " + desc);

            desc = error.getExtErrMsg();
            if (desc != null && desc.length() != 0)
                sLogger.debug(" Extended Error Description : " + desc);

            sLogger.debug(exception);

        }

    }
}

http://dive4elements.wald.intevation.org