Tapestry 5
  1. Tapestry 5
  2. TAP5-1601

Sometime a method that references a field with a conduit will not be instrumented, resulting in an NPE accessing the field itself

    Details

      Description

      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.

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Howard M. Lewis Ship
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development