Hi.
I'm using the 3.0.4-SNAPSHOT version of CXF due to the latest fixes within the 
client proxy code.
As I continued with my development, I stumbled across another issue regarding 
the proxy:

Using:
Client client = WebClient.client(proxy);
WebClient httpClient = WebClient.fromClient(client);

or calling directly fromClientObject() on WebClient leads to this:

java.lang.NullPointerException
    at org.apache.cxf.jaxrs.client.WebClient.copyProperties(WebClient.java:1238)
    at org.apache.cxf.jaxrs.client.WebClient.fromClient(WebClient.java:283)
    at 
org.apache.cxf.jaxrs.client.WebClient.fromClientObject(WebClient.java:253)
This only happens, after a request has been executed!
        
I tracked it down to:    

    static void copyProperties(Client toClient, Client fromClient) {
       AbstractClient newClient = toAbstractClient(toClient);
       AbstractClient oldClient = toAbstractClient(fromClient);
       newClient.setConfiguration(oldClient.getConfiguration());
    }

fromClient is proxy
oldClient is null

Continues to:
    
    private static AbstractClient toAbstractClient(Object client) {
        if ((client instanceof AbstractClient))
            return (AbstractClient) client;
        if ((client instanceof InvocationHandlerAware)) {
            return (AbstractClient) ((InvocationHandlerAware) 
client).getInvocationHandler();
        }
        Object realObject = ClassHelper.getRealObject(client);
        if ((realObject instanceof AbstractClient)) {
            return (AbstractClient) realObject;
        }
        return null;
    }

realObject is the ClientImpl proxy, but it doesn't seem to implement 
AbstractClient. So it returns null.

Any idea what goes wrong?

Since it only happens after a request has been made, it's difficult to provide 
an easy testcase.
Maybe this is enough information to find the problem?

Thanks.
Veit

Reply via email to