Exception

来源:互联网 发布:pdf.js 编辑:程序博客网 时间:2024/05/23 19:17

 public static class ActionException extends RuntimeException {
        public ActionException(Exception ex) {
            super(ex);
        }
        public ActionException(String message) {
            super(message);
        }
    }

 

看到这样一段源码,使用的时候:  throw new ActionException("Tag " + tag + " not found");

 

我们有必要建立这样一些异常机制用在我们得工程中,增加程序的健壮性。追踪源码看到:

public class RuntimeException extends Exception

public class Exception extends Throwable

public class Throwable implements java.io.Serializable

 

这几个类所有的实现都是在Thowable中实现的,里面用到了StackTraceElement[ ]  stack;这个类,看源码后,里面注释如下:

A representation of a single stack frame. Arrays of StackTraceElement are stored inThrowable objects to represent the whole state of the call stack at the time aThrowable gets thrown

我的理解就是存储Throwable的一个数组对象。

 

 

原创粉丝点击