KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdi > internal > event > ExceptionEventImpl


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdi.internal.event;
12
13
14 import java.io.DataInputStream JavaDoc;
15 import java.io.IOException JavaDoc;
16
17 import org.eclipse.jdi.internal.LocationImpl;
18 import org.eclipse.jdi.internal.MirrorImpl;
19 import org.eclipse.jdi.internal.ObjectReferenceImpl;
20 import org.eclipse.jdi.internal.VirtualMachineImpl;
21 import org.eclipse.jdi.internal.request.RequestID;
22
23 import com.sun.jdi.Location;
24 import com.sun.jdi.ObjectReference;
25 import com.sun.jdi.event.ExceptionEvent;
26
27 /**
28  * this class implements the corresponding interfaces
29  * declared by the JDI specification. See the com.sun.jdi package
30  * for more information.
31  *
32  */

33 public class ExceptionEventImpl extends LocatableEventImpl implements ExceptionEvent {
34     /** Jdwp Event Kind. */
35     public static final byte EVENT_KIND = EVENT_EXCEPTION;
36
37     /** Thrown exception. */
38     private ObjectReferenceImpl fException;
39     /** Location of catch, or 0 if not caught. */
40     private LocationImpl fCatchLocation;
41
42     /**
43      * Creates new ExceptionEventImpl.
44      */

45     private ExceptionEventImpl(VirtualMachineImpl vmImpl, RequestID requestID) {
46         super("ExceptionEvent", vmImpl, requestID); //$NON-NLS-1$
47
}
48         
49     /**
50      * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
51      */

52     public static ExceptionEventImpl read(MirrorImpl target, RequestID requestID, DataInputStream JavaDoc dataInStream) throws IOException JavaDoc {
53         VirtualMachineImpl vmImpl = target.virtualMachineImpl();
54         ExceptionEventImpl event = new ExceptionEventImpl(vmImpl, requestID);
55         event.readThreadAndLocation(target, dataInStream);
56         event.fException = ObjectReferenceImpl.readObjectRefWithTag(target, dataInStream);
57         event.fCatchLocation = LocationImpl.read(target, dataInStream);
58         return event;
59     }
60
61     /**
62      * @return Returns the location where the exception will be caught.
63      */

64     public Location catchLocation() {
65         return fCatchLocation;
66     }
67     
68     /**
69      * @return Returns the thrown exception object.
70      */

71     public ObjectReference exception() {
72         return fException;
73     }
74 }
75
Popular Tags