Re: Re: NPE in FrameNode

Eugene Kuleshov <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
  Peter, that code is generated by ASMifier adapter, so while your
comment is somewhat valid, it is likely doesn't really apply to this
case. We need to see the source code that produced that visitFrame
call.

  regards,
  Eugene


On Thu, Feb 25, 2010 at 10:55 AM, Peter Veentjer <[email protected]> wrote:
> Npe's in asm are not uncommon and in my experience are caused by not all
> properties being set on the method or the internals of the method.
>
> Try to use the debug jar instead of the normal one because stacktraces are
> missing debug info. After you have replaced the jar, run again, and go to
> the method that causes the npe. In most cases i'm able to figure out what is
> missing.
>
>
>
> On 25 feb 2010, at 13:22, melix <[email protected]> wrote:
>
>>
>> Hi,
>>
>> I'm new to ASM, so there must be many things I'm missing. I'm trying to
>> replace a method with another. I've written code for the new method, and
>> looked at the bytecode outline to see what's generated for it. At the end
>> of
>> the method, I can see the following :
>>
>> L9
>>   LINENUMBER 227 L9
>>  FRAME CHOP 1
>>   ICONST_0
>>   IRETURN
>>
>> This actually gets converted to the following ASM code :
>>
>> mv.visitLabel(l9);
>> mv.visitLineNumber(227, l9);
>> mv.visitFrame(Opcodes.F_CHOP,1, null, 0, null);
>> mv.visitInsn(ICONST_0);
>> mv.visitInsn(IRETURN);
>>
>> However, if I use a MethodNode as the method visitor, then the following
>> exception is thrown :
>>
>> Exception in thread "main" java.lang.NullPointerException
>>   at java.util.Arrays$ArrayList.<init>(Arrays.java:3357)
>>   at java.util.Arrays.asList(Arrays.java:3343)
>>   at org.objectweb.asm.tree.FrameNode.asList(Unknown Source)
>>   at org.objectweb.asm.tree.FrameNode.<init>(Unknown Source)
>>   at org.objectweb.asm.tree.MethodNode.visitFrame(Unknown Source)
>>
>> Is it a bug in ASM (FrameNode ? MethodNode ?), in ASMifier, or in my own
>> code ? Is there any workaround ?
>>
>> BTW, I'm using ASM 3.2.
>>
>> Thanks a lot,
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/NPE-in-FrameNode-tp27714402p27714402.html
>> Sent from the ASM mailing list archive at Nabble.com.
>>
>>
>> --
>> You receive this message as a subscriber of the [email protected] mailing list.
>> To unsubscribe: mailto:[email protected]
>> For general help: mailto:[email protected]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
> --
> You receive this message as a subscriber of the [email protected] mailing list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.