You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Olivier Abdoun (JIRA)" <tu...@ws.apache.org> on 2007/10/29 13:59:50 UTC

[jira] Created: (TUSCANY-1875) Constructor property injection fails

Constructor property injection fails
------------------------------------

                 Key: TUSCANY-1875
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1875
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Core Runtime
    Affects Versions: Java-SCA-1.0
         Environment: Ubuntu 7.10, Gutsy Gibbon
Sun JDK version 1.5.0_13
            Reporter: Olivier Abdoun


When injecting a property in a component constructor, as specified in "Java Component Implementation Specification v1" §1.2.4, a NPE is raised when accessing the component:

java.lang.NullPointerException
	at org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory.newInstance(ReflectiveInstanceFactory.java:58)
	at org.apache.tuscany.sca.implementation.java.invocation.JavaComponentContextProvider.createInstanceWrapper(JavaComponentContextProvider.java:93)
	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProvider.createInstanceWrapper(JavaImplementationProvider.java:158)
	at org.apache.tuscany.sca.core.scope.AbstractScopeContainer.createInstanceWrapper(AbstractScopeContainer.java:65)
	at org.apache.tuscany.sca.core.scope.StatelessScopeContainer.getWrapper(StatelessScopeContainer.java:38)
	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:85)
	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:233)
	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:130)
	at $Proxy6.getBar(Unknown Source)
	at foo.ConstructorPropertyInjectionTestCase.testFoo1(ConstructorPropertyInjectionTestCase.java:12)
	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 junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	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)

the following syntaxes have been tried w/ the same result:
 - @Constructor("bar")
 - @Constructor({"bar"})
 - @Constructor(value={"bar"})


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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Resolved: (TUSCANY-1875) Constructor property injection fails

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raymond Feng resolved TUSCANY-1875.
-----------------------------------

    Resolution: Fixed

Hi, Oliver.

Thank you for reporting the issue and providing a test case. It helped me quickly identify the problem and worked out a fix. 

I just checked in the fix under r589874. Please verify.

Thanks,
Raymond

> Constructor property injection fails
> ------------------------------------
>
>                 Key: TUSCANY-1875
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1875
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>    Affects Versions: Java-SCA-1.0
>         Environment: Ubuntu 7.10, Gutsy Gibbon
> Sun JDK version 1.5.0_13
>            Reporter: Olivier Abdoun
>            Assignee: Raymond Feng
>         Attachments: constpropinject.tar.gz
>
>
> When injecting a property in a component constructor, as specified in "Java Component Implementation Specification v1" §1.2.4, a NPE is raised when accessing the component:
> java.lang.NullPointerException
> 	at org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory.newInstance(ReflectiveInstanceFactory.java:58)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaComponentContextProvider.createInstanceWrapper(JavaComponentContextProvider.java:93)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProvider.createInstanceWrapper(JavaImplementationProvider.java:158)
> 	at org.apache.tuscany.sca.core.scope.AbstractScopeContainer.createInstanceWrapper(AbstractScopeContainer.java:65)
> 	at org.apache.tuscany.sca.core.scope.StatelessScopeContainer.getWrapper(StatelessScopeContainer.java:38)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:85)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:233)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:130)
> 	at $Proxy6.getBar(Unknown Source)
> 	at foo.ConstructorPropertyInjectionTestCase.testFoo1(ConstructorPropertyInjectionTestCase.java:12)
> 	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 junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	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)
> the following syntaxes have been tried w/ the same result:
>  - @Constructor("bar")
>  - @Constructor({"bar"})
>  - @Constructor(value={"bar"})

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1875) Constructor property injection fails

Posted by "Olivier Abdoun (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Abdoun updated TUSCANY-1875:
------------------------------------

    Attachment: constpropinject.tar.gz

test case for the issue

