[Soot-list] NullPointerException in retrieveActiveBody

Eric Bodden eric.bodden at mail.mcgill.ca
Tue Jan 30 14:40:42 EST 2007


> Thanks for your quick reply. However I am not sure whether 
> this is related to class loading or not as when I remove the 
> try catch block from my program Test123, it is working fine. 
> Do you think that there can be an issue in class loading when 
> I use try catch block in my class?

Yes, could be because in the one case you have a type "Exception" in the
body and in the other case not, do you?

> I am directly using the Soot API instead of using soot 
> command line tool.

Ok, there's a lot you could be doing wrong then ;-)

Eric

> 
> Thanks & Regards,
> Nitin Goel
> 
> 
> >From: "Eric Bodden" <eric.bodden at mail.mcgill.ca>
> >To: "Nitin Goel" <ernitingoel at hotmail.com>
> >CC: <soot-list at sable.mcgill.ca>
> >Subject: RE: [Soot-list] NullPointerException in 
> retrieveActiveBody Date: 
> >Tue, 30 Jan 2007 11:43:24 -0500
> >
> >I would assume that this is a classloader problem. What's you soot 
> >command line?
> >
> >
> >
> >Eric
> >
> > > -----Original Message-----
> > > From: soot-list-bounces at sable.mcgill.ca 
> > > [mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of Nitin Goel
> > > Sent: Monday, January 29, 2007 12:40 PM
> > > To: soot-list at sable.mcgill.ca
> > > Subject: [Soot-list] NullPointerException in retrieveActiveBody
> > >
> > > Hi,
> > >
> > > I am new to Soot. When I am trying to generate jimple for 
> my class 
> > > Test123 using the method SootMethod.retrieveActiveBody(), I am 
> > > getting the following exception
> > >
> > > java.lang.NullPointerException
> > > at soot.AnySubType.v(AnySubType.java:44)
> > > at
> > > soot.toolkits.exceptions.ThrowableSet$Manager.<init>(Throwable
> > > Set.java:239)
> > > at
> > > soot.Singletons.soot_toolkits_exceptions_ThrowableSet_Manager(
> > > Singletons.java:765)
> > > at
> > > 
> soot.toolkits.exceptions.ThrowableSet$Manager.v(ThrowableSet.java:27
> > > 4)
> > > at
> > > soot.toolkits.exceptions.PedanticThrowAnalysis.mightThrow(Peda
> > > nticThrowAnalysis.java:68)
> > > at
> > > soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(E
> > > xceptionalUnitGraph.java:342)
> > > at
> > > soot.toolkits.graph.ExceptionalUnitGraph.initialize(Exceptiona
> > > lUnitGraph.java:262)
> > > at
> > > soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUni
> > > tGraph.java:148)
> > > at
> > > soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUni
> > > tGraph.java:180)
> > > at
> > > soot.toolkits.scalar.LocalSplitter.internalTransform(LocalSpli
> > > tter.java:78)
> > > at soot.BodyTransformer.transform(BodyTransformer.java:51)
> > > at soot.Transform.apply(Transform.java:104)
> > > at soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:61)
> > > at soot.JimpleBodyPack.internalApply(JimpleBodyPack.java:93)
> > > at soot.Pack.apply(Pack.java:120)
> > > at 
> soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:115)
> > > at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:81)
> > > at soot.SootMethod.retrieveActiveBody(SootMethod.java:320)
> > > at MyTest.traverseMethods(MyTest.java:60)
> > > at MyTest.traverseClasses(MyTest.java:43)
> > > at MyTest.main(MyTest.java:32)
> > >
> > >
> > > Where MyTest is my custom class which calls Soot API.
> > >
> > > Test123.java:
> > >
> > > public class Test123 {
> > >    public Test123() {
> > >    }
> > >
> > >    public static void main(String[] args) {
> > >        try {
> > >            System.out.println("test program");
> > >        } catch (Exception e) {
> > >            e.printStackTrace();
> > >        }
> > >    }
> > > }
> > > I have tried to debug that using the Soot source code and 
> find out 
> > > that if I comment out the following lines
> > >
> > > Line: 239
> > > resolveClassErrorSet.add(AnySubType.v(Scene.v().getRefType("ja
> > > va.lang.ClassFormatError")));
> > >
> > > and
> > >
> > > Line: 263
> > > initializationErrorSet.add(AnySubType.v(Scene.v().getRefType("
> > > java.lang.Error")));
> > >
> > > from the Manager( Singletons.Global g ) method of 
> > > soot.toolkits.exceptions.ThrowableSet class, it is working fine.
> > >
> > > If I also remove the try-catch block from Test123 class 
> then also it 
> > > is working fine.
> > >
> > > It is also working fine with old version of Soot 2.1, 
> however with 
> > > version 2.2.3, it is not working when I am using try-catch block.
> > >
> > > I am not really sure whether I am doing anything wrong or 
> it's the 
> > > problem with Soot. Could you please help me out to figure out the 
> > > root cause and workaround for this?
> > >
> > > Thanks & Regards,
> > > Nitin Goel
> > >
> > > _________________________________________________________________
> > > Invite your Hotmail contacts to join your friends list 
> with Windows 
> > > Live Spaces 
> > > http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?h
> > > ref=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_
> > > url=/friends.aspx&mkt=en-us
> > >
> > > _______________________________________________
> > > Soot-list mailing list
> > > Soot-list at sable.mcgill.ca
> > > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> > >
> >
> 
> _________________________________________________________________
> Search for grocery stores. Find gratitude. Turn a simple 
> search into something more. 
> http://click4thecause.live.com/search/charity/default.aspx?sou
> rce=hmemtagline_gratitude&FORM=WLMTAG
> 
> 



More information about the Soot-list mailing list