From: David ‘Bombe’ Roden Date: Wed, 10 Nov 2010 08:24:56 +0000 (+0100) Subject: Always create a new Sone. X-Git-Tag: 0.2-RC4~6 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=12802e1e1873c07135cf9c2dce7d7797e3205af1 Always create a new Sone. --- diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index 13154a0..6a6265e 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -167,16 +167,16 @@ public class SoneDownloader extends AbstractService { } /** - * Parses a Sone from the given input stream and updates the given Sone, or - * creates a new Sone. + * Parses a Sone from the given input stream and creates a new Sone from the + * parsed data. * - * @param sone + * @param originalSone * The Sone to update * @param soneInputStream * The input stream to parse the Sone from * @return The parsed Sone */ - public Sone parseSone(Sone sone, InputStream soneInputStream) { + public Sone parseSone(Sone originalSone, InputStream soneInputStream) { /* TODO - impose a size limit? */ Document document; @@ -186,9 +186,12 @@ public class SoneDownloader extends AbstractService { } if (document == null) { /* TODO - mark Sone as bad. */ - logger.log(Level.WARNING, "Could not parse XML for Sone %s!", new Object[] { sone }); + logger.log(Level.WARNING, "Could not parse XML for Sone %s!", new Object[] { originalSone }); return null; } + + Sone sone = new Sone(originalSone.getId()); + SimpleXML soneXml; try { soneXml = SimpleXML.fromDocument(document);