summaryrefslogtreecommitdiff
path: root/ravenwood/junit-impl-src/android
diff options
context:
space:
mode:
author Makoto Onuki <omakoto@google.com> 2024-10-25 16:25:55 -0700
committer Makoto Onuki <omakoto@google.com> 2024-10-25 16:33:02 -0700
commit0f9e09d74b6ce58c0b6509446141b17b898d2419 (patch)
treee2bed15230104036f7d0a672ae4c59df9a081f6a /ravenwood/junit-impl-src/android
parent70e8833a2ef6c364b07b4b41abc3e8c94ddde920 (diff)
Fix how we delete the symlink
The previous way of checking the file existance would be fooled if the symlink exists but the target doesn't. Flag: EXEMPT host test change only Fix: 369687596 Test: manual $ rm /tmp/Ravenwood-stats_CtsOsTestCasesRavenwood_2*.csv # remove only the target $ atest CtsOsTestCasesRavenwood Change-Id: I84c94ca5913182a06422f71743a3b809ab805fda
Diffstat (limited to 'ravenwood/junit-impl-src/android')
-rw-r--r--ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java4
1 files changed, 1 insertions, 3 deletions
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java
index b4b871524291..016de8e45291 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java
@@ -90,9 +90,7 @@ public class RavenwoodTestStats {
// Create the "latest" symlink.
Path symlink = Paths.get(tmpdir, basename + "latest.csv");
try {
- if (Files.exists(symlink)) {
- Files.delete(symlink);
- }
+ Files.deleteIfExists(symlink);
Files.createSymbolicLink(symlink, Paths.get(mOutputFile.getName()));
} catch (IOException e) {