From d761b0ee5cf531ddca915f22648ab5c983fb9c67 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sat, 14 Jan 2017 12:10:33 +0100 Subject: [PATCH] #1055 Fix verifyMessages task not to shift comments up --- .../messages/MessageFileElementReader.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/test/java/tools/messages/MessageFileElementReader.java b/src/test/java/tools/messages/MessageFileElementReader.java index 337ec53d5..54d08b50e 100644 --- a/src/test/java/tools/messages/MessageFileElementReader.java +++ b/src/test/java/tools/messages/MessageFileElementReader.java @@ -38,19 +38,17 @@ public class MessageFileElementReader { private void loadElements(Path path) { List currentCommentSection = new ArrayList<>(10); for (String line : FileIoUtils.readLinesFromFile(path)) { - if (isTodoComment(line)) { - continue; - } - if (isCommentLine(line)) { currentCommentSection.add(line); - } else if (MessageFileEntry.isMessageEntry(line)) { + } else { if (!currentCommentSection.isEmpty()) { processTempCommentsList(currentCommentSection); } - elements.add(new MessageFileEntry(line)); - } else { - throw new IllegalStateException("Could not match line '" + line + "' to any type"); + if (MessageFileEntry.isMessageEntry(line)) { + elements.add(new MessageFileEntry(line)); + } else if (!isTodoComment(line)) { + throw new IllegalStateException("Could not match line '" + line + "' to any type"); + } } } } @@ -69,7 +67,8 @@ public class MessageFileElementReader { } private static boolean isCommentLine(String line) { - return line.trim().isEmpty() || line.trim().startsWith("#"); + return !isTodoComment(line) + && (line.trim().isEmpty() || line.trim().startsWith("#")); } private static boolean isTodoComment(String line) {