This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-release-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new c4a2768 Precompile Pattern in
ReadmeHtmlVelocityDelegate.render(Writer).
c4a2768 is described below
commit c4a2768f6ff10c6c77833f53010835e62a730c6b
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jul 26 18:37:22 2026 -0400
Precompile Pattern in ReadmeHtmlVelocityDelegate.render(Writer).
---
src/changes/changes.xml | 1 +
.../release/plugin/velocity/ReadmeHtmlVelocityDelegate.java | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 69c905b..db578de 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -26,6 +26,7 @@
<body>
<release version="1.9.3" date="YYYY-MM-DD" description="This is a feature
and maintenance release. Java 8 or later is required.">
<!-- FIX -->
+ <action type="update" dev="ggregory" due-to="Gary Gregory">Precompile
Pattern in ReadmeHtmlVelocityDelegate.render(Writer).</action>
<!-- ADD -->
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump
org.apache.commons:commons-parent from 96 to 103.</action>
diff --git
a/src/main/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegate.java
b/src/main/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegate.java
index 999f7e7..940c0cb 100644
---
a/src/main/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegate.java
+++
b/src/main/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegate.java
@@ -17,6 +17,7 @@
package org.apache.commons.release.plugin.velocity;
import java.io.Writer;
+import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.Template;
@@ -97,6 +98,11 @@ public final class ReadmeHtmlVelocityDelegate {
}
}
+ /**
+ * ".+\\d$" matches a non-empty string that terminates in a digit {0-9}.
+ */
+ private static final Pattern END_DIGIT = Pattern.compile(".+\\d$");
+
/** The location of the velocity template for this class. */
private static final String TEMPLATE =
"resources/org/apache/commons/release/plugin"
+ "/velocity/README.vm";
@@ -153,8 +159,7 @@ public final class ReadmeHtmlVelocityDelegate {
} else if (splitArtifactId.length == 1) {
artifactShortName = splitArtifactId[0];
}
- // ".+\\d$" matches a non-empty string that terminates in a digit
{0-9}.
- if (artifactShortName.matches(".+\\d$")) {
+ if (END_DIGIT.matcher(artifactShortName).matches()) {
artifactShortName = artifactShortName.substring(0,
artifactShortName.length() - 1);
}
final String artifactIdWithFirstLetterscapitalized =