This is an automated email from the ASF dual-hosted git repository. pottlinger pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
commit a0214caa71be83458094d5a2db86c8996dad71f0 Author: P. Ottlinger <[email protected]> AuthorDate: Mon May 5 17:49:04 2025 +0200 RAT-398: Apply suggested code change to template --- .../test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java | 2 +- apache-rat-tools/src/main/resources/Args.tpl | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java b/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java index 6e424032..d776f0ab 100644 --- a/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java +++ b/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; public class HeaderCheckWorkerTest { @Test - public void emptyInputIsUnknownTest() throws Exception { + public void emptyInputIsUnknownTest() throws RatHeaderAnalysisException { final Document subject = new TestingDocument("subject"); subject.getMetaData().setApprovalPredicate(Defaults.builder().build().getLicenseSetFactory().getApprovedLicensePredicate()); ILicense matcher = new TestingLicense("test", "test"); diff --git a/apache-rat-tools/src/main/resources/Args.tpl b/apache-rat-tools/src/main/resources/Args.tpl index d21bc579..c30422d5 100644 --- a/apache-rat-tools/src/main/resources/Args.tpl +++ b/apache-rat-tools/src/main/resources/Args.tpl @@ -101,11 +101,7 @@ if (DefaultLog.getInstance().isEnabled(Log.Level.DEBUG)) { DefaultLog.getInstance().debug(String.format("Adding [%s] to %s", String.join(", ", Arrays.asList(value)), key)); } - List<String> values = args.get(key); - if (values == null) { - values = new ArrayList<>(); - args.put(key, values); - } + List<String> values = args.computeIfAbsent(key, k -> new ArrayList<>()); values.addAll(newValues); } }
