diff options
author | Keith Seitz <keiths@redhat.com> | 2005-12-16 23:15:53 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2005-12-16 23:15:53 +0000 |
commit | a542c81ec7bbc25c3bf628296ae0795575d06b4b (patch) | |
tree | 6fdb27b820975a9e8e6ef85f32550c772a383f40 /gnu/classpath | |
parent | d81da9a927de0fffaf761f4c659c56f4fdcfcaf1 (diff) | |
download | classpath-a542c81ec7bbc25c3bf628296ae0795575d06b4b.tar.gz |
* gnu/classpath/jdwp/event/EventManager.java (EventManager): Catch
all JdwpExceptions when initializing the event table.
(requestEvent): Update to allow throwing JdwpException from
VMVirtualMachine methods.
(deleteRequest): Likewise.
(clearRequests): Likewise.
* gnu/classpath/jdwp/Jdwp.java (notify): Catch exceptions
from sendEvent and _enforceSuspendPolicy.
(sendEvent): Do not catch IOException here.
(_enforceSuspendPolicy): Update to allow throwing JdwpException
from VMVirtualMachine methods.
Diffstat (limited to 'gnu/classpath')
-rw-r--r-- | gnu/classpath/jdwp/Jdwp.java | 35 | ||||
-rw-r--r-- | gnu/classpath/jdwp/event/EventManager.java | 10 |
2 files changed, 29 insertions, 16 deletions
diff --git a/gnu/classpath/jdwp/Jdwp.java b/gnu/classpath/jdwp/Jdwp.java index bb8f60224..43a37de24 100644 --- a/gnu/classpath/jdwp/Jdwp.java +++ b/gnu/classpath/jdwp/Jdwp.java @@ -42,6 +42,7 @@ package gnu.classpath.jdwp; import gnu.classpath.jdwp.event.Event; import gnu.classpath.jdwp.event.EventManager; import gnu.classpath.jdwp.event.EventRequest; +import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.id.ThreadId; import gnu.classpath.jdwp.processor.PacketProcessor; import gnu.classpath.jdwp.transport.ITransport; @@ -206,7 +207,20 @@ public class Jdwp EventManager em = EventManager.getDefault (); EventRequest request = em.getEventRequest (event); if (request != null) - sendEvent (request, event); + { + try + { + System.out.println ("Jdwp.notify: sending event " + event); + sendEvent (request, event); + jdwp._enforceSuspendPolicy (request.getSuspendPolicy ()); + } + catch (Exception e) + { + /* Really not much we can do. For now, just print out + a warning to the user. */ + System.out.println ("Jdwp.notify: caught exception: " + e); + } + } } } @@ -217,32 +231,25 @@ public class Jdwp * * @param request the debugger request for the event * @param event the event to send + * @throws IOException if a communications failure occurs */ public static void sendEvent (EventRequest request, Event event) + throws IOException { Jdwp jdwp = getDefault (); if (jdwp != null) { - try - { - // !! May need to implement send queue? - synchronized (jdwp._connection) - { - jdwp._connection.sendEvent (request, event); - } - - // Follow suspend policy - jdwp._enforceSuspendPolicy (request.getSuspendPolicy ()); - } - catch (IOException ie) + // !! May need to implement send queue? + synchronized (jdwp._connection) { - System.out.println ("Jdwp.notify: caught exception: " + ie); + jdwp._connection.sendEvent (request, event); } } } // Helper function to enforce suspend policies on event notification private void _enforceSuspendPolicy (byte suspendPolicy) + throws JdwpException { switch (suspendPolicy) { diff --git a/gnu/classpath/jdwp/event/EventManager.java b/gnu/classpath/jdwp/event/EventManager.java index 436a544eb..82d1d71e4 100644 --- a/gnu/classpath/jdwp/event/EventManager.java +++ b/gnu/classpath/jdwp/event/EventManager.java @@ -41,6 +41,7 @@ package gnu.classpath.jdwp.event; import gnu.classpath.jdwp.VMVirtualMachine; import gnu.classpath.jdwp.exception.InvalidEventTypeException; +import gnu.classpath.jdwp.exception.JdwpException; import java.util.Collection; import java.util.Hashtable; @@ -133,7 +134,7 @@ public class EventManager EventRequest.EVENT_VM_DEATH, EventRequest.SUSPEND_NONE)); } - catch (InvalidEventTypeException e) + catch (JdwpException e) { // This can't happen } @@ -187,9 +188,10 @@ public class EventManager * * @param request the request to monitor * @throws InvalidEventTypeException for invalid event kind + * @throws JdwpException for other errors involving request */ public void requestEvent (EventRequest request) - throws InvalidEventTypeException + throws JdwpException { // Add request to request list Hashtable requests; @@ -212,8 +214,10 @@ public class EventManager * @param kind the event kind * @param id the ID of the request to delete * @throws IllegalArgumentException for invalid event kind + * @throws JdwpException for other errors deleting request */ public void deleteRequest (byte kind, int id) + throws JdwpException { Hashtable requests; requests = (Hashtable) _requests.get (new Byte (kind)); @@ -237,8 +241,10 @@ public class EventManager * * @param kind the event kind * @throws IllegalArgumentException for invalid event kind + * @throws JdwpException for error clearing events */ public void clearRequests (byte kind) + throws JdwpException { Hashtable requests = (Hashtable) _requests.get (new Byte (kind)); if (requests == null) |