[Soot-list] Get all fields and locals, java.lang.Exception: null typing passed to useChecker
Florian Strauß
f_straus at informatik.uni-kl.de
Tue Mar 27 08:58:22 EDT 2012
Hello,
I want to collect all fields and locals (with the corresponding methods) in
every application classes.
My method:
public static List<FieldOrLocalVar> getAllVaribles() {
if(allApplicationVars == null){
allApplicationVars = new LinkedList<FieldOrLocalVar>();
for (SootClass applicationClass :
soot.Scene.v().getApplicationClasses()){
for (SootField field :
applicationClass.getFields()){
allApplicationVars.add(new
FieldOrLocalVar(field));
}
for (SootMethod method:
applicationClass.getMethods()){
if(method.isConcrete()){
for (Local local :
method.retrieveActiveBody().getLocals()){
allApplicationVars.add(new
FieldOrLocalVar(local, method));
}
}
}
}
}
return allApplicationVars;
}
After lots of ..
[..]
found type: Ljava/util/Iterator<Ljava/lang/Object;>;
found type: Ljava/util/List<Ljava/lang/Object;>;
found type: Ljava/util/Iterator<Ljava/lang/Object;>;
found type: Ljava/util/Iterator<Ljava/lang/Object;>;
found type: Ljava/util/Map<Ljava/lang/Object;Ljava/lang/Object;>;
[..]
.. messages on the console, I get the following exception:
java.lang.Exception: null typing passed to useChecker
at
soot.jimple.toolkits.typing.fast.UseChecker.check(UseChecker.java:50)
at
soot.jimple.toolkits.typing.fast.TypeResolver.insertCasts(TypeResolver.java:
345)
at
soot.jimple.toolkits.typing.fast.TypeResolver.inferTypes(TypeResolver.java:1
24)
at
soot.jimple.toolkits.typing.TypeAssigner.internalTransform(TypeAssigner.java
:102)
at soot.BodyTransformer.transform(BodyTransformer.java:51)
at soot.Transform.apply(Transform.java:104)
at soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:66)
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:89)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:322)
at [myPackageName].getAllVaribles(Line: for (Local local :
method.retrieveActiveBody().getLocals()) )
What can I do to avoid this exception?
And maybe it would be a good idea to throw a RuntimeException instead of
terminating the program:
soot.jimple.toolkits.typing.fast.UseChecker.check:
[..]
try {
this.tg = tg;
this.uv = uv;
if (this.tg == null) throw new Exception("null typing
passed to useChecker");
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
[..]
Could you help me, please?
Best regards,
Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120327/baa39f40/attachment-0001.html
More information about the Soot-list
mailing list