You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2014/05/13 16:25:16 UTC

[jira] [Resolved] (CAMEL-6716) ServiceInterfaceStrategy fails to create with interface containing multiple methods without parameters

     [ https://issues.apache.org/jira/browse/CAMEL-6716?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-6716.
---------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: Future)
                   2.14.0
                   2.13.2
                   2.12.4

Applied the patch into camel master, camel-2.13.x and camel-2.12.x branches with thanks to Andrea

> ServiceInterfaceStrategy fails to create with interface containing multiple methods without parameters
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-6716
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6716
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-soap
>    Affects Versions: 2.12.0
>            Reporter: Ondrej Fischer
>            Assignee: Willem Jiang
>            Priority: Minor
>             Fix For: 2.12.4, 2.13.2, 2.14.0
>
>
> I you attempt to create a ServiceInterfaceStrategy with interface containing multiple methods without parameters, you get NullPointerException.
> It's due to following code:
> ServiceInterfaceStrategy.java:161
> {code}
> 155    private void analyzeServiceInterface(Class<?> serviceInterface) {
> 156        Method[] methods = serviceInterface.getMethods();
> 157        for (Method method : methods) {
> 158            MethodInfo info = analyzeMethod(method);
> 159            for (int i = 0; i < info.getIn().length; i++) {
> 160                TypeInfo ti = info.getIn()[i];
> 161                if (inTypeNameToQName.containsKey(ti.getTypeName())
> 162                    && (!(ti.getTypeName().equals("javax.xml.ws.Holder")))
> 163                    && (!(inTypeNameToQName.get(ti.getTypeName()).equals(ti.getElName())))) {
> 164                    LOG.warn("Ambiguous QName mapping. The type [ "
> 165                                                    + ti.getTypeName()
> 166                                                    + " ] is already mapped to a QName in this context.");
> 167                    continue;
> 168                }
> 169                inTypeNameToQName.put(ti.getTypeName(), ti.getElName());
> 170            }
> 171            if (info.getSoapAction() != null && !"".equals172(info.getSoapAction())) {
> 172                soapActionToMethodInfo.put(info.getSoapAction(), info);
> 173            }
> 174
> 175            outTypeNameToQName.put(info.getOut().getTypeName(), info.getOut().getElName());
> 176
> 177            addExceptions(method);
> 178        }
> 179    }
> {code}
> For the second method without parameters, the null value is already in the inTypeNameToQName, so it tries to evaluate this: !(ti.getTypeName().equals("javax.xml.ws.Holder"), which fails with NPE.
> The question here is, why method without parameters still needs an array of types containing one element with those null values.



--
This message was sent by Atlassian JIRA
(v6.2#6252)