Skip to content

Commit b3379bf

Browse files
Auto-refactor lint cleanup
SequencedCollections: get(0) -> getFirst(), etc Add missing @NotNull/@nullable Simplify test assertions Map operation simplification Remove redundant throws clause Switch to parameterized log message C-style array -> Java-style array declaration Delete overridden methods identical to parent Switch statement -> enhanced switch statement Remove redundant imports
1 parent 3c4f2c9 commit b3379bf

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

server/bootstrap/src/org/labkey/bootstrap/LabKeyBootstrapClassLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public File getDeletedModulesDirectory()
377377
}
378378
catch (IOException x)
379379
{
380-
_log.info("Could not set hidden attribute on directory: " + deleted.getPath());
380+
_log.info("Could not set hidden attribute on directory: {}", deleted.getPath());
381381
}
382382
}
383383

server/bootstrap/src/org/labkey/bootstrap/ModuleArchive.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private String nameFromModuleXML(InputStream is) throws IOException
8787
@Override
8888
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
8989
{
90-
String parent = elementStack.isEmpty() ? "" : elementStack.get(elementStack.size()-1);
90+
String parent = elementStack.isEmpty() ? "" : elementStack.getLast();
9191
elementStack.add(qName+"#"+attributes.getValue("id"));
9292
if (qName.equals("property") && "bean#moduleBean".equals(parent))
9393
{
@@ -99,7 +99,7 @@ public void startElement(String uri, String localName, String qName, Attributes
9999
@Override
100100
public void endElement(String uri, String localName, String qName) throws SAXException
101101
{
102-
elementStack.remove(elementStack.size()-1);
102+
elementStack.removeLast();
103103
}
104104
});
105105

server/embedded/src/org/labkey/embedded/LabKeyDeleteAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private List<PathWithAttributes> selectFilesToDelete(Path basePath, List<PathWit
151151
if (logToRetain != null && !_copiedOriginal && logToRetain.getAttributes().size() > 0)
152152
{
153153
Path target = logToRetain.getPath().getParent().resolve("labkey-errors-" + DATE_FORMAT.format(new Date()) + ".log");
154-
LOGGER.info("Retaining labkey-errors.log file before it gets deleted by rotation. Copying to " + target);
154+
LOGGER.info("Retaining labkey-errors.log file before it gets deleted by rotation. Copying to {}", target);
155155

156156
try
157157
{
@@ -161,7 +161,7 @@ private List<PathWithAttributes> selectFilesToDelete(Path basePath, List<PathWit
161161
}
162162
catch (IOException e)
163163
{
164-
LOGGER.warn("Failed to retain error log file " + logToRetain.getPath(), e);
164+
LOGGER.warn("Failed to retain error log file {}", logToRetain.getPath(), e);
165165
}
166166
_copiedOriginal = true;
167167
}

server/embedded/src/org/labkey/embedded/LabKeySpringBootClassLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public LabKeySpringBootClassLoader(ClassLoader parent)
4343
if (is != null)
4444
{
4545
addURL(url);
46-
LOG.info("Added URL that resolves log4j2.xml to class loader: " + url);
46+
LOG.info("Added URL that resolves log4j2.xml to class loader: {}", url);
4747
}
4848
}
4949
catch (IOException e)
@@ -65,7 +65,7 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce
6565
ClassLoader parent = getParent();
6666
while (parent != null)
6767
{
68-
LOG.debug("Looking for SessionAppending - checking ClassLoader " + parent);
68+
LOG.debug("Looking for SessionAppending - checking ClassLoader {}", parent);
6969
if (parent.getClass().getName().equals("jdk.internal.loader.ClassLoaders$AppClassLoader") ||
7070
parent.getClass().getName().equals("org.springframework.boot.loader.launch.LaunchedClassLoader"))
7171
{

server/embedded/src/org/labkey/embedded/LabKeyTomcatServletWebServerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,12 @@ private String getPropValue(Map<Integer, String> propValues, Integer resourceKey
394394
{
395395
if (propValues == null)
396396
{
397-
LOG.debug(String.format("%1$s property was not provided, using default", propName));
397+
LOG.debug("{} property was not provided, using default", propName);
398398
return defaultValue;
399399
}
400400

401401
if (!propValues.containsKey(resourceKey))
402-
LOG.debug(String.format("%1$s property was not provided for resource [%2$s], using default [%3$s]", propName, resourceKey, defaultValue));
402+
LOG.debug("{} property was not provided for resource [{}], using default [{}]", propName, resourceKey, defaultValue);
403403

404404
String val = propValues.getOrDefault(resourceKey, defaultValue);
405405
return val != null && !val.isBlank() ? val.trim() : defaultValue;

0 commit comments

Comments
 (0)