From d1d989ee04430afa9c8e1ad3f2d2ccd8347eac3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 24 Oct 2013 22:58:55 +0200 Subject: [PATCH] Throw a duplicate field exception when a duplicate field is parsed. --- src/main/java/net/pterodactylus/sone/core/SoneParser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/core/SoneParser.java b/src/main/java/net/pterodactylus/sone/core/SoneParser.java index 04d095a..7dc0744 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneParser.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneParser.java @@ -153,7 +153,7 @@ public class SoneParser { profile.setField(profile.addField(fieldName), fieldValue); } catch (IllegalArgumentException iae1) { logger.log(Level.WARNING, String.format("Duplicate field: %s", fieldName), iae1); - return null; + throw new DuplicateField(); } } } @@ -355,4 +355,8 @@ public class SoneParser { public static class MalformedXml extends RuntimeException { } + + public static class DuplicateField extends RuntimeException { + + } } -- 2.7.4