From 4c8206d682ad612e640209bc378cc6f0bb695ea5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 17 Oct 2010 18:26:55 +0200 Subject: [PATCH] Parse time from downloaded Sone. --- .../java/net/pterodactylus/sone/core/SoneDownloader.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index da33b0b..04fc37f 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -171,6 +171,20 @@ public class SoneDownloader extends AbstractService { } sone.setName(soneName); + String soneTime = soneXml.getValue("time", null); + if (soneTime == null) { + /* TODO - mark Sone as bad. */ + logger.log(Level.WARNING, "Downloaded time for Sone %s was null!", new Object[] { sone }); + return null; + } + try { + sone.setTime(Long.parseLong(soneTime)); + } catch (NumberFormatException nfe1) { + /* TODO - mark Sone as bad. */ + logger.log(Level.WARNING, "Downloaded Sone %s with invalid time: %s", new Object[] { sone, soneTime }); + return null; + } + SimpleXML profileXml = soneXml.getNode("profile"); if (profileXml == null) { /* TODO - mark Sone as bad. */ -- 2.7.4