Merge "Clean up local hprofs" am: 9ab94e15c7 am: 1876d82450 am: 67fd9f3968
am: bf5546b1e2
Change-Id: I0a84ef4f43e10cc9692b5541eb3379b042daab17
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 21b7a04..84ec8b7 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 @@
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 @@
out.write(arg0);
out.close();
} catch (Exception e) {
+ if (target != null) {
+ target.delete();
+ }
e.printStackTrace();
target = null;
}
@@ -215,6 +221,8 @@
return analyzeHprof(hprofLocalFile);
} catch (Exception e) {
throw new RuntimeException(e);
+ } finally {
+ hprofLocalFile.delete();
}
}
}