Implements the ExceptionOnlyFilter.matches() method in JDWP and removes two useless accessor methods in that class.
Requesting approval and a commit.

Kyle

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

  * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
  (forCaught): removed useless accessor method
  (forUncaught): removed useless accessor method
  (matches): Implemented


Index: gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java,v
retrieving revision 1.2
diff -u -r1.2 ExceptionOnlyFilter.java
--- gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java	9 Mar 2006 23:18:29 -0000	1.2
+++ gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java	12 Jun 2006 15:20:00 -0000
@@ -1,5 +1,5 @@
-/* ExceptionOnlyFilter.java -- 
-   Copyright (C) 2005 Free Software Foundation
+/* ExceptionOnlyFilter.java -- filter for excetions by caught/uncaught and type
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -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;
@@ -88,34 +88,27 @@
     return _refId;
   }
 
-  /**
-   * Report caught exceptions?
-   *
-   * @return whether to report caught exceptions
-   */
-  public boolean forCaught ()
-  {
-    return _caught;
-  }
-
-  /**
-   * Report uncaught exceptions?
-   *
-   * @return whether to report uncaught exceptions
-   */
-  public boolean forUncaught ()
-  {
-    return _uncaught;
-  }
-
+  
   /**
    * Does the given event match the filter?
    *
    * @param event  the <code>Event</code> to scrutinize
    */
-  public boolean matches (Event event)
+  public boolean matches(Event event)
   {
-    // FIXME
-    throw new RuntimeException ("ExceptionOnlyFilter.matches not implemented");
+    boolean classMatch;
+    
+    try
+      {
+        classMatch = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS) == _refId.getType();
+      }
+    catch (InvalidClassException ex)
+      {
+        classMatch = false;
+      }
+    
+    Boolean caught = (Boolean) event.getParameter(Event.EVENT_EXCEPTION_CAUGHT);
+
+    return classMatch && (caught.booleanValue()) ? _caught : _uncaught;
   }
 }

Reply via email to