From 12802e1e1873c07135cf9c2dce7d7797e3205af1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 10 Nov 2010 09:24:56 +0100 Subject: [PATCH] Always create a new Sone. --- .../java/net/pterodactylus/sone/core/SoneDownloader.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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); -- 2.7.4