tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Fwd: [jira] [Created] (TAP5-1601) Under as yet unknown circumstances, a method that references a field with a conduit will not be instrumented, resulting in an NPE accessing the field itself
Date Wed, 10 Aug 2011 01:05:23 GMT
This one has really got me flummoxed; I've been writing tests and I've been
scrutinizing the code, and I can't see a way this could fail, except perhaps
for one small spot where the method bytecode is analyze to replace GETFIELD
with INVOKEVIRTUAL.  Anyway, really puzzled on this, and why it only affects
this client's code (and perhaps, only on Tomcat?).

---------- Forwarded message ----------
From: Howard M. Lewis Ship (JIRA) <jira@apache.org>
Date: Tue, Aug 9, 2011 at 5:45 PM
Subject: [jira] [Created] (TAP5-1601) Under as yet unknown circumstances, a
method that references a field with a conduit will not be instrumented,
resulting in an NPE accessing the field itself
To: hlship@apache.org


     *Issue* (*View Online <https://issues.apache.org/jira/browse/TAP5-1601>
*)
   *Key:* TAP5-1601 <https://issues.apache.org/jira/browse/TAP5-1601>  Issue
Type: [image: Bug] <https://issues.apache.org/jira/browse/TAP5-1601> Bug
Status: [image: Open] Open  Priority: [image: Critical] Critical
Assignee: Unassigned
 Reporter: Howard M. Lewis
Ship<https://issues.apache.org/jira/secure/ViewProfile.jspa?name=hlship>
  Operations     *View
all<https://issues.apache.org/jira/browse/TAP5-1601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel>
*    *View comments<https://issues.apache.org/jira/browse/TAP5-1601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel>
*    *View history<https://issues.apache.org/jira/browse/TAP5-1601?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel>
*         *Under as yet unknown circumstances, a method that references a
field with a conduit will not be instrumented, resulting in an NPE accessing
the field itself <https://issues.apache.org/jira/browse/TAP5-1601>*
 Updated: 10/Aug/11 00:43   Created: 10/Aug/11 00:43
  *Project:* Tapestry 5 <https://issues.apache.org/jira/browse/TAP5>  *
Components:* plastic, tapestry-core  *Affects Versions:* 5.3
*Labels:* class-transformation

   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.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to learn
how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message