tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAP5-2425) Improve error message when trying to use an abstract class as a service implementation
Date Thu, 04 Dec 2014 21:21:14 GMT

    [ https://issues.apache.org/jira/browse/TAP5-2425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14234637#comment-14234637
] 

Hudson commented on TAP5-2425:
------------------------------

SUCCESS: Integrated in tapestry-trunk-freestyle #1353 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/1353/])
TAP5-2425: throw a meaningful exception when trying to use an abstract class as a service
implementation (jkemnade: rev b06c013f1719c455b46ed4b88b74b66fd963197a)
* tapestry-ioc/src/test/groovy/ioc/specs/DefaultModuleDefImplSpec.groovy
* tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AbstractRunnableService.java
* tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/IOCStrings.properties
* tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AbstractAutobuildServiceModule.java
* tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceBinderImpl.java
* tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/IOCMessages.java


> Improve error message when trying to use an abstract class as a service implementation
> --------------------------------------------------------------------------------------
>
>                 Key: TAP5-2425
>                 URL: https://issues.apache.org/jira/browse/TAP5-2425
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-ioc
>    Affects Versions: 5.4
>            Reporter: Jochen Kemnade
>            Assignee: Jochen Kemnade
>            Priority: Minor
>             Fix For: 5.4
>
>
> When binding an abstract class as a service implementation using {{ServiceBinder.bind(Class,
Class)}}, the exception is not very helpful:
> {code}
> [ERROR] Registry [ 2] Invoking constructor public org.apache.tapestry5.ioc.AbstractGreeter()
(for service 'AbstractGreeter')
> org.apache.tapestry5.ioc.internal.OperationException: Error invoking constructor public
org.apache.tapestry5.ioc.AbstractGreeter(): java.lang.InstantiationException
> 	at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:184)
> 	at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
> 	at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
> 	at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1258)
> 	at org.apache.tapestry5.ioc.internal.util.ConstructionPlan.createObject(ConstructionPlan.java:61)
> 	at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:62)
> 	at org.apache.tapestry5.ioc.internal.ReloadableServiceImplementationObjectCreator.createInstance(ReloadableServiceImplementationObjectCreator.java:54)
> 	at org.apache.tapestry5.ioc.internal.AbstractReloadableObjectCreator$1.invoke(AbstractReloadableObjectCreator.java:136)
> 	at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
> 	at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
> 	at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1258)
> 	at org.apache.tapestry5.ioc.internal.AbstractReloadableObjectCreator.createInstance(AbstractReloadableObjectCreator.java:129)
> 	at org.apache.tapestry5.ioc.internal.AbstractReloadableObjectCreator.createObject(AbstractReloadableObjectCreator.java:121)
> 	at $Greeter_1eb73c5d7c1.delegate(Unknown Source)
> 	at $Greeter_1eb73c5d7c1.getGreeting(Unknown Source)
> 	at $Greeter_1eb73c5d7bf.getGreeting(Unknown Source)
> 	at org.apache.tapestry5.ioc.Greeter$getGreeting.call(Unknown Source)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
> 	at ioc.specs.ServiceBinderSpec.$spock_feature_1_1(ServiceBinderSpec.groovy:25)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
> 	at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:330)
> 	at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:311)
> 	at org.spockframework.runtime.BaseSpecRunner.invokeFeatureMethod(BaseSpecRunner.java:285)
> 	at org.spockframework.runtime.BaseSpecRunner.doRunIteration(BaseSpecRunner.java:256)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
> 	at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:330)
> 	at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:311)
> 	at org.spockframework.runtime.BaseSpecRunner.runIteration(BaseSpecRunner.java:223)
> 	at org.spockframework.runtime.BaseSpecRunner.initializeAndRunIteration(BaseSpecRunner.java:214)
> 	at org.spockframework.runtime.BaseSpecRunner.runSimpleFeature(BaseSpecRunner.java:205)
> 	at org.spockframework.runtime.BaseSpecRunner.doRunFeature(BaseSpecRunner.java:199)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
> 	at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:330)
> 	at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:311)
> 	at org.spockframework.runtime.BaseSpecRunner.runFeature(BaseSpecRunner.java:175)
> 	at org.spockframework.runtime.BaseSpecRunner.runFeatures(BaseSpecRunner.java:152)
> 	at org.spockframework.runtime.BaseSpecRunner.doRunSpec(BaseSpecRunner.java:112)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
> 	at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:330)
> 	at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:311)
> 	at org.spockframework.runtime.BaseSpecRunner.runSpec(BaseSpecRunner.java:91)
> 	at org.spockframework.runtime.BaseSpecRunner.run(BaseSpecRunner.java:82)
> 	at org.spockframework.runtime.Sputnik.run(Sputnik.java:63)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> Caused by: java.lang.RuntimeException: Error invoking constructor public org.apache.tapestry5.ioc.AbstractGreeter():
java.lang.InstantiationException
> 	at org.apache.tapestry5.ioc.internal.util.ConstructorInvoker.invoke(ConstructorInvoker.java:59)
> 	at org.apache.tapestry5.ioc.internal.util.LoggingInvokableWrapper.invoke(LoggingInvokableWrapper.java:43)
> 	at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
> 	... 65 more
> Caused by: java.lang.InstantiationException
> 	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> 	at org.apache.tapestry5.ioc.internal.util.ConstructorInvoker.invoke(ConstructorInvoker.java:50)
> 	... 67 more
> {code}
> {{ServiceBinderImpl}} should detect this case and fail early.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message