cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Benneke (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-1737) NPE in ClientProxyFactoryBean on void methods
Date Fri, 08 Aug 2008 09:43:44 GMT

    [ https://issues.apache.org/jira/browse/CXF-1737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620888#action_12620888
] 

Andreas Benneke commented on CXF-1737:
--------------------------------------

Aaaaah, I see. It does m.getReturnType().getClass() which will always be "Class" as getReturnType()
already returns the value. So this method will never return false and it should read:

    @Override
    public Boolean hasOutMessage(Method m) {
        Class rt = m.getReturnType().getClass();
        if ((rt.equals(Void.TYPE) || rt.equals(Void.class)) && m.getExceptionTypes().length
== 0) {
            return false;
        }
        return true;
    } 

However I think, the following change would be enough:

    @Override
    public Boolean hasOutMessage(Method m) {
        if (m.getReturnType().equals(void.class) && m.getExceptionTypes().length ==
0) {
            return false;
        }
        return true;
    } 



> NPE in ClientProxyFactoryBean on void methods 
> ----------------------------------------------
>
>                 Key: CXF-1737
>                 URL: https://issues.apache.org/jira/browse/CXF-1737
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.1
>            Reporter: Andreas Benneke
>         Attachments: void.zip
>
>
> If you try to access a service containing a method returning nothing (void), the ClientProxyFactoryBean
fails with a NullPointerException:
> Exception in thread "main" java.lang.NullPointerException
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeParameter(ReflectionServiceFactoryBean.java:643)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeClassInfo(ReflectionServiceFactoryBean.java:609)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperation(ReflectionServiceFactoryBean.java:540)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:510)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:305)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:394)
> 	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:181)
> 	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:79)
> 	at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
> 	at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:97)
> If you change the method returning something or eliminate the method altogether, everything
works fine...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message