Throw a duplicate field exception when a duplicate field is parsed.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 24 Oct 2013 20:58:55 +0000 (22:58 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:36 +0000 (22:25 +0100)
src/main/java/net/pterodactylus/sone/core/SoneParser.java

index 04d095a..7dc0744 100644 (file)
@@ -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 {
+
+       }
 }