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-text.git
The following commit(s) were added to refs/heads/master by this push:
new 742fac01 Stop ExtendedMessageFormat seekNonWs reading past the pattern
end (#759).
742fac01 is described below
commit 742fac016285eca078e56a22c713f49a395c2d22
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Jul 2 20:05:10 2026 +0000
Stop ExtendedMessageFormat seekNonWs reading past the pattern end
(#759).
---
src/changes/changes.xml | 1 +
src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2d8423c0..dc05b644 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -63,6 +63,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="alhuda, Gary Gregory">Keep
WordUtils.wrap from splitting a surrogate pair (#755).</action>
<action type="fix" dev="ggregory" due-to="alhuda, Gary Gregory">Fix
WordUtils.containsAllWords missing words across line breaks (#754).</action>
<action type="fix" dev="ggregory" due-to="alhuda, Gary Gregory">Keep
TextStringBuilder.reverse from splitting surrogate pairs (#756).</action>
+ <action type="fix" dev="ggregory" due-to="Javid Khan, Gary Gregory">Stop
ExtendedMessageFormat seekNonWs reading past the pattern end (#759).</action>
<!-- ADD -->
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump
org.apache.commons:commons-parent from 93 to 102.</action>
diff --git
a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
index a4838f60..5af24ee5 100644
--- a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
@@ -238,6 +238,10 @@ class ExtendedMessageFormatTest {
@Test
void testTruncatedFormatElementWithRegistry() {
+ // Sanity check to match JRE
+ assertThrowsExactly(IllegalArgumentException.class, () -> new
MessageFormat("{"));
+ assertThrowsExactly(IllegalArgumentException.class, () -> new
MessageFormat("{0,"));
+ assertThrowsExactly(IllegalArgumentException.class, () -> new
MessageFormat("{0}extra{"));
// A format element left unterminated at the end of the pattern used
to make the
// registry-based constructor seek one past the buffer and throw
// ArrayIndexOutOfBoundsException; it should report the documented