Re: NPE in FrameNode
Peter Veentjer <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
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
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