[
https://issues.apache.org/jira/browse/TAP5-1601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Howard M. Lewis Ship closed TAP5-1601.
--------------------------------------
Resolution: Fixed
> Sometime a method that references a field with a conduit will not be
> instrumented, resulting in an NPE accessing the field itself
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: TAP5-1601
> URL: https://issues.apache.org/jira/browse/TAP5-1601
> Project: Tapestry 5
> Issue Type: Bug
> Components: plastic, tapestry-core
> Affects Versions: 5.3
> Reporter: Howard M. Lewis Ship
> Assignee: Howard M. Lewis Ship
> Priority: Blocker
> Labels: class-transformation, fixed-in-5.4-js-rewrite
> Fix For: 5.3.5
>
> Attachments: AtCached-issue.zip
>
>
> From ProQuest, they have a component that has this code:
> public class Layout {
> @Inject
> private ComponentResources resources;
> @Cached
> public Component getPage() { return resources.getContainer(); }
> }
> The generated bytecode for the advised method looks ok:
> public getPage()Lorg/apache/tapestry5/runtime/Component;
> @Lorg/apache/tapestry5/annotations/Cached;()
> NEW
> com/proquest/apps/onesearch/components/PageLayoutBasic$Invocation_getPage_123876a5ccf1f215
> DUP
> ALOAD 0
> ALOAD 0
> GETFIELD
> com/proquest/apps/onesearch/components/PageLayoutBasic.instanceContext :
> Lorg/apache/tapestry5/plastic/InstanceContext;
> ALOAD 0
> GETFIELD
> com/proquest/apps/onesearch/components/PageLayoutBasic.methodinvocationbundle_getPage_123876a5ccf1f22d
> : Lorg/apache/tapestry5/internal/plastic/MethodInvocationBundle;
> INVOKESPECIAL
> com/proquest/apps/onesearch/components/PageLayoutBasic$Invocation_getPage_123876a5ccf1f215.<init>
>
> (Ljava/lang/Object;Lorg/apache/tapestry5/plastic/InstanceContext;Lorg/apache/tapestry5/internal/plastic/MethodInvocationBundle;)V
> L0
> DUP
> ASTORE 1
> INVOKEVIRTUAL
> org/apache/tapestry5/internal/plastic/AbstractMethodInvocation.proceed
> ()Lorg/apache/tapestry5/plastic/MethodInvocation;
> ALOAD 1
> GETFIELD
> com/proquest/apps/onesearch/components/PageLayoutBasic$Invocation_getPage_123876a5ccf1f215.returnValue
> : Lorg/apache/tapestry5/runtime/Component;
> ARETURN
> L1
> LOCALVARIABLE var0
> Lcom/proquest/apps/onesearch/components/PageLayoutBasic$Invocation_getPage_123876a5ccf1f215;
> L0 L1 1
> MAXSTACK = 1
> MAXLOCALS = 1
> ... but the bytecode for the advised method is not instrumented:
> public
> advised$getPage_123876a5ccf1f216()Lorg/apache/tapestry5/runtime/Component;
> @Lorg/apache/tapestry5/annotations/Cached;()
> ALOAD 0
> GETFIELD com/proquest/apps/onesearch/components/PageLayoutBasic.resources
> : Lorg/apache/tapestry5/ComponentResources;
> INVOKEINTERFACE org/apache/tapestry5/ComponentResources.getContainer
> ()Lorg/apache/tapestry5/runtime/Component;
> ARETURN
> MAXSTACK = 1
> MAXLOCALS = 1
> ... even though the necessary field conduit support method is present:
> // access flags 0x1010
> final getfieldvalue_resources()Lorg/apache/tapestry5/ComponentResources;
> ALOAD 0
> GETFIELD
> com/proquest/apps/onesearch/components/PageLayoutBasic.resources_FieldConduit
> : Lorg/apache/tapestry5/plastic/FieldConduit;
> ALOAD 0
> ALOAD 0
> GETFIELD
> com/proquest/apps/onesearch/components/PageLayoutBasic.instanceContext :
> Lorg/apache/tapestry5/plastic/InstanceContext;
> INVOKEINTERFACE org/apache/tapestry5/plastic/FieldConduit.get
> (Ljava/lang/Object;Lorg/apache/tapestry5/plastic/InstanceContext;)Ljava/lang/Object;
> CHECKCAST org/apache/tapestry5/ComponentResources
> DUP
> ALOAD 0
> SWAP
> PUTFIELD com/proquest/apps/onesearch/components/PageLayoutBasic.resources
> : Lorg/apache/tapestry5/ComponentResources;
> ARETURN
> MAXSTACK = 0
> MAXLOCALS = 0
> ... also, looking at the real class, from the client, as transformed, many
> other methods containing references to the field are being transformed.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira