diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/TestUnicodeInvariants.java b/unicodetools/src/main/java/org/unicode/text/UCD/TestUnicodeInvariants.java index ac507c58ed..c14f487219 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/TestUnicodeInvariants.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/TestUnicodeInvariants.java @@ -184,7 +184,7 @@ public static int testInvariants(String inputFile, String suffix, boolean doRang } final var noComments = new StringBuilder(); final List lines = new ArrayList<>(); - final List lineBeginnings = new ArrayList(); + final List lineBeginnings = new ArrayList<>(); try (final BufferedReader in = getInputReader(inputFile)) { in.lines() .forEach( @@ -233,8 +233,8 @@ public static int testInvariants(String inputFile, String suffix, boolean doRang final Function getLineNumber = position -> { for (int i = 0; i < lineBeginnings.size(); ++i) { - if (lineBeginnings.get(i) > position.getIndex()) { - return i; // 1-based line number. + if (lineBeginnings.get(i) >= position.getIndex()) { + return i + 1; // 1-based line number. } } return lineBeginnings.size();