Creating selfReference when multiple bindings are available cause NPE
---------------------------------------------------------------------

                 Key: TUSCANY-3543
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3543
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Core Runtime
    Affects Versions: Java-SCA-2.0
            Reporter: Luciano Resende
            Assignee: Luciano Resende
             Fix For: Java-SCA-2.0


In the following scenario :

<component name="Catalog">
                <implementation.java class="services.FruitsCatalogImpl"/> 
                <property name="currencyCode">USD</property>
                <service name="Catalog">
                        <tuscany:binding.rest name="rest-json" 
uri="http://localhost:8085/Catalog/json";>
                    <tuscany:wireFormat.json />
                            <tuscany:operationSelector.jaxrs />
                </tuscany:binding.rest>
                        <tuscany:binding.rest name="rest-xml" 
uri="http://localhost:8085/Catalog/xml";>
                    <tuscany:wireFormat.xml />
                            <tuscany:operationSelector.jaxrs />
                </tuscany:binding.rest>
                </service>
                <reference name="currencyConverter" 
target="CurrencyConverter"/>        
        </component> 
    
        <component name="CurrencyConverter">
                <implementation.java class="services.CurrencyConverterImpl"/>
        </component>     


Is causing

INFO: Add endpoint - (@70275790)Endpoint:  URI = 
CurrencyConverter#service-binding(CurrencyConverter/CurrencyConverter)
org.oasisopen.sca.ServiceRuntimeException: java.lang.NullPointerException
        at 
org.apache.tuscany.sca.core.context.impl.ComponentContextImpl.createSelfReference(ComponentContextImpl.java:235)
        at 
org.apache.tuscany.sca.node.impl.NodeImpl.getServiceReference(NodeImpl.java:290)
        at 
org.apache.tuscany.sca.node.impl.NodeImpl.getService(NodeImpl.java:231)
        at 
org.apache.tuscany.sca.binding.rest.wireformat.json.CatalogServiceTestCase.init(CatalogServiceTestCase.java:61)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.oasisopen.sca.ServiceRuntimeException: 
java.lang.NullPointerException
        at 
org.apache.tuscany.sca.core.context.impl.ComponentContextImpl.createSelfReference(ComponentContextImpl.java:280)
        at 
org.apache.tuscany.sca.core.context.impl.ComponentContextImpl.createSelfReference(ComponentContextImpl.java:233)
        ... 19 more
Caused by: java.lang.NullPointerException
        at 
org.apache.tuscany.sca.core.context.impl.ComponentContextImpl.createEndpointReference(ComponentContextImpl.java:358)
        at 
org.apache.tuscany.sca.core.context.impl.ComponentContextImpl.createEndpointReference(ComponentContextImpl.java:353)
        at 
org.apache.tuscany.sca.core.context.impl.ComponentContextImpl.createSelfReference(ComponentContextImpl.java:276)
        ... 20 more


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

Reply via email to