JavaTM 2 Platform
Standard Ed. 6

javax.xml.bind
类 JAXBException

java.lang.Object
  继承者 java.lang.Throwable
      继承者 java.lang.Exception
          继承者 javax.xml.bind.JAXBException
所有已实现的接口:
Serializable
直接已知子类:
MarshalException, PropertyException, UnmarshalException, ValidationException

public class JAXBException
extends Exception

这是所有 JAXB 异常的根异常类。

从以下版本开始:
JAXB1.0
另请参见:
JAXBContext, Marshaller, Unmarshaller, 序列化表格

构造方法摘要
JAXBException(String message)
          构造带指定详细消息的 JAXBException。
JAXBException(String message, String errorCode)
          构造带指定详细消息和特定于供应商的 errorCode 的 JAXBException。
JAXBException(String message, String errorCode, Throwable exception)
          构造带指定的详细消息、特定于供应商的 errorCode 和 linkedException 的 JAXBException。
JAXBException(String message, Throwable exception)
          构造带指定的详细消息和 linkedException 的 JAXBException。
JAXBException(Throwable exception)
          构造带有一个 linkedException 的 JAXBException。
 
方法摘要
 Throwable getCause()
          返回此 throwable 的 cause;如果 cause 不存在或未知,则返回 null
 String getErrorCode()
          获取特定于供应商的错误代码。
 Throwable getLinkedException()
          获取链接的异常。
 void printStackTrace()
          打印此 JAXBException 及其对 System.err 的堆栈跟踪(如果为非 null,则包括 linkedException 的堆栈跟踪)。
 void printStackTrace(PrintStream s)
          打印此 JAXBException 及其对 PrintStream 的堆栈跟踪(如果为非 null,则包括该 linkedException 的堆栈跟踪)。
 void printStackTrace(PrintWriter s)
          打印此 JAXBException 及其对 PrintWriter 的堆栈跟踪(如果为非 null,则包括该 linkedException 的堆栈跟踪)。
 void setLinkedException(Throwable exception)
          添加链接的异常。
 String toString()
          返回此 JAXBException 的简短描述。
 
从类 java.lang.Throwable 继承的方法
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

JAXBException

public JAXBException(String message)
构造带指定详细消息的 JAXBException。errorCode 和 linkedException 将默认为 null。

参数:
message - 对异常的描述

JAXBException

public JAXBException(String message,
                     String errorCode)
构造带指定详细消息和特定于供应商的 errorCode 的 JAXBException。linkedException 将默认为 null。

参数:
message - 对异常的描述
errorCode - 指定特定于供应商的错误代码的字符串

JAXBException

public JAXBException(Throwable exception)
构造带有一个 linkedException 的 JAXBException。详细消息和特定于供应商的 errorCode 将默认为 null。

参数:
exception - 链接的异常

JAXBException

public JAXBException(String message,
                     Throwable exception)
构造带指定的详细消息和 linkedException 的 JAXBException。errorCode 将默认为 null。

参数:
message - 对异常的描述
exception - 链接的异常

JAXBException

public JAXBException(String message,
                     String errorCode,
                     Throwable exception)
构造带指定的详细消息、特定于供应商的 errorCode 和 linkedException 的 JAXBException。

参数:
message - 对异常的描述
errorCode - 指定特定于供应商的错误代码的字符串
exception - 链接的异常
方法详细信息

getErrorCode

public String getErrorCode()
获取特定于供应商的错误代码。

返回:
指定特定于供应商的错误代码的字符串

getLinkedException

public Throwable getLinkedException()
获取链接的异常。

返回:
链接的异常;如果不存在,则返回 null

setLinkedException

public void setLinkedException(Throwable exception)
添加链接的异常。

参数:
exception - 链接的异常(允许使用 null 值,该值指示链接的异常不存在或者是未知的)。

toString

public String toString()
返回此 JAXBException 的简短描述。

覆盖:
Throwable 中的 toString
返回:
该 throwable 的字符串表示形式。

printStackTrace

public void printStackTrace(PrintStream s)
打印此 JAXBException 及其对 PrintStream 的堆栈跟踪(如果为非 null,则包括该 linkedException 的堆栈跟踪)。

覆盖:
Throwable 中的 printStackTrace
参数:
s - 用于输出的 PrintStream

printStackTrace

public void printStackTrace()
打印此 JAXBException 及其对 System.err 的堆栈跟踪(如果为非 null,则包括 linkedException 的堆栈跟踪)。

覆盖:
Throwable 中的 printStackTrace

printStackTrace

public void printStackTrace(PrintWriter s)
打印此 JAXBException 及其对 PrintWriter 的堆栈跟踪(如果为非 null,则包括该 linkedException 的堆栈跟踪)。

覆盖:
Throwable 中的 printStackTrace
参数:
s - 用于输出的 PrintWriter

getCause

public Throwable getCause()
从类 Throwable 复制的描述
返回此 throwable 的 cause;如果 cause 不存在或未知,则返回 null。(该 Cause 是导致抛出此 throwable 的throwable。)

此实现返回由一个需要 Throwable 的构造方法提供的 cause,或者在创建之后通过 Throwable.initCause(Throwable) 方法进行设置的 cause。虽然通常不需要重写此方法,但子类可以重写它,以返回一个通过某些其他方式设置的 cause。这适用于在异常链(异常嵌套)机制被加入到 Throwable 之前存在“遗留 Throwable 链机制”的情况。注意,不必 重写任何 PrintStackTrace 方法,所有方法都调用 getCause 方法来确定 throwable 的 cause。

覆盖:
Throwable 中的 getCause
返回:
此 throwable 的 cause,如果 cause 不存在或是未知的,则返回 null

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策