From 530df5d1510d6e336fee3ad101707385eafd4460 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sun, 8 Jun 2025 15:00:51 -0700 Subject: [PATCH] Minor auto-refactor code cleanup on a massive scale --- .../src/org/apache/tools/ant/util/FileUtils.java | 8 ++++---- .../src/org/labkey/bootstrap/ArgumentParser.java | 4 ++-- .../src/org/labkey/bootstrap/ExplodedModule.java | 4 ++-- .../bootstrap/src/org/labkey/bootstrap/ModuleArchive.java | 2 +- .../src/org/labkey/bootstrap/ModuleDirectories.java | 3 +-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/server/bootstrap/src/org/apache/tools/ant/util/FileUtils.java b/server/bootstrap/src/org/apache/tools/ant/util/FileUtils.java index 26fcd7409b..f72dea3a0e 100644 --- a/server/bootstrap/src/org/apache/tools/ant/util/FileUtils.java +++ b/server/bootstrap/src/org/apache/tools/ant/util/FileUtils.java @@ -37,8 +37,8 @@ public class FileUtils // constants, for use in subsequent code (e.g., resolveFile()). These simplified versions should be identical. private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.US); private static final String PATH_SEP = System.getProperty("path.separator"); - private static boolean onNetWare = OS_NAME.contains("netware"); // Essentially what Os.isFamily("netware") does - private static boolean onDos = PATH_SEP.equals(";") && !onNetWare; // Essentially what Os.isFamily("dos") does + private static final boolean onNetWare = OS_NAME.contains("netware"); // Essentially what Os.isFamily("netware") does + private static final boolean onDos = PATH_SEP.equals(";") && !onNetWare; // Essentially what Os.isFamily("dos") does /** * Method to retrieve The FileUtils, which is shared by all users of this @@ -109,7 +109,7 @@ public File resolveFile(File file, String filename) { * @since Ant 1.7 */ public static boolean isContextRelativePath(String filename) { - if (!(onDos || onNetWare) || filename.length() == 0) { + if (!(onDos || onNetWare) || filename.isEmpty()) { return false; } char sep = File.separatorChar; @@ -222,7 +222,7 @@ public String[] dissect(String path) { if (!isAbsolutePath(path)) { throw new BuildException(path + " is not an absolute path"); } - String root = null; + String root; int colon = path.indexOf(':'); if (colon > 0 && (onDos || onNetWare)) { diff --git a/server/bootstrap/src/org/labkey/bootstrap/ArgumentParser.java b/server/bootstrap/src/org/labkey/bootstrap/ArgumentParser.java index df32ed8e97..bd6438d71f 100644 --- a/server/bootstrap/src/org/labkey/bootstrap/ArgumentParser.java +++ b/server/bootstrap/src/org/labkey/bootstrap/ArgumentParser.java @@ -24,8 +24,8 @@ */ public class ArgumentParser { - private List _params = new ArrayList<>(); - private Map _options = new HashMap<>(); + private final List _params = new ArrayList<>(); + private final Map _options = new HashMap<>(); public ArgumentParser(String[] args) { diff --git a/server/bootstrap/src/org/labkey/bootstrap/ExplodedModule.java b/server/bootstrap/src/org/labkey/bootstrap/ExplodedModule.java index 4528343393..c0a35e160a 100644 --- a/server/bootstrap/src/org/labkey/bootstrap/ExplodedModule.java +++ b/server/bootstrap/src/org/labkey/bootstrap/ExplodedModule.java @@ -64,9 +64,9 @@ public class ExplodedModule private static final FileComparator _fileComparator = new FileComparator(); - private File _rootDirectory; + private final File _rootDirectory; private File _sourceModuleFile; - private Map _watchedFiles = new HashMap<>(); + private final Map _watchedFiles = new HashMap<>(); public ExplodedModule(File rootDirectory) { diff --git a/server/bootstrap/src/org/labkey/bootstrap/ModuleArchive.java b/server/bootstrap/src/org/labkey/bootstrap/ModuleArchive.java index f2bc357099..4af3f40433 100644 --- a/server/bootstrap/src/org/labkey/bootstrap/ModuleArchive.java +++ b/server/bootstrap/src/org/labkey/bootstrap/ModuleArchive.java @@ -77,7 +77,7 @@ private String nameFromModuleXML(InputStream is) throws IOException SAXParser parser = SAXParserFactory.newDefaultInstance().newSAXParser(); parser.parse(is, new DefaultHandler() { - ArrayList elementStack = new ArrayList<>(); + final ArrayList elementStack = new ArrayList<>(); @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException diff --git a/server/bootstrap/src/org/labkey/bootstrap/ModuleDirectories.java b/server/bootstrap/src/org/labkey/bootstrap/ModuleDirectories.java index 1517c12455..2f79ee5377 100644 --- a/server/bootstrap/src/org/labkey/bootstrap/ModuleDirectories.java +++ b/server/bootstrap/src/org/labkey/bootstrap/ModuleDirectories.java @@ -16,7 +16,6 @@ package org.labkey.bootstrap; import java.io.File; -import java.io.IOException; import java.util.stream.Stream; /* @@ -33,7 +32,7 @@ public class ModuleDirectories public static final String DEFAULT_MODULES_DIR = "modules"; public static final String DEFAULT_EXTERNAL_MODULES_DIR = "externalModules"; - private File _modulesDirectory; + private final File _modulesDirectory; private File _externalModulesDirectory; public ModuleDirectories(File webAppDirectory)