<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Pallavi,<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Regards, Bernhard</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 12.01.2017 um 11:41 schrieb Pallavi Majumder <<a href="mailto:s8pamaju@stud.uni-saarland.de" class="">s8pamaju@stud.uni-saarland.de</a>>:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="content-type" content="text/html; charset=utf-8" class="">
<title class=""></title>
<div style="font-family:Arial;font-size:14px" class=""><p class="">Hi All,<br class="">
<br class="">
I want to instrument the below code using soot:<br class="">
<br class="">
PrintStream writing=new PrintStream(new FileOutputStream("file.txt"));<br class="">
<br class="">
So I thought I'll start with creating the FileOutputStream object first.<br class="">
<br class="">
Soot Code:<br class=""></p>
<div class="">final Local fileLocal=Jimple.v().newLocal("writing",</div>
<div class="">RefType.v("java.io.FileOutputStream"));<br class="">
body.getLocals().add(fileLocal);<br class="">
<div class="">units</div>
<div class="">.insertBefore(Jimple.v()</div>
<div class="">.newInvokeStmt(Jimple.v()</div>
<div class="">.newSpecialInvokeExpr(fileLocal, Scene.v()</div>
<div class="">.getMethod("<java.io.FileOutputStream: void <init>(java.lang.String)").makeRef(),</div>
<div class="">StringConstant.v("file.txt"))),stmt);<br class="">
<br class="">
When I run this it gives the exception:<br class="">
Worker thread execution failed: oops <java.io.FileOutputStream: void <init>(java.lang.String)</div>
</div><p class=""><br class="">
<br class="">
Does anyone know a solution to this?<br class="">
<br class="">
Thanks,<br class="">
Pallavi<br class=""></p>
</div>
_______________________________________________<br class="">Soot-list mailing list<br class=""><a href="mailto:Soot-list@CS.McGill.CA" class="">Soot-list@CS.McGill.CA</a><br class="">https://mailman.CS.McGill.CA/mailman/listinfo/soot-list<br class=""></div></blockquote></div><br class=""></div></body></html>