The part that was removed upon commit actually introduced some logic
changes to the constructor to allow it to filter on all exceptions.
Here is another patch to correct the committed file.
2006-06-13 Kyle Galloway <[EMAIL PROTECTED]>
* gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: Changed
the constructor to allow null to be passed signifying all exceptions
should be allowed.
Keith Seitz wrote:
Kyle Galloway wrote:
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
This is approved with some slight modifications, which I've done for
you: whack gratuitous whitespace changes, and wrap to 80 columns. I've
attached what I've actually committed.
Keith
------------------------------------------------------------------------
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 -p -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
20:31:56 -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.
@@ -88,34 +88,29 @@ public class ExceptionOnlyFilter
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
+ {
+ Class klass = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS);
+ classMatch = klass == _refId.getType();
+ }
+ catch (InvalidClassException ex)
+ {
+ classMatch = false;
+ }
+
+ Boolean caught
+ = (Boolean) event.getParameter(Event.EVENT_EXCEPTION_CAUGHT);
+
+ return classMatch && (caught.booleanValue()) ? _caught : _uncaught;
}
}
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 13:47:21 -0000
@@ -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;