X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=e39644dbcf0270b29f0e1a8b3e7ebd5b7271e271;hb=61386c2285d032d0fd990fc3e4c294af4da23700;hp=b929c233c68e480fdb516d6dac0f3effbe636db6;hpb=b7e61f73b7f8661c9f9691c078e7908b81784d3f;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index b929c23..e39644d 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -407,8 +407,14 @@ public class Core implements IdentityListener { logger.log(Level.FINE, "Tried to add known local Sone: %s", ownIdentity); return localSones.get(ownIdentity.getId()); } - String latestEdition = ownIdentity.getProperty("Sone.LatestEdition"); - final Sone sone = new Sone(ownIdentity).setInsertUri(getSoneUri(ownIdentity.getInsertUri(), latestEdition)).setRequestUri(getSoneUri(ownIdentity.getRequestUri(), latestEdition)); + final Sone sone; + try { + sone = new Sone(ownIdentity).setInsertUri(new FreenetURI(ownIdentity.getInsertUri())).setRequestUri(new FreenetURI(ownIdentity.getRequestUri())); + sone.setLatestEdition(Numbers.safeParseLong(ownIdentity.getProperty("Sone.LatestEdition"), (long) 0)); + } catch (MalformedURLException mue1) { + logger.log(Level.SEVERE, "Could not convert the Identity’s URIs to Freenet URIs: " + ownIdentity.getInsertUri() + ", " + ownIdentity.getRequestUri(), mue1); + return null; + } /* TODO - load posts ’n stuff */ localSones.put(ownIdentity.getId(), sone); SoneInserter soneInserter = new SoneInserter(this, freenetInterface, sone);