NPE occurs when promoting an undefined reference
------------------------------------------------

                 Key: TUSCANY-2762
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2762
             Project: Tuscany
          Issue Type: Test
          Components: Java SCA Assembly Model
    Affects Versions: Java-SCA-1.3
            Reporter: Shu Chao Wan
            Priority: Minor


Conformance item 60007 says that, "Each of the URIs declared by a composite 
reference's @promote attribute MUST identify a component reference within the 
composite."
According to the above description, I wrote a composite file 
nonreferencepromote_inner.composite with setting composite reference's 
<reference/> @promote attribute as a non-defined reference value.
-----------------------------------------------------
nonreferencepromote_inner.composite
------------------------------------------------------ 
<composite ...>
    <service name="AService" promote="AComponent"/>
        <component name="AComponent">
                <implementation.java
                        
class="org.apache.tuscany.sca.vtest.assembly.composite.impl.AServiceImpl" />
                <reference name="b" />
                <reference name="c" />
        </component>

        <reference name="referenceB" promote="AComponent/b" />
        <reference name="referenceC" promote="AComponent/NonReference" />
   
</composite>

---------------
Test Case
----------------
   @Test
    public void ASM60007_n() throws Exception {
        initDomain("nonreferencepromote_outer.composite");
        AService service = ServiceFinder.getService(AService.class, 
"TestNonPromoteComponent");
        service.getState();
        cleanupDomain();
    }

When executing the test case, I got a NullPointerException.
------------------------------
NullPointerException
-----------------------------
java.lang.NullPointerException
        at 
org.apache.tuscany.sca.vtest.assembly.composite.impl.AServiceImpl.getState(AServiceImpl.java:39)
        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:585)
        at 
org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:132)
        at 
org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
        at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:287)
        at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
        at $Proxy9.getState(Unknown Source)
        at 
org.apache.tuscany.sca.vtest.assembly.composite.CompositeTestCase.ASM60007_n(CompositeTestCase.java:288)
        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:585)
        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.InvokeMethod.evaluate(InvokeMethod.java:20)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


    

-- 
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