Skip to content

Commit

Permalink
fix some nits
Browse files Browse the repository at this point in the history
  • Loading branch information
vladak committed Apr 18, 2024
1 parent 596074c commit a5178be
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

/*
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
* Portions Copyright (c) 2019, Chris Fraire <[email protected]>.
*/
package org.opengrok.indexer.util;
Expand Down Expand Up @@ -54,6 +54,10 @@ public class CtagsUtil {

public static final String SYSTEM_CTAGS_PROPERTY = "org.opengrok.indexer.analysis.Ctags";

/** Private to enforce static. */
private CtagsUtil() {
}

/**
* Check that {@code ctags} program exists and is working.
* @param ctagsBinary name of the ctags program or path
Expand Down Expand Up @@ -163,7 +167,7 @@ public static Set<String> getLanguages(String ctagsBinary) {
Set<String> result = new HashSet<>();
for (String lang : split) {
lang = lang.trim();
if (lang.length() > 0) {
if (!lang.isEmpty()) {
result.add(lang);
}
}
Expand Down Expand Up @@ -192,7 +196,7 @@ public static void deleteTempFiles() {
continue;
}

LOGGER.log(Level.FINER, "deleting Ctags temporary files in directory {0}", directoryName);
LOGGER.log(Level.FINER, "deleting Ctags temporary files in directory ''{0}''", directoryName);
deleteTempFiles(directory);
}
}
Expand All @@ -205,14 +209,18 @@ private static void deleteTempFiles(File directory) {
return matcher.find();
});

if (Objects.isNull(files)) {
return;
}

for (File file : files) {
if (file.isFile() && !file.delete()) {
LOGGER.log(Level.WARNING, "cannot delete file {0}", file);
if (file.isFile()) {
try {
Files.delete(file.toPath());
} catch (IOException exception) {
LOGGER.log(Level.WARNING, String.format("cannot delete file '%s'", file), exception);
}
}
}
}

/** Private to enforce static. */
private CtagsUtil() {
}
}

0 comments on commit a5178be

Please sign in to comment.