Mercurial > hg > icedrobot > daneel
changeset 86:953c5b35ad79
Close the temp dex file after reading to prevent problems under Windows with bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4715154
author | volker |
---|---|
date | Sat, 26 Mar 2011 20:07:38 +0100 |
parents | 6a525c466148 |
children | 31ee0b85dbfc |
files | src/test/java/org/icedrobot/daneel/DexifyingRunner.java |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/test/java/org/icedrobot/daneel/DexifyingRunner.java Sun Mar 27 12:33:41 2011 +0200 +++ b/src/test/java/org/icedrobot/daneel/DexifyingRunner.java Sat Mar 26 20:07:38 2011 +0100 @@ -37,7 +37,9 @@ package org.icedrobot.daneel; +import java.io.DataInputStream; import java.io.File; +import java.io.FileInputStream; import java.lang.reflect.Method; import java.net.URL; @@ -112,7 +114,11 @@ throw new DaneelException("Unable to execute 'dx' tool."); // Rewrite test code from DEX back to Java using our rewriter. - DexFile dex = DexFile.parse(tmp); + byte[] data = new byte[(int)tmp.length()]; + DataInputStream dai = new DataInputStream(new FileInputStream(tmp)); + dai.readFully(data); + dai.close(); + DexFile dex = DexFile.parse(data); byte[] testCode = DexRewriter.rewrite(testClass, dex); // From this point on we no longer need the DEX file