-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 8, 11, 12
-
Component/s: core-libs
-
b13
-
generic
-
generic
-
Verified
A DESCRIPTION OF THE PROBLEM :
The documentation for Matcher.group() does not mention that it can return null, however when using Matcher#usePattern after a successful match, the method will return null.
---------- BEGIN SOURCE ----------
Matcher matcher = Pattern.compile("a").matcher("a");
matcher.find();
matcher.usePattern(Pattern.compile("pattern"));
System.out.println(matcher.group()); // returns null
---------- END SOURCE ----------
The documentation for Matcher.group() does not mention that it can return null, however when using Matcher#usePattern after a successful match, the method will return null.
---------- BEGIN SOURCE ----------
Matcher matcher = Pattern.compile("a").matcher("a");
matcher.find();
matcher.usePattern(Pattern.compile("pattern"));
System.out.println(matcher.group()); // returns null
---------- END SOURCE ----------
- csr for
-
JDK-8274663 Matcher.group() can return null after usePattern
-
- Closed
-