[Soot-list] NullPointerException in retrieveActiveBody

Nitin Goel ernitingoel at hotmail.com
Mon Jan 29 12:40:27 EST 2007


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>(ThrowableSet.java:239)
at 
soot.Singletons.soot_toolkits_exceptions_ThrowableSet_Manager(Singletons.java:765)
at soot.toolkits.exceptions.ThrowableSet$Manager.v(ThrowableSet.java:274)
at 
soot.toolkits.exceptions.PedanticThrowAnalysis.mightThrow(PedanticThrowAnalysis.java:68)
at 
soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(ExceptionalUnitGraph.java:342)
at 
soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitGraph.java:262)
at 
soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:148)
at 
soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:180)
at 
soot.toolkits.scalar.LocalSplitter.internalTransform(LocalSplitter.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("java.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/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us



More information about the Soot-list mailing list