classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Re: [commit-cp] classpath ./ChangeLog vm/reference/gnu/clas


From: Keith Seitz
Subject: [cp-patches] Re: [commit-cp] classpath ./ChangeLog vm/reference/gnu/classpat...
Date: Fri, 16 Dec 2005 15:17:07 -0800
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

Mark Wielaard wrote:

Please fix.

Indeed! I got a little ahead of myself. I've committed the attached patch which should fix it. (This time I even waited for the build to finish. O:-)

Keith

2005-12-16  Keith Seitz  <address@hidden>

        * 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.
Index: gnu/classpath/jdwp/Jdwp.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.1
diff -u -p -r1.1 Jdwp.java
--- gnu/classpath/jdwp/Jdwp.java        3 Sep 2005 00:17:50 -0000       1.1
+++ gnu/classpath/jdwp/Jdwp.java        16 Dec 2005 23:10:32 -0000
@@ -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)
       {
Index: gnu/classpath/jdwp/event/EventManager.java
===================================================================
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/event/EventManager.java,v
retrieving revision 1.2
diff -u -p -r1.2 EventManager.java
--- gnu/classpath/jdwp/event/EventManager.java  2 Sep 2005 20:48:25 -0000       
1.2
+++ gnu/classpath/jdwp/event/EventManager.java  16 Dec 2005 23:10:32 -0000
@@ -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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]