Open pmonks opened 3 weeks ago
I did a quick look at the code and the out of bound is likely caused by an a substring range where the end is before the start.
I can see a corner case where this can happen if the pattern searching for the end of the license happens to also match the pattern before the start of the license.
We could add a check for this and look for a following match if this occurs.
The code to be updated is in the findTemplateInText method.
When calling
org.spdx.utility.compare.LicenseCompareHelper.matchingStandardLicenseIdsWithinText()
, I'm getting aStringIndexOutOfBoundsException
thrown from withinorg.spdx.utility.compare.TemplateRegexMatcher.findTemplateWithinText()
because the start index is larger than the end index. At this time I'm not sure exactly what the values of the arguments are to that method that are causing the issue, but I'll start trying to track that down next. This used to work with SPDX License List v3.23, so it's possible this is related to something that changed in SPDX License List v3.24.0.The full exception stack trace is as follows, and note that the formatting may look unfamiliar as Clojure has its own way of printing exception stack traces:
This was reproduced with Java v21.0.3+9, Spdx-Java-Library v1.1.11, and SPDX License List v3.24.0.