Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent NumberFormatException for huge versions of tags #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import java.util.regex.Matcher

class TagSupport {

static int tagOrder(String tagPattern, String tagName) {
static BigInteger tagOrder(String tagPattern, String tagName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, do you have a use case where the number of tags would be greater than Integer.MAX_VALUE ?

Matcher m = tagName =~ tagPattern
if (m.find()) {
int ngroups = m.groupCount()
if (ngroups < 1) {
throw new IllegalArgumentException("Tag pattern is expected to have at least one number grouping instruction: $tagPattern")
} else {
return m.group(1) as int
return new BigInteger(m.group(1))
}
} else {
throw new IllegalStateException("Tag $tagName should have matched $tagPattern")
Expand Down