Skip to content

Commit 236e66c

Browse files
committed
added check for parsing DatasetDescription to avoid OutOfBoundsException
1 parent 6fdb791 commit 236e66c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/java/org/variantsync/diffdetective/datasets/DatasetDescription.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.variantsync.diffdetective.datasets;
22

3+
import org.tinylog.Logger;
34
import org.variantsync.diffdetective.util.LaTeX;
45
import org.variantsync.diffdetective.util.StringUtils;
56

@@ -47,6 +48,17 @@ public static List<DatasetDescription> fromMarkdown(final Path markdownFile) thr
4748
return lines
4849
.skip(2) // Skip header
4950
.map(line -> line.split("\\|"))
51+
.filter(cells -> {
52+
if (cells.length != 7) {
53+
Logger.error("Skipping ill-formed line "
54+
+ String.join("|", cells)
55+
+ "! Expected 7 entries in a table (separated by |) but got "
56+
+ cells.length
57+
+ "!");
58+
return false;
59+
}
60+
return true;
61+
})
5062
.filter(cells ->
5163
isYes(cells[2]) && // hasCode
5264
isYes(cells[3]) // isGitRepo

0 commit comments

Comments
 (0)