mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
Performance tests: use try-with-resources for dir child stream
GitOrigin-RevId: e8567eccbac8a043c3e0433f9fa85bf100f12264
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f1733d6305
commit
ad18944e3e
@@ -32,13 +32,11 @@ import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class BenchmarkTestInfoImpl implements BenchmarkTestInfo {
|
||||
private enum IterationMode {
|
||||
@@ -115,11 +113,20 @@ public class BenchmarkTestInfoImpl implements BenchmarkTestInfo {
|
||||
// remove content of the previous tests from the idea.log
|
||||
IJPerfBenchmarksMetricsPublisher.Companion.truncateTestLog();
|
||||
|
||||
var filesWithMetrics = Files.list(PathManager.getLogDir()).filter((it) ->
|
||||
it.toString().contains("-metrics") ||
|
||||
it.toString().contains("-meters")).toList();
|
||||
for (Path file : filesWithMetrics) {
|
||||
Files.deleteIfExists(file);
|
||||
try (Stream<Path> logDirChildren = Files.list(PathManager.getLogDir())) {
|
||||
logDirChildren.filter(child -> {
|
||||
String name = child.toString();
|
||||
return name.contains("-metrics")
|
||||
|| name.contains("-meters");
|
||||
})
|
||||
.forEach(childToRemove -> {
|
||||
try {
|
||||
Files.deleteIfExists(childToRemove);
|
||||
}
|
||||
catch (IOException e) {
|
||||
// ignore deletion errors for individual files
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user