mimeexception.java

来自「封装了SQL、Socket、WAP、MIME等功能的通用组件」· Java 代码 · 共 90 行

JAVA
90
字号
package org.lazybug.mime;

import java.io.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class MimeException extends IOException
{
    private IOException next;

    public MimeException()
    {
    }

    public MimeException(String s)
    {
        super(s);
    }

    public MimeException(String s, IOException exception)
    {
        super(s);
        next = exception;
    }

    public Exception getNextException()
    {
        return next;
    }

    public synchronized boolean setNextException(IOException exception)
    {
        Object obj;
        for(obj = this; (obj instanceof MimeException) && ((MimeException)obj).next != null; obj = ((MimeException)obj).next);
        if(obj instanceof MimeException)
        {
            ((MimeException)obj).next = exception;
            return true;
        } else
        {
            return false;
        }
    }

    public String getMessage()
    {
        if(next == null)
            return super.getMessage();
        Exception exception = next;
        String s = super.getMessage();
        StringBuffer stringbuffer = new StringBuffer(s != null ? s : "");
        while(exception != null)
        {
            stringbuffer.append(";\n  nested exception is:\n\t");
            if(exception instanceof MimeException)
            {
                MimeException messagingexception = (MimeException)exception;
                stringbuffer.append(exception.getClass().toString());
                String s1 = messagingexception.getSuperMessage();
                if(s1 != null)
                {
                    stringbuffer.append(": ");
                    stringbuffer.append(s1);
                }
                exception = messagingexception.next;
            } else
            {
                stringbuffer.append(exception.toString());
                exception = null;
            }
        }
        return stringbuffer.toString();
    }

    private String getSuperMessage()
    {
        return super.getMessage();
    }
}

⌨️ 快捷键说明

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