You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/01/09 08:14:41 UTC

[logging-log4j-tools] 01/03: Nullability and cosmetic changes

This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j-tools.git

commit ec06e2147b15f620e8d5465f9f4eeae0e7020e76
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Sat Jan 7 21:57:12 2023 +0100

    Nullability and cosmetic changes
---
 .../logging/log4j/changelog/ChangelogEntry.java    | 21 +++++-----
 .../logging/log4j/changelog/ChangelogFiles.java    |  7 ++--
 .../logging/log4j/changelog/ChangelogRelease.java  | 20 +---------
 .../changelog/exporter/ChangelogExporter.java      | 42 ++++++++++----------
 .../log4j/changelog/exporter/FreeMarkerUtils.java  |  9 +++--
 .../log4j/changelog/importer/MavenChanges.java     | 40 +++++++++++--------
 .../changelog/importer/MavenChangesImporter.java   | 18 ++++-----
 .../changelog/releaser/ChangelogReleaser.java      | 39 ++++++++++---------
 .../log4j/changelog/util/AsciiDocUtils.java        | 40 -------------------
 .../logging/log4j/changelog/util/FileUtils.java    | 45 ++++++++++++----------
 .../log4j/changelog/util/PropertyUtils.java        |  3 ++
 .../logging/log4j/changelog/util/StringUtils.java  |  7 +++-
 .../logging/log4j/changelog/util/XmlReader.java    |  4 +-
 .../logging/log4j/changelog/util/XmlWriter.java    | 14 ++++---
 14 files changed, 139 insertions(+), 170 deletions(-)

diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogEntry.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogEntry.java
index df2d7a8..6d2b239 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogEntry.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogEntry.java
@@ -25,6 +25,7 @@ import org.apache.logging.log4j.changelog.util.StringUtils;
 import org.apache.logging.log4j.changelog.util.XmlReader;
 import org.apache.logging.log4j.changelog.util.XmlWriter;
 
