From ee4a0b93b4df0766ccc2af183b2b2876560c25a2 Mon Sep 17 00:00:00 2001 From: Ian Koerich Maciel Date: Fri, 25 May 2018 17:11:39 -0300 Subject: [PATCH] Fix parser to work with empty lines after EOF An exception (data after EOF) was thrown everytime a empty line appears after the EOF record. Some Intel Hex files do have an extra blank line which couldn't be used with this parser. Appling this fix, the parser will ignore the record if it's an empty line. --- src/cz/jaybee/intelhex/Parser.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cz/jaybee/intelhex/Parser.java b/src/cz/jaybee/intelhex/Parser.java index 4961359..1ac1051 100644 --- a/src/cz/jaybee/intelhex/Parser.java +++ b/src/cz/jaybee/intelhex/Parser.java @@ -217,6 +217,10 @@ public class Parser { String recordStr; while ((recordStr = reader.readLine()) != null) { + // Ignore if this is a blank line. + if (recordStr.isEmpty()) { + continue; + } Record record = parseRecord(recordStr); processRecord(record); recordIdx++;