> Constructor property injection fails
> ------------------------------------
>
>                 Key: TUSCANY-1875
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1875
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>    Affects Versions: Java-SCA-1.0
>         Environment: Ubuntu 7.10, Gutsy Gibbon
> Sun JDK version 1.5.0_13
>            Reporter: Olivier Abdoun
>         Attachments: constpropinject.tar.gz
>
>
> When injecting a property in a component constructor, as specified in "Java Component Implementation Specification v1" §1.2.4, a NPE is raised when accessing the component:
> java.lang.NullPointerException
> 	at org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory.newInstance(ReflectiveInstanceFactory.java:58)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaComponentContextProvider.createInstanceWrapper(JavaComponentContextProvider.java:93)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProvider.createInstanceWrapper(JavaImplementationProvider.java:158)
> 	at org.apache.tuscany.sca.core.scope.AbstractScopeContainer.createInstanceWrapper(AbstractScopeContainer.java:65)
> 	at org.apache.tuscany.sca.core.scope.StatelessScopeContainer.getWrapper(StatelessScopeContainer.java:38)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:85)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:233)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:130)
> 	at $Proxy6.getBar(Unknown Source)
> 	at foo.ConstructorPropertyInjectionTestCase.testFoo1(ConstructorPropertyInjectionTestCase.java:12)
> 	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 junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	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)
> the following syntaxes have been tried w/ the same result:
>  - @Constructor("bar")
>  - @Constructor({"bar"})
>  - @Constructor(value={"bar"})

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Closed: (TUSCANY-1875) Constructor property injection fails

Posted by "Olivier Abdoun (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Abdoun closed TUSCANY-1875.
-----------------------------------


Hello Raymond,

The fix resolves the my problem: I can now get rid of the default constructor in my components and use constructor property injection in my project !

Many thanks,
Olivier

> Constructor property injection fails
> ------------------------------------
>
>                 Key: TUSCANY-1875
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1875
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>    Affects Versions: Java-SCA-1.0
>         Environment: Ubuntu 7.10, Gutsy Gibbon
> Sun JDK version 1.5.0_13
>            Reporter: Olivier Abdoun
>            Assignee: Raymond Feng
>         Attachments: constpropinject.tar.gz
>
>
> When injecting a property in a component constructor, as specified in "Java Component Implementation Specification v1" §1.2.4, a NPE is raised when accessing the component:
> java.lang.NullPointerException
> 	at org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory.newInstance(ReflectiveInstanceFactory.java:58)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaComponentContextProvider.createInstanceWrapper(JavaComponentContextProvider.java:93)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProvider.createInstanceWrapper(JavaImplementationProvider.java:158)
> 	at org.apache.tuscany.sca.core.scope.AbstractScopeContainer.createInstanceWrapper(AbstractScopeContainer.java:65)
> 	at org.apache.tuscany.sca.core.scope.StatelessScopeContainer.getWrapper(StatelessScopeContainer.java:38)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:85)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:233)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:130)
> 	at $Proxy6.getBar(Unknown Source)
> 	at foo.ConstructorPropertyInjectionTestCase.testFoo1(ConstructorPropertyInjectionTestCase.java:12)
> 	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 junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	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)
> the following syntaxes have been tried w/ the same result:
>  - @Constructor("bar")
>  - @Constructor({"bar"})
>  - @Constructor(value={"bar"})

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Assigned: (TUSCANY-1875) Constructor property injection fails

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raymond Feng reassigned TUSCANY-1875:
-------------------------------------

    Assignee: Raymond Feng

> Constructor property injection fails
> ------------------------------------
>
>                 Key: TUSCANY-1875
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1875
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>    Affects Versions: Java-SCA-1.0
>         Environment: Ubuntu 7.10, Gutsy Gibbon
> Sun JDK version 1.5.0_13
>            Reporter: Olivier Abdoun
>            Assignee: Raymond Feng
>         Attachments: constpropinject.tar.gz
>
>
> When injecting a property in a component constructor, as specified in "Java Component Implementation Specification v1" §1.2.4, a NPE is raised when accessing the component:
> java.lang.NullPointerException
> 	at org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory.newInstance(ReflectiveInstanceFactory.java:58)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaComponentContextProvider.createInstanceWrapper(JavaComponentContextProvider.java:93)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProvider.createInstanceWrapper(JavaImplementationProvider.java:158)
> 	at org.apache.tuscany.sca.core.scope.AbstractScopeContainer.createInstanceWrapper(AbstractScopeContainer.java:65)
> 	at org.apache.tuscany.sca.core.scope.StatelessScopeContainer.getWrapper(StatelessScopeContainer.java:38)
> 	at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:85)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:233)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:130)
> 	at $Proxy6.getBar(Unknown Source)
> 	at foo.ConstructorPropertyInjectionTestCase.testFoo1(ConstructorPropertyInjectionTestCase.java:12)
> 	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 junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	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)
> the following syntaxes have been tried w/ the same result:
>  - @Constructor("bar")
>  - @Constructor({"bar"})
>  - @Constructor(value={"bar"})

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


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org