summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michael Rosenfeld <mrosenfeld@google.com> 2016-12-16 12:42:01 -0800
committer Michael Rosenfeld <mrosenfeld@google.com> 2016-12-16 16:24:29 -0800
commit2b62809c70555b76726bee812b5b962addb31606 (patch)
treecafde2e17fb8fc3c56bebda21d7ae07261bc5b3b
parent0b4df21aacf5ae24ae75ca547f5d35d139baf53e (diff)
Clean up local hprofs
* After use * Upon failure Test: manual tool use Change-Id: I2669e190c3792522c121158ea2aec84fe577c9e3
-rw-r--r--tools/preload2/src/com/android/preload/classdataretrieval/hprof/Hprof.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/preload2/src/com/android/preload/classdataretrieval/hprof/Hprof.java b/tools/preload2/src/com/android/preload/classdataretrieval/hprof/Hprof.java
index 21b7a04e07dc..84ec8b7d0fdd 100644
--- a/tools/preload2/src/com/android/preload/classdataretrieval/hprof/Hprof.java
+++ b/tools/preload2/src/com/android/preload/classdataretrieval/hprof/Hprof.java
@@ -171,6 +171,9 @@ public class Hprof implements ClassDataRetriever {
arg1.getDevice().getSyncService().pullFile(arg0,
target.getAbsoluteFile().toString(), new NullProgressMonitor());
} catch (Exception e) {
+ if (target != null) {
+ target.delete();
+ }
e.printStackTrace();
target = null;
}
@@ -189,6 +192,9 @@ public class Hprof implements ClassDataRetriever {
out.write(arg0);
out.close();
} catch (Exception e) {
+ if (target != null) {
+ target.delete();
+ }
e.printStackTrace();
target = null;
}
@@ -215,6 +221,8 @@ public class Hprof implements ClassDataRetriever {
return analyzeHprof(hprofLocalFile);
} catch (Exception e) {
throw new RuntimeException(e);
+ } finally {
+ hprofLocalFile.delete();
}
}
}