Kristian Rickert created OPENNLP-1932:
-----------------------------------------

             Summary: 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


{{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)

Reply via email to