From: David ‘Bombe’ Roden Date: Thu, 24 Oct 2013 20:58:55 +0000 (+0200) Subject: Throw a duplicate field exception when a duplicate field is parsed. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d1d989ee04430afa9c8e1ad3f2d2ccd8347eac3b;p=Sone.git Throw a duplicate field exception when a duplicate field is parsed. --- 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 { + + } }