This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi-xmlbeans.git
The following commit(s) were added to refs/heads/trunk by this push:
new 080c7593 simplify the applyWhiteSpaceRule collapse fast path (#155)
080c7593 is described below
commit 080c75936303ced21fcdcd9011ab61647af10345
Author: PJ Fanning <[email protected]>
AuthorDate: Tue Nov 3 11:20:33 2026 +0100
simplify the applyWhiteSpaceRule collapse fast path (#155)
Any tab, newline or carriage return, or a space after a space, needs
the full rule. Check those characters directly instead of tracking
lastWasWhite, matching the WS_REPLACE branch. No behaviour change.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
src/main/java/org/apache/xmlbeans/impl/store/Locale.java | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/xmlbeans/impl/store/Locale.java
b/src/main/java/org/apache/xmlbeans/impl/store/Locale.java
index 57f140c7..45f4b0cd 100755
--- a/src/main/java/org/apache/xmlbeans/impl/store/Locale.java
+++ b/src/main/java/org/apache/xmlbeans/impl/store/Locale.java
@@ -1093,17 +1093,11 @@ public final class Locale
return processWhiteSpaceRule(s, wsr);
}
- boolean lastWasWhite = false;
-
for (int i = 1; i < l; i++) {
- ch = s.charAt(i);
- boolean isWhite = CharUtil.isWhiteSpace(ch);
-
- if (isWhite && (lastWasWhite || ch != ' ')) {
+ if ((ch = s.charAt(i)) == '\n' || ch == '\r' || ch == '\t' ||
+ (ch == ' ' && s.charAt(i - 1) == ' ')) {
return processWhiteSpaceRule(s, wsr);
}
-
- lastWasWhite = isWhite;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]