RFR: 402: Properly parse issue titles starting with non-alphanumeric characters

Jorn Vernee jvernee at openjdk.java.net
Mon May 25 13:45:12 UTC 2020


On Mon, 25 May 2020 06:43:25 GMT, Robin Westberg <rwestberg at openjdk.org> wrote:

> Hi all,
> 
> Please review this change that properly parses issue titles starting with a non-alphanumeric character.
> 
> Best regards,
> Robin

LGTM!

vcs/src/main/java/org/openjdk/skara/vcs/openjdk/Issue.java line 33:

> 32:
> 33:     private final static Pattern relaxedIssueParsePattern =
> Pattern.compile("^((?:[A-Z][A-Z0-9]+-)?[0-9]+)(?:(?:[^\\p{Alnum}]+\\s)|(?:\\s+))(\\S.*)$"); 34:

I think the `[^\\p{Alnum}]+\\s` pattern mostly subsumes the `\\s+` pattern? I think it can be simplified to:
Suggestion:

    private final static Pattern relaxedIssueParsePattern =
    Pattern.compile("^((?:[A-Z][A-Z0-9]+-)?[0-9]+)[^\\p{Alnum}]*\\s(\\S.*)$");
This passes the test locally.

-------------

Marked as reviewed by jvernee (Reviewer).

PR: https://git.openjdk.java.net/skara/pull/628


More information about the skara-dev mailing list