[cp-patches] Re: RFA JDWP ExceptionOnlyFilter

Kyle Galloway kgallowa at redhat.com
Tue Jun 13 13:58:01 UTC 2006


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 <kgallowa at redhat.com>

  * 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 <kgallowa at redhat.com>
>>
>>   * 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;
>    }
>  }
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 746 bytes
Desc: not available
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20060613/5d34f98f/patch.bin


More information about the Classpath-patches mailing list