RFR: Handle trailing blank lines in commit message

Jorn Vernee jvernee at openjdk.java.net
Tue Dec 1 11:46:43 UTC 2020

On Thu, 19 Nov 2020 13:51:24 GMT, Robin Westberg <rwestberg at openjdk.org> wrote:

> This change ensures that a commit message ending with a blank line does not generate an exception.

vcs/src/main/java/org/openjdk/skara/vcs/openjdk/CommitMessageParsers.java line 121:

> 119:                 if (i >= lines.size()) {
> 120:                     break;
> 121:                 }

I guess I'm a little confused as to how this fixes the problem :/ Is it because `firstDelimiter` is false after the first line and then it adds a blank?

Does it make sense to move the `i++` to the end of the while loop, and then increment it one time separately before the loop, so that the while loop condition can use the `i < lines.size()` condition, and no separate `if` is needed?


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

More information about the skara-dev mailing list