<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
</head>
<body style="font-family:Arial;font-size:14px">
<p>Hi All,<br>
<br>
I want to instrument the below code using soot:<br>
<br>
PrintStream writing=new PrintStream(new FileOutputStream("file.txt"));<br>
<br>
So I thought I'll start with creating the FileOutputStream object first.<br>
<br>
Soot Code:<br></p>
<div>final Local fileLocal=Jimple.v().newLocal("writing",</div>
<div>RefType.v("java.io.FileOutputStream"));<br>
body.getLocals().add(fileLocal);<br>
<div>units</div>
<div>.insertBefore(Jimple.v()</div>
<div>.newInvokeStmt(Jimple.v()</div>
<div>.newSpecialInvokeExpr(fileLocal, Scene.v()</div>
<div>.getMethod("<java.io.FileOutputStream: void <init>(java.lang.String)").makeRef(),</div>
<div>StringConstant.v("file.txt"))),stmt);<br>
<br>
When I run this it gives the exception:<br>
Worker thread execution failed: oops <java.io.FileOutputStream: void <init>(java.lang.String)</div>
</div>
<p><br>
<br>
Does anyone know a solution to this?<br>
<br>
Thanks,<br>
Pallavi<br></p>
</body>
</html>