[Soot-list] ERROR: oops <java.io.FileOutputStream: void <init>(java.lang.String)

Bernhard Berger berber at tzi.de
Thu Jan 12 14:39:35 EST 2017


Hi Pallavi,

is the exception thrown by Soot or by the application you are instrumenting? I think you forgot to call the new operator. If you take a look at some Jimple code you will see that for object creation there will be a JNewExpr (the result will be assigned to you local) and afterwards you are going to call the constructor.

Regards, Bernhard

> Am 12.01.2017 um 11:41 schrieb Pallavi Majumder <s8pamaju at stud.uni-saarland.de>:
> 
> Hi All,
> 
> I want to instrument the below code using soot:
> 
> PrintStream writing=new PrintStream(new FileOutputStream("file.txt"));
> 
> So I thought I'll start with creating the FileOutputStream object first.
> 
> Soot Code:
> 
> final Local fileLocal=Jimple.v().newLocal("writing",
> RefType.v("java.io.FileOutputStream"));
> body.getLocals().add(fileLocal);
> units
> .insertBefore(Jimple.v()
> .newInvokeStmt(Jimple.v()
> .newSpecialInvokeExpr(fileLocal, Scene.v()
> .getMethod("<java.io.FileOutputStream: void <init>(java.lang.String)").makeRef(),
> StringConstant.v("file.txt"))),stmt);
> 
> When I run this it gives the exception:
> Worker thread execution failed: oops <java.io.FileOutputStream: void <init>(java.lang.String)
> 
> 
> Does anyone know a solution to this?
> 
> Thanks,
> Pallavi
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20170112/f5d3d8b9/attachment.html 


More information about the Soot-list mailing list