From: David ‘Bombe’ Roden Date: Sun, 17 Oct 2010 16:26:55 +0000 (+0200) Subject: Parse time from downloaded Sone. X-Git-Tag: 0.1-RC1~261 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4c8206d682ad612e640209bc378cc6f0bb695ea5;p=Sone.git Parse time from downloaded Sone. --- 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. */