KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > tools > example > debug > event > ExceptionEventSet


1 /*
2  * @(#)ExceptionEventSet.java 1.9 05/11/17
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 /*
8  * Copyright (c) 1997-1999 by Sun Microsystems, Inc. All Rights Reserved.
9  *
10  * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
11  * modify and redistribute this software in source and binary code form,
12  * provided that i) this copyright notice and license appear on all copies of
13  * the software; and ii) Licensee does not utilize the software in a manner
14  * which is disparaging to Sun.
15  *
16  * This software is provided "AS IS," without a warranty of any kind. ALL
17  * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
18  * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
19  * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
20  * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
21  * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
22  * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
23  * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
24  * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
25  * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGES.
27  *
28  * This software is not designed or intended for use in on-line control of
29  * aircraft, air traffic, aircraft navigation or aircraft communications; or in
30  * the design, construction, operation or maintenance of any nuclear
31  * facility. Licensee represents and warrants that it will not use or
32  * redistribute the Software for such purposes.
33  */

34
35 package com.sun.tools.example.debug.event;
36
37 import com.sun.jdi.*;
38 import com.sun.jdi.event.*;
39
40 public class ExceptionEventSet extends LocatableEventSet {
41     
42     ExceptionEventSet(EventSet jdiEventSet) {
43         super(jdiEventSet);
44     }
45
46     /**
47      * Gets the thrown exception object. The exception object is
48      * an instance of java.lang.Throwable or a subclass in the
49      * target VM.
50      *
51      * @return an {@link ObjectReference} which mirrors the thrown object in
52      * the target VM.
53      */

54     public ObjectReference getException() {
55         return ((ExceptionEvent)oneEvent).exception();
56     }
57     
58     /**
59      * Gets the location where the exception will be caught. An exception
60      * is considered to be caught if, at the point of the throw, the
61      * current location is dynamically enclosed in a try statement that
62      * handles the exception. (See the JVM specification for details).
63      * If there is such a try statement, the catch location is the
64      * first code index of the appropriate catch clause.
65      * <p>
66      * If there are native methods in the call stack at the time of the
67      * exception, there are important restrictions to note about the
68      * returned catch location. In such cases,
69      * it is not possible to predict whether an exception will be handled
70      * by some native method on the call stack.
71      * Thus, it is possible that exceptions considered uncaught
72      * here will, in fact, be handled by a native method and not cause
73      * termination of the target VM. Also, it cannot be assumed that the
74      * catch location returned here will ever be reached by the throwing
75      * thread. If there is
76      * a native frame between the current location and the catch location,
77      * the exception might be handled and cleared in that native method
78      * instead.
79      *
80      * @return the {@link Location} where the exception will be caught or null if
81      * the exception is uncaught.
82      */

83     public Location getCatchLocation() {
84         return ((ExceptionEvent)oneEvent).catchLocation();
85     }
86
87     public void notify(JDIListener listener) {
88         listener.exception(this);
89     }
90 }
91
92
Popular Tags