+import edu.umd.cs.findbugs.annotations.Nullable;
 import org.w3c.dom.Element;
 
 public final class ChangelogEntry {
@@ -115,12 +116,12 @@ public final class ChangelogEntry {
     public void writeToXmlFile(final Path path) {
         XmlWriter.toFile(path, document -> {
 
-            // Create the `entry` root element.
+            // Create the `entry` root element
             final Element entryElement = document.createElement("entry");
             entryElement.setAttribute("type", type.toXmlAttribute());
             document.appendChild(entryElement);
 
-            // Create the `issue` elements.
+            // Create the `issue` elements
             issues.forEach(issue -> {
                 final Element issueElement = document.createElement("issue");
                 issueElement.setAttribute("id", issue.id);
@@ -128,7 +129,7 @@ public final class ChangelogEntry {
                 entryElement.appendChild(issueElement);
             });
 
-            // Create the `author` elements.
+            // Create the `author` elements
             authors.forEach(author -> {
                 final Element authorElement = document.createElement("author");
                 if (author.id != null) {
@@ -139,7 +140,7 @@ public final class ChangelogEntry {
                 entryElement.appendChild(authorElement);
             });
 
-            // Create the `description` element.
+            // Create the `description` element
             final Element descriptionElement = document.createElement("description");
             if (description.format != null) {
                 descriptionElement.setAttribute("format", description.format);
@@ -152,7 +153,7 @@ public final class ChangelogEntry {
 
     public static ChangelogEntry readFromXmlFile(final Path path) {
 
-        // Read the `entry` root element.
+        // Read the `entry` root element
         final Element entryElement = XmlReader.readXmlFileRootElement(path, "entry");
         final String typeAttribute = XmlReader.requireAttribute(entryElement, "type");
         final Type type;
@@ -162,7 +163,7 @@ public final class ChangelogEntry {
             throw XmlReader.failureAtXmlNode(error, entryElement, "`type` attribute read failure");
         }
 
-        // Read the `issue` elements.
+        // Read the `issue` elements
         final List<Issue> issues = XmlReader
                 .findChildElementsMatchingName(entryElement, "issue")
                 .map(issueElement -> {
@@ -172,13 +173,15 @@ public final class ChangelogEntry {
                 })
                 .collect(Collectors.toList());
 
-        // Read the `author` elements.
+        // Read the `author` elements
         final List<Author> authors = XmlReader
                 .findChildElementsMatchingName(entryElement, "author")
                 .map(authorElement -> {
+                    @Nullable
                     final String authorId = authorElement.hasAttribute("id")
                             ? authorElement.getAttribute("id")
                             : null;
+                    @Nullable
                     final String authorName = authorElement.hasAttribute("name")
                             ? authorElement.getAttribute("name")
                             : null;
@@ -193,13 +196,13 @@ public final class ChangelogEntry {
             throw XmlReader.failureAtXmlNode(entryElement, "no `author` elements found");
         }
 
-        // Read the `description` element.
+        // Read the `description` element
         final Element descriptionElement = XmlReader.requireChildElementMatchingName(entryElement, "description");
         final String descriptionFormat = XmlReader.requireAttribute(descriptionElement, "format");
         final String descriptionText = StringUtils.trimNullable(descriptionElement.getTextContent());
         final Description description = new Description(descriptionFormat, descriptionText);
 
-        // Create the instance.
+        // Create the instance
         return new ChangelogEntry(type, issues, authors, description);
 
     }
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogFiles.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogFiles.java
index 80bb697..df35b37 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogFiles.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogFiles.java
@@ -35,11 +35,10 @@ public final class ChangelogFiles {
     }
 
     public static Set<Integer> unreleasedDirectoryVersionMajors(final Path changelogDirectory) {
-        return FileUtils
-                .findAdjacentFiles(changelogDirectory, false)
+        return FileUtils.findAdjacentFiles(changelogDirectory, false, paths -> paths
                 .flatMap(path -> {
 
-                    // Only select directories matching with the `^\.(\d+)\.x\.x$` pattern.
+                    // Only select directories matching with the `^\.(\d+)\.x\.x$` pattern
                     final Pattern versionPattern = Pattern.compile("^\\.(\\d+)\\.x\\.x$");
                     final Matcher versionMatcher = versionPattern.matcher(path.getFileName().toString());
                     if (!versionMatcher.matches()) {
@@ -50,7 +49,7 @@ public final class ChangelogFiles {
                     return Stream.of(versionMajor);
 
                 })
-                .collect(Collectors.toSet());
+                .collect(Collectors.toSet()));
     }
 
     public static Path indexTemplateFile(final Path changelogDirectory) {
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogRelease.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogRelease.java
index 73df71a..2369ba7 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogRelease.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogRelease.java
@@ -18,7 +18,6 @@ package org.apache.logging.log4j.changelog;
 
 import java.nio.file.Path;
 
-import org.apache.logging.log4j.changelog.util.StringUtils;
 import org.apache.logging.log4j.changelog.util.XmlReader;
 import org.apache.logging.log4j.changelog.util.XmlWriter;
 
@@ -45,25 +44,10 @@ public final class ChangelogRelease {
     }
 
     public static ChangelogRelease readFromXmlFile(final Path path) {
-
-        // Read the XML file.
         final Element releaseElement = XmlReader.readXmlFileRootElement(path, "release");
-
-        // Read the `version` attribute.
-        final String version = StringUtils.trimNullable(releaseElement.getAttribute("version"));
-        if (version == null) {
-            throw new IllegalArgumentException("blank or missing attribute: `version`");
-        }
-
-        // Read the `date` attribute.
-        final String date = StringUtils.trimNullable(releaseElement.getAttribute("date"));
-        if (date == null) {
-            throw new IllegalArgumentException("blank or missing attribute: `date`");
-        }
-
-        // Create the instance.
+        final String version = XmlReader.requireAttribute(releaseElement, "version");
+        final String date = XmlReader.requireAttribute(releaseElement, "date");
         return new ChangelogRelease(version, date);
-
     }
 
 }
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java
index 2b04029..1ea18de 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java
@@ -34,22 +34,25 @@ public final class ChangelogExporter {
 
     public static void main(final String[] mainArgs) {
 
-        // Read arguments.
+        // Read arguments
         final ChangelogExporterArgs args = ChangelogExporterArgs.fromSystemProperties();
 
-        // Find release directories.
+        // Find release directories
         final List<Path> releaseDirectories = FileUtils
-                .findAdjacentFiles(args.changelogDirectory, true)
-                .filter(file -> file.toFile().isDirectory())
-                .sorted(Comparator.comparing(releaseDirectory -> {
-                    final Path releaseXmlFile = ChangelogFiles.releaseXmlFile(releaseDirectory);
-                    final ChangelogRelease changelogRelease = ChangelogRelease.readFromXmlFile(releaseXmlFile);
-                    return changelogRelease.date;
-                }))
-                .collect(Collectors.toList());
+                .findAdjacentFiles(
+                        args.changelogDirectory, true,
+                        paths -> paths
+                                .filter(file -> file.toFile().isDirectory())
+                                .sorted(Comparator.comparing(releaseDirectory -> {
+                                    final Path releaseXmlFile = ChangelogFiles.releaseXmlFile(releaseDirectory);
+                                    final ChangelogRelease changelogRelease =
+                                            ChangelogRelease.readFromXmlFile(releaseXmlFile);
+                                    return changelogRelease.date;
+                                }))
+                                .collect(Collectors.toList()));
         final int releaseDirectoryCount = releaseDirectories.size();
 
-        // Read the release information files.
+        // Read the release information files
         final List<ChangelogRelease> changelogReleases = releaseDirectories
                 .stream()
                 .map(releaseDirectory -> {
@@ -58,10 +61,10 @@ public final class ChangelogExporter {
                 })
                 .collect(Collectors.toList());
 
-        // Export releases.
+        // Export releases
         if (releaseDirectoryCount > 0) {
 
-            // Export each release directory.
+            // Export each release directory
             for (int releaseIndex = 0; releaseIndex < releaseDirectories.size(); releaseIndex++) {
                 final Path releaseDirectory = releaseDirectories.get(releaseIndex);
                 final ChangelogRelease changelogRelease = changelogReleases.get(releaseIndex);
@@ -79,7 +82,7 @@ public final class ChangelogExporter {
                 }
             }
 
-            // Report the operation.
+            // Report the operation
             if (releaseDirectoryCount == 1) {
                 System.out.format("exported a single release directory: `%s`%n", releaseDirectories.get(0));
             } else {
@@ -91,7 +94,7 @@ public final class ChangelogExporter {
 
         }
 
-        // Export unreleased.
+        // Export unreleased
         ChangelogFiles
                 .unreleasedDirectoryVersionMajors(args.changelogDirectory)
                 .stream()
@@ -111,7 +114,7 @@ public final class ChangelogExporter {
                     changelogReleases.add(upcomingRelease);
                 });
 
-        // Export the release index.
+        // Export the release index
         final Path changelogIndexTemplateFile = ChangelogFiles.indexTemplateFile(args.changelogDirectory);
         exportIndex(args.outputDirectory, changelogReleases, changelogIndexTemplateFile);
 
@@ -133,8 +136,7 @@ public final class ChangelogExporter {
 
     private static Map<ChangelogEntry.Type, List<ChangelogEntry>> readChangelogEntriesByType(
             final Path releaseDirectory) {
-        return FileUtils
-                .findAdjacentFiles(releaseDirectory, true)
+        return FileUtils.findAdjacentFiles(releaseDirectory, true, stream -> stream
                 // Sorting is needed to generate the same output between different runs
                 .sorted()
                 .map(ChangelogEntry::readFromXmlFile)
@@ -142,7 +144,7 @@ public final class ChangelogExporter {
                         changelogEntry -> changelogEntry.type,
                         // A sorted map is needed to generate the same output between different runs
                         TreeMap::new,
-                        Collectors.toList()));
+                        Collectors.toList())));
     }
 
     private static void exportRelease(
@@ -187,7 +189,7 @@ public final class ChangelogExporter {
     }
 
     private static String releaseChangelogFileName(final ChangelogRelease changelogRelease) {
-        // Using only the version (that is, avoiding the date) in the filename so that one can determine the link to the changelog of a particular release with only version information.
+        // Using only the version (that is, avoiding the date) in the filename so that one can determine the link to the changelog of a particular release with only version information
         return String.format("%s.adoc", changelogRelease.version);
     }
 
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/FreeMarkerUtils.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/FreeMarkerUtils.java
index 8feed61..9deafcd 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/FreeMarkerUtils.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/FreeMarkerUtils.java
@@ -38,17 +38,18 @@ final class FreeMarkerUtils {
 
     @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME")
     private static Configuration createConfiguration() {
-        Configuration configuration = new Configuration(Configuration.VERSION_2_3_29);
+        final Configuration configuration = new Configuration(Configuration.VERSION_2_3_29);
         configuration.setDefaultEncoding(CharsetUtils.CHARSET_NAME);
         configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
         try {
             configuration.setTemplateLoader(new FileTemplateLoader(new File("/")));
-        } catch (IOException error) {
+        } catch (final IOException error) {
             throw new UncheckedIOException(error);
         }
-        DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_27);
+        final DefaultObjectWrapperBuilder objectWrapperBuilder =
+                new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_27);
         objectWrapperBuilder.setExposeFields(true);
-        DefaultObjectWrapper objectWrapper = objectWrapperBuilder.build();
+        final DefaultObjectWrapper objectWrapper = objectWrapperBuilder.build();
         configuration.setObjectWrapper(objectWrapper);
         configuration.setLogTemplateExceptions(false);
         configuration.setWrapUncheckedExceptions(true);
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChanges.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChanges.java
index 4a2d579..1633186 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChanges.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChanges.java
@@ -23,6 +23,7 @@ import java.util.Locale;
 
 import org.apache.logging.log4j.changelog.util.XmlReader;
 
+import edu.umd.cs.findbugs.annotations.Nullable;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -42,13 +43,13 @@ final class MavenChanges {
 
     static MavenChanges readFromFile(final Path file) {
 
-        // Read the root element.
+        // Read the root element
         final Element documentElement = readXmlFileRootElement(file, "document");
 
-        // Read the `body` element.
+        // Read the `body` element
         final Element bodyElement = XmlReader.requireChildElementMatchingName(documentElement, "body");
 
-        // Read releases.
+        // Read releases
         final List<Release> releases = new ArrayList<>();
         final NodeList releaseNodes = bodyElement.getChildNodes();
         final int releaseNodeCount = releaseNodes.getLength();
@@ -61,7 +62,7 @@ final class MavenChanges {
             }
         }
 
-        // Create the instance.
+        // Create the instance
         return new MavenChanges(releases);
 
     }
@@ -82,20 +83,20 @@ final class MavenChanges {
 
         private static Release fromElement(final Element element) {
 
-            // Read `version`.
+            // Read `version`
             final String version = trimNullable(element.getAttribute("version"));
             if (isBlank(version)) {
                 throw XmlReader.failureAtXmlNode(element, "blank attribute: `version`");
             }
 
-            // Read `date`.
+            // Read `date`
             final String date = trimNullable(element.getAttribute("date"));
             final String datePattern = "^(TBD|[0-9]{4}-[0-9]{2}-[0-9]{2})$";
             if (!date.matches(datePattern)) {
                 throw XmlReader.failureAtXmlNode(element, "`date` doesn't match with the `%s` pattern: `%s`", datePattern, date);
             }
 
-            // Read actions.
+            // Read actions
             final List<Action> actions = new ArrayList<>();
             final NodeList actionNodes = element.getChildNodes();
             final int actionNodeCount = actionNodes.getLength();
@@ -108,7 +109,7 @@ final class MavenChanges {
                 }
             }
 
-            // Create the instance.
+            // Create the instance
             return new Release(version, date, actions);
 
         }
@@ -122,12 +123,14 @@ final class MavenChanges {
 
     static final class Action {
 
+        @Nullable
         final String issue;
 
         final Type type;
 
         final String dev;
 
+        @Nullable
         final String dueTo;
 
         final String description;
@@ -135,10 +138,10 @@ final class MavenChanges {
         enum Type {ADD, FIX, UPDATE, REMOVE}
 
         private Action(
-                final String issue,
+                @Nullable final String issue,
                 final Type type,
                 final String dev,
-                final String dueTo,
+                @Nullable final String dueTo,
                 final String description) {
             this.issue = issue;
             this.type = type;
@@ -149,7 +152,8 @@ final class MavenChanges {
 
         private static Action fromElement(final Element element) {
 
-            // Read `issue`.
+            // Read `issue`
+            @Nullable
             String issue = trimNullable(element.getAttribute("issue"));
             final String issuePattern = "^LOG4J2-[0-9]+$";
             if (isBlank(issue)) {
@@ -158,7 +162,8 @@ final class MavenChanges {
                 throw XmlReader.failureAtXmlNode(element, "`issue` doesn't match with the `%s` pattern: `%s`", issuePattern, issue);
             }
 
-            // Read `type`.
+            // Read `type`
+            @Nullable
             final String typeString = trimNullable(element.getAttribute("type"));
             final Type type;
             if (isBlank(typeString)) {
@@ -171,25 +176,28 @@ final class MavenChanges {
                 }
             }
 
-            // Read `dev`.
+            // Read `dev`
+            @Nullable
             final String dev = trimNullable(element.getAttribute("dev"));
             if (isBlank(dev)) {
                 throw XmlReader.failureAtXmlNode(element, "blank attribute: `dev`");
             }
 
-            // Read `dueTo`.
+            // Read `dueTo`
+            @Nullable
             String dueTo = trimNullable(element.getAttribute("due-to"));
             if (isBlank(dueTo)) {
                 dueTo = null;
             }
 
-            // Read `description`.
+            // Read `description`
+            @Nullable
             final String description = trimNullable(element.getTextContent());
             if (isBlank(description)) {
                 throw XmlReader.failureAtXmlNode(element, "blank `description`");
             }
 
-            // Create the instance.
+            // Create the instance
             return new Action(issue, type, dev, dueTo, description);
 
         }
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChangesImporter.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChangesImporter.java
index a66d973..318f0c9 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChangesImporter.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/importer/MavenChangesImporter.java
@@ -52,15 +52,15 @@ public final class MavenChangesImporter {
 
     private static void writeReleased(final Path changelogDirectory, final MavenChanges.Release release) {
 
-        // Determine the directory for this particular release.
+        // Determine the directory for this particular release
         final Path releaseDirectory = ChangelogFiles.releaseDirectory(changelogDirectory, release.version);
 
-        // Write release information.
+        // Write release information
         final Path releaseFile = ChangelogFiles.releaseXmlFile(releaseDirectory);
         final ChangelogRelease changelogRelease = new ChangelogRelease(release.version, release.date);
         changelogRelease.writeToXmlFile(releaseFile);
 
-        // Write release actions.
+        // Write release actions
         release.actions.forEach(action -> writeAction(releaseDirectory, action));
 
     }
@@ -92,10 +92,10 @@ public final class MavenChangesImporter {
 
     private static ChangelogEntry changelogEntry(final MavenChanges.Action action) {
 
-        // Create the `type`.
+        // Create the `type`
         final ChangelogEntry.Type type = changelogType(action.type);
 
-        // Create the `issue`s.
+        // Create the `issue`s
         final List<ChangelogEntry.Issue> issues = new ArrayList<>(1);
         if (action.issue != null) {
             final String issueLink = String.format("https://issues.apache.org/jira/browse/%s", action.issue);
@@ -103,7 +103,7 @@ public final class MavenChangesImporter {
             issues.add(issue);
         }
 
-        // Create the `author`s.
+        // Create the `author`s
         final List<ChangelogEntry.Author> authors = new ArrayList<>(2);
         for (final String authorId : action.dev.split("\\s*,\\s*")) {
             if (!isBlank(authorId)) {
@@ -114,16 +114,16 @@ public final class MavenChangesImporter {
             authors.add(new ChangelogEntry.Author(null, action.dueTo));
         }
 
-        // Create the `description`.
+        // Create the `description`
         final ChangelogEntry.Description description = new ChangelogEntry.Description("asciidoc", action.description);
 
-        // Create the instance.
+        // Create the instance
         return new ChangelogEntry(type, issues, authors, description);
 
     }
 
     /**
-     * Maps `maven-changes-plugin` action types to their `Keep a Changelog` equivalents.
+     * Maps {@code maven-changes-plugin} action types to their {@code Keep a Changelog} equivalents.
      */
     private static ChangelogEntry.Type changelogType(final MavenChanges.Action.Type type) {
         if (MavenChanges.Action.Type.ADD.equals(type)) {
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java
index 199ba79..55b4fca 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java
@@ -35,23 +35,23 @@ public final class ChangelogReleaser {
 
     public static void main(final String[] mainArgs) throws Exception {
 
-        // Read arguments.
+        // Read arguments
         final ChangelogReleaserArgs args = ChangelogReleaserArgs.fromSystemProperties();
 
-        // Read the release date and version.
+        // Read the release date and version
         final String releaseDate = ISO_DATE.format(LocalDate.now());
         final int releaseVersionMajor = VersionUtils.versionMajor(args.releaseVersion);
         System.out.format("using `%s` for the release date%n", releaseDate);
 
-        // Populate the changelog entry files in the release directory.
+        // Populate the changelog entry files in the release directory
         final Path unreleasedDirectory = ChangelogFiles.unreleasedDirectory(args.changelogDirectory, releaseVersionMajor);
         final Path releaseDirectory = ChangelogFiles.releaseDirectory(args.changelogDirectory, args.releaseVersion);
         populateChangelogEntryFiles(unreleasedDirectory, releaseDirectory);
 
-        // Write the release information.
+        // Write the release information
         populateReleaseXmlFiles(releaseDate, args.releaseVersion, releaseDirectory);
 
-        // Write the release changelog template.
+        // Write the release changelog template
         populateReleaseChangelogTemplateFile(unreleasedDirectory, releaseDirectory);
 
     }
@@ -74,20 +74,21 @@ public final class ChangelogReleaser {
     }
 
     private static void moveUnreleasedChangelogEntryFiles(final Path unreleasedDirectory, final Path releaseDirectory) {
-        FileUtils
-                .findAdjacentFiles(unreleasedDirectory, true)
-                .forEach(unreleasedChangelogEntryFile -> {
-                    final String fileName = unreleasedChangelogEntryFile.getFileName().toString();
-                    final Path releasedChangelogEntryFile = releaseDirectory.resolve(fileName);
-                    System.out.format(
-                            "moving changelog entry file `%s` to `%s`%n",
-                            unreleasedChangelogEntryFile, releasedChangelogEntryFile);
-                    try {
-                        Files.move(unreleasedChangelogEntryFile, releasedChangelogEntryFile);
-                    } catch (final IOException error) {
-                        throw new UncheckedIOException(error);
-                    }
-                });
+        FileUtils.findAdjacentFiles(unreleasedDirectory, true, paths -> {
+            paths.forEach(unreleasedChangelogEntryFile -> {
+                final String fileName = unreleasedChangelogEntryFile.getFileName().toString();
+                final Path releasedChangelogEntryFile = releaseDirectory.resolve(fileName);
+                System.out.format(
+                        "moving changelog entry file `%s` to `%s`%n",
+                        unreleasedChangelogEntryFile, releasedChangelogEntryFile);
+                try {
+                    Files.move(unreleasedChangelogEntryFile, releasedChangelogEntryFile);
+                } catch (final IOException error) {
+                    throw new UncheckedIOException(error);
+                }
+            });
+            return 1;
+        });
     }
 
     private static void moveUnreleasedDirectory(
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/AsciiDocUtils.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/AsciiDocUtils.java
deleted file mode 100644
index a6a85f0..0000000
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/AsciiDocUtils.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.changelog.util;
-
-public final class AsciiDocUtils {
-
-    public static final String LICENSE_COMMENT_BLOCK = "////\n" +
-            "    Licensed to the Apache Software Foundation (ASF) under one or more\n" +
-            "    contributor license agreements.  See the NOTICE file distributed with\n" +
-            "    this work for additional information regarding copyright ownership.\n" +
-            "    The ASF licenses this file to You under the Apache License, Version 2.0\n" +
-            "    (the \"License\"); you may not use this file except in compliance with\n" +
-            "    the License.  You may obtain a copy of the License at\n" +
-            "\n" +
-            "         https://www.apache.org/licenses/LICENSE-2.0\n" +
-            "\n" +
-            "    Unless required by applicable law or agreed to in writing, software\n" +
-            "    distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
-            "    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
-            "    See the License for the specific language governing permissions and\n" +
-            "    limitations under the License.\n" +
-            "////\n";
-
-    private AsciiDocUtils() {}
-
-}
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/FileUtils.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/FileUtils.java
index c5200b4..72a8e5a 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/FileUtils.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/FileUtils.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.function.Function;
 import java.util.stream.Stream;
 
 public final class FileUtils {
@@ -33,27 +34,29 @@ public final class FileUtils {
      * </p>
      */
     @SuppressWarnings("RedundantIfStatement")
-    public static Stream<Path> findAdjacentFiles(final Path directory, final boolean dotFilesSkipped) {
-        try {
-            return Files
-                    .walk(directory, 1)
-                    .filter(path -> {
-
-                        // Skip the directory itself.
-                        if (path.equals(directory)) {
-                            return false;
-                        }
-
-                        // Skip hidden files.
-                        boolean hiddenFile = dotFilesSkipped && path.getFileName().toString().startsWith(".");
-                        if (hiddenFile) {
-                            return false;
-                        }
-
-                        // Accept the rest.
-                        return true;
-
-                    });
+    public static <V> V findAdjacentFiles(
+            final Path directory,
+            final boolean dotFilesSkipped,
+            final Function<Stream<Path>, V> consumer) {
+        try (final Stream<Path> paths = Files.walk(directory, 1)) {
+            final Stream<Path> filteredPaths = paths.filter(path -> {
+
+                // Skip the directory itself
+                if (path.equals(directory)) {
+                    return false;
+                }
+
+                // Skip hidden files
+                boolean hiddenFile = dotFilesSkipped && path.getFileName().toString().startsWith(".");
+                if (hiddenFile) {
+                    return false;
+                }
+
+                // Accept the rest
+                return true;
+
+            });
+            return consumer.apply(filteredPaths);
         } catch (final IOException error) {
             final String message = String.format("failed walking directory: `%s`", directory);
             throw new UncheckedIOException(message, error);
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/PropertyUtils.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/PropertyUtils.java
index c732736..b50db01 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/PropertyUtils.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/PropertyUtils.java
@@ -20,6 +20,8 @@ import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import edu.umd.cs.findbugs.annotations.Nullable;
+
 import static org.apache.logging.log4j.changelog.util.StringUtils.isBlank;
 
 public final class PropertyUtils {
@@ -47,6 +49,7 @@ public final class PropertyUtils {
     }
 
     public static String requireNonBlankStringProperty(final String key) {
+        @Nullable
         final String value = System.getProperty(key);
         if (isBlank(value)) {
             final String message = String.format("blank system property: `%s`", key);
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/StringUtils.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/StringUtils.java
index 886389d..1a084c2 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/StringUtils.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/StringUtils.java
@@ -16,15 +16,18 @@
  */
 package org.apache.logging.log4j.changelog.util;
 
+import edu.umd.cs.findbugs.annotations.Nullable;
+
 public final class StringUtils {
 
     private StringUtils() {}
 
-    public static String trimNullable(final String input) {
+    @Nullable
+    public static String trimNullable(@Nullable final String input) {
         return input != null ? input.trim() : null;
     }
 
-    public static boolean isBlank(final String input) {
+    public static boolean isBlank(@Nullable final String input) {
         return input == null || input.matches("\\s*");
     }
 
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlReader.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlReader.java
index a5eb9a8..7b3d405 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlReader.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlReader.java
@@ -16,8 +16,8 @@
  */
 package org.apache.logging.log4j.changelog.util;
 
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -43,7 +43,7 @@ public final class XmlReader {
     private XmlReader() {}
 
     public static Element readXmlFileRootElement(final Path path, final String rootElementName) {
-        try (final InputStream inputStream = new FileInputStream(path.toFile())) {
+        try (final InputStream inputStream = Files.newInputStream(path)) {
             final Document document = readXml(inputStream);
             final Element rootElement = document.getDocumentElement();
             if (!rootElementName.equals(rootElement.getNodeName())) {
diff --git a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlWriter.java b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlWriter.java
index 0bedf94..7577ed5 100644
--- a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlWriter.java
+++ b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/util/XmlWriter.java
@@ -30,6 +30,7 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import edu.umd.cs.findbugs.annotations.Nullable;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.w3c.dom.Comment;
 import org.w3c.dom.Document;
@@ -42,7 +43,8 @@ public final class XmlWriter {
         try {
             final String xml = toString(documentConsumer);
             final byte[] xmlBytes = xml.getBytes(CharsetUtils.CHARSET);
-            Path filepathParent = filepath.getParent();
+            @Nullable
+            final Path filepathParent = filepath.getParent();
             if (filepathParent != null) {
                 Files.createDirectories(filepathParent);
             }
@@ -56,11 +58,11 @@ public final class XmlWriter {
     public static String toString(final Consumer<Document> documentConsumer) {
         try {
 
-            // Create the document.
+            // Create the document
             final DocumentBuilderFactory documentBuilderFactory = XmlUtils.createDocumentBuilderFactory();
             final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
 
-            // Append the license comment.
+            // Append the license comment
             final Document document = documentBuilder.newDocument();
             document.setXmlStandalone(true);
             final Comment licenseComment = document.createComment("\n" +
@@ -81,10 +83,10 @@ public final class XmlWriter {
                     "\n");
             document.appendChild(licenseComment);
 
-            // Execute request changes.
+            // Execute request changes
             documentConsumer.accept(document);
 
-            // Serialize the document.
+            // Serialize the document
             return serializeXmlDocument(document);
 
         } catch (final Exception error) {
@@ -102,7 +104,7 @@ public final class XmlWriter {
         transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
         transformer.transform(source, result);
         return result.getWriter().toString()
-                // Life is too short to solve DOM transformer issues decently.
+                // Life is too short to solve DOM transformer issues decently
                 .replace("?><!--", "?>\n<!--")
                 .replace("--><", "-->\n<");
     }