From ec6fcea7eb3b1013db8b26ff65327d3ab24077c9 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 09 Sep 2016 09:45:26 +0000
Subject: [PATCH] OPENDJ-3089 Several minor fixes from the PR
---
opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
index d89358d..9b1af2b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
@@ -1780,14 +1780,11 @@
public static boolean deleteFiles(Iterable<File> files)
{
boolean allDeleted = true;
- if (files != null)
+ for (File f : files)
{
- for (File f : files)
+ if (!f.isDirectory())
{
- if (!f.isDirectory())
- {
- allDeleted = f.delete() && allDeleted;
- }
+ allDeleted &= f.delete();
}
}
return allDeleted;
@@ -1897,6 +1894,27 @@
}
/**
+ * Returns the sorted list of names of provided files.
+ *
+ * @param files
+ * The files to sort and get the names of
+ * @return the sorted list of file names
+ */
+ public static List<String> getFileNames(final File[] files)
+ {
+ final List<String> names = new ArrayList<>(files.length);
+ for (final File f : files)
+ {
+ if (f.isFile())
+ {
+ names.add(f.getName());
+ }
+ }
+ Collections.sort(names);
+ return names;
+ }
+
+ /**
* Retrieves a {@code File} object corresponding to the specified path.
* If the given path is an absolute path, then it will be used. If the path
* is relative, then it will be interpreted as if it were relative to the
--
Gitblit v1.10.0