⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serviceexception.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
字号:
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */
package org.geoserver.platform;

import java.util.ArrayList;
import java.util.List;


/**
 *  Base class for exceptions generated by a service.
 *  <p>
 *  This class is based off the OGC idea of an exception, which contains
 *  a {@link #code}, and {@link #locator}. Futhermore optional fragments of
 *  {@link #exceptionText} may be associated with the exception.
 *  </p>
 *
 * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
 *
 */
public class ServiceException extends RuntimeException {
    /**
     * Serial UID
     */
    private static final long serialVersionUID = 7254349181794561723L;

    /**
     * Application specfic code.
     */
    String code;

    /**
     * Application specific locator
     */
    String locator;

    /**
     * List of text recording information about the exception
     */
    List exceptionText = new ArrayList();

    /**
     * Constructs the exception from a message.
     *
     * @param message The message describing the exception.
     */
    public ServiceException(String message) {
        super(message);
    }

    /**
     * Constructs the exception from a message and causing exception.
     *
     * @param message The message describing the exception.
     * @param cause The case of the exception.
     */
    public ServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * Constructs the exception from a message, causing exception, and code.
     *
     * @param message The message describing the exception.
     * @param cause The case of the exception.
     * @param code The application specific exception code for the exception.
     */
    public ServiceException(String message, Throwable cause, String code) {
        this(message, cause);
        this.code = code;
    }

    /**
     * Constructs the exception from a message, causing exception, code, and
     * locator.
     *
     * @param message The message describing the exception.
     * @param cause The case of the exception.
     * @param code The application specific exception code for the exception.
     * @param locator The application specific locator for the exception.
     */
    public ServiceException(String message, Throwable cause, String code, String locator) {
        this(message, cause, code);
        this.locator = locator;
    }

    /**
     * Constructs the exception from a message, and code.
     *
     * @param message The message describing the exception.
     * @param code The application specific exception code for the exception.
     */
    public ServiceException(String message, String code) {
        super(message);
        this.code = code;
    }

    /**
     * Constructs the exception from a message,code, and
     * locator.
     *
     * @param message The message describing the exception.
     * @param code The application specific exception code for the exception.
     * @param locator The application specific locator for the exception.
     */
    public ServiceException(String message, String code, String locator) {
        this(message, code);
        this.locator = locator;
    }

    /**
     * Constructs the exception from a causing exception.
     *
     * @param cause The case of the exception.
     */
    public ServiceException(Throwable cause) {
        super(cause);
    }

    /**
     * Constructs the exception from causing exception, and code.
     *
     * @param cause The case of the exception.
     * @param code The application specific exception code for the exception.
     */
    public ServiceException(Throwable cause, String code) {
        this(cause);
        this.code = code;
    }

    /**
     * Constructs the exception from a causing exception, code, and locator.
     *
     * @param cause The case of the exception.
     * @param code The application specific exception code for the exception.
     * @param locator The application specific locator for the exception.
     */
    public ServiceException(Throwable cause, String code, String locator) {
        this(cause, code);
        this.locator = locator;
    }

    /**
     * @return The application specifc code of the exception.
     */
    public String getCode() {
        return code;
    }

    /**
     * Sets the code for the exception.
     *
     * @param code The application specific code.
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @return The application specific locator.
     */
    public String getLocator() {
        return locator;
    }

    /**
     * Sets the locator for the exception.
     *
     * @return The application specific locator.
     */
    public void setLocator(String locator) {
        this.locator = locator;
    }

    /**
     * Returns the list of text fragments which provide additonal information
     * about the exception.
     * <p>
     * Text fragements may be added directly to the list with:
     * <code>
     * exception.getExceptionTest().add( "text fragment" );
     * </code>
     * </p>
     * @return A list of String recording information about the exception.
     */
    public List getExceptionText() {
        return exceptionText;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -