[
https://issues.apache.org/jira/browse/OPENNLP-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18119508#comment-18119508
]
ASF GitHub Bot commented on OPENNLP-1932:
-----------------------------------------
rzo1 commented on PR #1278:
URL: https://github.com/apache/opennlp/pull/1278#issuecomment-5838082093
Thanks for the update, most of my points are addressed. I tried to push the
remaining small fixes directly, but GitHub doesn't allow maintainer edits on PR
branches of organization-owned forks (`ai-pipestream/opennlp`), so here is the
patch instead.
It does three things:
- `WildcardMatcher.matches` no longer repeats the null checks, since
`matchesWildcard` (its only caller) already validates. I dropped
`testMatchesRejectsNull` as well.
- `SimpleClassPathModelFinder.splitClassPath` is no longer `static`, and it
leaves the null check to `StringUtil.splitNonEmpty`.
- `README.md`: the "Migrating from 2.x to 3.x" section claimed there are no
breaking changes. It now lists the removal of `asRegex` / `matchesPattern`
under a new "Breaking changes" section.
Apply it on top of your branch with `git am`: save the block below as
`1278.patch`, then run `git am 1278.patch`. Please don't force-push over it
without applying it first.
<details>
<summary>1278.patch</summary>
```diff
From 175023a8ab52ab24e12d12fc92725334903db4b9 Mon Sep 17 00:00:00 2001
From: Richard Zowalla <[email protected]>
Date: Fri, 25 Sep 2026 21:05:52 +0200
Subject: [PATCH] OPENNLP-1932: Drop duplicated null checks and document the
breaking change
- WildcardMatcher.matches no longer repeats the null checks done by
AbstractClassPathModelFinder.matchesWildcard, its only caller.
- SimpleClassPathModelFinder.splitClassPath is no longer static and
relies on StringUtil.splitNonEmpty for argument validation.
- README: list the removal of asRegex and matchesPattern under
breaking changes in the 2.x to 3.x migration section.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
README.md | 6 +++++-
.../opennlp/tools/models/WildcardMatcher.java | 7 -------
.../simple/SimpleClassPathModelFinder.java | 5 +----
.../tools/models/WildcardMatcherTest.java | 16 ----------------
.../simple/SimpleClassPathModelFinderTest.java | 6 +++---
5 files changed, 9 insertions(+), 31 deletions(-)
diff --git a/README.md b/README.md
index 5a40f38e4..c0f5e0570 100644
-
> RegEx removal part 4: wildcard matching in the model resolver
> -------------------------------------------------------------
>
> Key: OPENNLP-1932
> URL: https://issues.apache.org/jira/browse/OPENNLP-1932
> Project: OpenNLP
> Issue Type: Improvement
> Reporter: Kristian Rickert
> Assignee: Kristian Rickert
> Priority: Major
> Fix For: 3.0.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> {{AbstractClassPathModelFinder}}, {{DirectoryModelFinder}}, and
> {{SimpleClassPathModelFinder}} converted wildcard strings to regular
> expressions and split the class path with compiled patterns. A
> package-private {{GlobMatcher}} now matches {{*}} (any run) and {{?}} (one
> code point) directly, anchored on the whole name and, as before, not crossing
> line terminators; the class path split is a character scan with
> {{String.split}} semantics.
> One behavior change, intended: characters the old conversion never quoted
> ({{( ) [ ] { } + | ^ $ \}}) had regex meaning or threw
> {{PatternSyntaxException}}; they are literal now.
> API: the protected {{asRegex}} and {{matchesPattern(URL, Pattern)}} on the
> public abstract {{AbstractClassPathModelFinder}} are replaced by protected
> {{matchesWildcard(URL, String)}}. No code in the repository used them; this
> is a 3.0 change.
> Verification: 39 globs by 46 inputs plus a 300,000-pair fuzz compared with
> the old regex path; all differences come from the unquoted characters above.
> {{GlobMatcherTest}} adds 64 cases and the module gains its first
> {{DirectoryModelFinderTest}}. The module pom adds the managed
> {{junit-jupiter-params}} dependency.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)