commit 8456cb154a91f3669507b99b988f9584c895bbc0 Author: iwakeh iwakeh@torproject.org Date: Sun May 14 17:31:28 2017 +0000
Make all tests pass. Implements task-22217. --- src/main/java/org/torproject/descriptor/impl/ParseHelper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/torproject/descriptor/impl/ParseHelper.java b/src/main/java/org/torproject/descriptor/impl/ParseHelper.java index 0d4a27a..4b70731 100644 --- a/src/main/java/org/torproject/descriptor/impl/ParseHelper.java +++ b/src/main/java/org/torproject/descriptor/impl/ParseHelper.java @@ -516,11 +516,15 @@ public class ParseHelper { /* Handle below. */ } } - if (key == null) { + if (key == null || key.isEmpty()) { throw new DescriptorParseException("Line '" + line + "' contains " + "an illegal key or value in list element '" + listElement + "'."); } + if (result.keySet().contains(key)) { + throw new DescriptorParseException("Line '" + line + "' contains " + + "an already defined key '" + key + "'."); + } result.put(key, value); } return result;
tor-commits@lists.torproject.org