-
Notifications
You must be signed in to change notification settings - Fork 44
Description
When reviewing the difference messages it appears in failures to match tokens that the message returned is for the token after the failed match.
Spdx-Java-Library/src/main/java/org/spdx/utility/compare/CompareTemplateOutputHandler.java
Line 794 in 0906908
| String nextMatchToken = LicenseTextHelper.getTokenAt(matchTokens, matchTokenCounter++); |
String nextMatchToken = LicenseTextHelper.getTokenAt(matchTokens, matchTokenCounter++);
This line gets the next token to match but also increments the counter so that on line 851 when the negative value of this is returned the result message identifies the token after the failed match.
alphabet = "a b c d e f g h i j k l m n o p q r s t u v w x y z" template = "a b c d e f g h i j k l m n o p q r s t u v w x y zebra was here"
When comparing these two the DifferenceDescription message appears as:
Normal text of license does not match starting at line #1 column #58 "was" when comparing to template text "a b c d e f g h i j k l m n o p q r s t u v w x y z"
If line 851 returned the index of the tokens that did not match taking into account any of the skipping I believe this would resolve. If time allows I will work on a PR with supporting test cases but wanted to raise the issue first.