[Soot-list] exception when call retrieveActiveBody()

=?BIG5?B?rn2wtw==?= fightmyway at gmail.com
Thu Oct 23 02:24:29 EDT 2008


Hi:

When I try calling retrieveActiveBody() function of SootMethod, if the
SootMethod have try{}catch{} structure, the retrieveActiveBody() error. but
if the SootMethod don't have try{]catch{} structure, It's OK;

class HelloWorld{  // a class hase try{}catch{} structure
   public void aFunc(){
     try{
       FileWriter f = new FileWriter("xx");
   }catch(IOException e){}
};

.......
 SootClass sClass = Scene.v().loadClassAndSupport("HelloWorld");
        sClass.setApplicationClass();
        Iterator<SootMethod> methodIt = sClass.getMethods().iterator();

        while (methodIt.hasNext()) {
            SootMethod m = (SootMethod) methodIt.next();
-->         Body b = m.retrieveActiveBody();

............

The error information like this:

Exception in thread "main" java.lang.NullPointerException
    at soot.AnySubType.v(AnySubType.java:43)
    at
soot.toolkits.exceptions.ThrowableSet$Manager.<init>(ThrowableSet.java:240)
    at
soot.Singletons.soot_toolkits_exceptions_ThrowableSet_Manager(Singletons.java:765)
    at
soot.toolkits.exceptions.ThrowableSet$Manager.v(ThrowableSet.java:275)
    at
soot.toolkits.exceptions.PedanticThrowAnalysis.mightThrow(PedanticThrowAnalysis.java:67)
    at
soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(ExceptionalUnitGraph.java:342)
    at
soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitGraph.java:263)
    at
soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:149)
    at
soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:181)
    at
soot.toolkits.scalar.LocalSplitter.internalTransform(LocalSplitter.java:77)
    at soot.BodyTransformer.transform(BodyTransformer.java:51)
    at soot.Transform.apply(Transform.java:104)
    at soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:57)
    at soot.JimpleBodyPack.internalApply(JimpleBodyPack.java:89)
    at soot.Pack.apply(Pack.java:124)
    at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:117)
    at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:82)
    at soot.SootMethod.retrieveActiveBody(SootMethod.java:329)
    at hku.cfg.D.main(D.java:34)


It is like "Scene.v().getRefType("java.lang.ClassFormatError")" return null
in soot.toolkits.exceptions.ThrowableSet$Manager.

Could help me

regards.
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20081023/84afe17a/attachment.htm


More information about the Soot-list mailing list