Yeah, sorry, should have seen that before, I think when I changed the logic to compress it I may have destroyed that functionality. Anyways fixed now.

2006-06-13  Kyle Galloway <[EMAIL PROTECTED]>

   * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: Allow
   null refId.
   (matches): Filter on all exceptions.

Keith Seitz wrote:
Kyle Galloway wrote:
2006-06-13  Kyle Galloway <[EMAIL PROTECTED]>

    * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: Allow
   null refId.

Grr. I really hate to do this, but I just noticed... ExceptionOnlyFilter.matches doesn't handle the case where _refId is null.

Since you're updating ExceptionOnlyFilter to properly handle the "all exceptions" case, could you also update the matches method?

My bad,
Keith

Index: ExceptionOnlyFilter.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java,v
retrieving revision 1.3
diff -u -r1.3 ExceptionOnlyFilter.java
--- ExceptionOnlyFilter.java	12 Jun 2006 20:39:16 -0000	1.3
+++ ExceptionOnlyFilter.java	13 Jun 2006 16:14:53 -0000
@@ -61,7 +61,7 @@
   /**
    * Constructs a new ExceptionOnlyFilter
    *
-   * @param  refId     ID of the exception to report
+   * @param  refId     ID of the exception to report(null for all exceptions)
    * @param  caught    Report caught exceptions
    * @param  uncaught  Report uncaught exceptions
    * @throws InvalidClassException if refid is invalid
@@ -70,8 +70,8 @@
 			      boolean uncaught)
     throws InvalidClassException
   {
-    if (refId == null || refId.getReference().get () == null)
-      throw new InvalidClassException (refId.getId ());
+    if (refId != null && refId.getReference().get() == null)
+      throw new InvalidClassException(refId.getId());
 
     _refId = refId;
     _caught = caught;
@@ -91,26 +91,33 @@
   
   /**
    * Does the given event match the filter?
-   *
-   * @param event  the <code>Event</code> to scrutinize
+   * 
+   * @param event the <code>Event</code> to scrutinize
    */
   public boolean matches(Event event)
   {
-    boolean classMatch;
-    
-    try
-      {
-	Class klass = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS);
-        classMatch = klass == _refId.getType();
-      }
-    catch (InvalidClassException ex)
+    boolean classMatch = true;
+
+    // if not allowing all exceptions check if the exception matches
+    if (_refId != null)
       {
-        classMatch = false;
+        try
+          {
+            Class klass 
+              = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS);
+            classMatch = klass == _refId.getType();
+          }
+        catch (InvalidClassException ex)
+          {
+            classMatch = false;
+          }
       }
     
-    Boolean caught
+    // check against the caught and uncaught options
+    Boolean caught 
       = (Boolean) event.getParameter(Event.EVENT_EXCEPTION_CAUGHT);
 
     return classMatch && (caught.booleanValue()) ? _caught : _uncaught;
   }
+  
 }

Reply via email to