Hi Paul,
Thanks for confirming that as a bug; logged as Issue 196.
Cheers,
Steve
Paul Sandoz wrote:
> Hi Steve,
>
> This is a bug. Could you log an issue?
>
> Thanks,
> Paul.
>
> On Jan 27, 2009, at 6:36 PM, Steve Sims wrote:
>
>> Hi,
>>
>> I'm writing a series of tests and wanted to remove a client filter,
>> however I'm getting the following exception:
>>
>> com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler
>> cannot be cast to com.sun.jersey.api.client.filter.ClientFilter
>> java.lang.ClassCastException:
>> com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler
>> cannot be cast to com.sun.jersey.api.client.filter.ClientFilter
>> at
>> com.sun.jersey.api.client.filter.Filterable.removeFilter(Filterable.java:99)
>>
>>
>> I've been able to reproduce it using the following snippet of code,
>> although in the code that I first saw the behaviour in, I'm not using
>> an anonymous class or removing the filter immediately after adding it
>> of course ;-)
>>
>> Client client = Client.create();
>> ClientFilter filter = new ClientFilter() {
>> @Override
>> public ClientResponse handle(ClientRequest cr)
>> throws ClientHandlerException {
>> return getNext().handle(cr);
>> }
>> };
>> client.addFilter(filter);
>> client.removeFilter(filter);
>>
>> I'm using the version of Jersey that was installed through the
>> Netbeans 6.5 plugin manager (v1.0.2). In my case, I've only got the
>> one client filter attached to the client so as a workaround I can just
>> call Client.removeAllFilters() but I'd be interested to know whether
>> I'm doing something wrong or whether I should log a defect?
>>
>> Thanks,
>>
>> Steve
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>