Commit f5789b74 by samrobinson Committed by tonihei

Make use of try with-resources to auto close file.

PiperOrigin-RevId: 412901581
parent 83408d06
......@@ -117,22 +117,19 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
throws IOException {
File analysisFile =
createExternalCacheFile(context, /* fileName= */ result.testId + "-result.txt");
FileWriter fileWriter = new FileWriter(analysisFile);
String fileContents =
"test="
+ result.testId
+ ", deviceBrand="
+ Build.MANUFACTURER
+ ", deviceModel="
+ Build.MODEL
+ ", sdkVersion="
+ Build.VERSION.SDK_INT
+ ", outputSizeBytes="
+ result.outputSizeBytes;
try {
try (FileWriter fileWriter = new FileWriter(analysisFile)) {
String fileContents =
"test="
+ result.testId
+ ", deviceBrand="
+ Build.MANUFACTURER
+ ", deviceModel="
+ Build.MODEL
+ ", sdkVersion="
+ Build.VERSION.SDK_INT
+ ", outputSizeBytes="
+ result.outputSizeBytes;
fileWriter.write(fileContents);
} finally {
fileWriter.close();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment