From: David ‘Bombe’ Roden Date: Sun, 5 Oct 2014 10:30:39 +0000 (+0200) Subject: Use Guice to parse numbers. X-Git-Tag: 0.9-rc1^2~3^2~73 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=eb40004c3a5fdb5471c16a2b6ac1f274d847c019 Use Guice to parse numbers. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 9269ea6..6851802 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -92,7 +92,6 @@ import net.pterodactylus.sone.main.SonePlugin; import net.pterodactylus.util.config.Configuration; import net.pterodactylus.util.config.ConfigurationException; import net.pterodactylus.util.logging.Logging; -import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.service.AbstractService; import net.pterodactylus.util.thread.NamedThreadFactory; @@ -636,7 +635,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } logger.info(String.format("Adding Sone from OwnIdentity: %s", ownIdentity)); Sone sone = database.newSoneBuilder().local().from(ownIdentity).build(); - sone.setLatestEdition(Numbers.safeParseLong(ownIdentity.getProperty("Sone.LatestEdition"), 0L)); + sone.setLatestEdition(fromNullable(tryParse(ownIdentity.getProperty("Sone.LatestEdition"))).or(0L)); sone.setClient(new Client("Sone", SonePlugin.VERSION.toString())); sone.setKnown(true); SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, ownIdentity.getId()); @@ -1734,7 +1733,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, if (sone.isLocal()) { return; } - sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), sone.getLatestEdition())); + sone.setLatestEdition(fromNullable(tryParse(identity.getProperty("Sone.LatestEdition"))).or(sone.getLatestEdition())); soneDownloader.addSone(sone); soneDownloaders.execute(soneDownloader.fetchSoneAction(sone)); }