X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSoneImpl.java;h=86c593577a5f56911202490846bbedd0feb58b1f;hp=08c104fc83a7687a2294ada1e68bc9b4e6a2f169;hb=239f08e37721401290f43596e8a7e9aa83aae980;hpb=4e2205816edee258831b971f94ff0a736048905d diff --git a/src/main/java/net/pterodactylus/sone/data/SoneImpl.java b/src/main/java/net/pterodactylus/sone/data/SoneImpl.java index 08c104f..86c5935 100644 --- a/src/main/java/net/pterodactylus/sone/data/SoneImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/SoneImpl.java @@ -167,26 +167,17 @@ public class SoneImpl implements Sone { * @return The request URI of this Sone */ public FreenetURI getRequestUri() { - return (requestUri != null) ? requestUri.setSuggestedEdition(latestEdition) : null; - } - - /** - * Sets the request URI of this Sone. - * - * @param requestUri - * The request URI of this Sone - * @return This Sone (for method chaining) - */ - public Sone setRequestUri(FreenetURI requestUri) { - if (this.requestUri == null) { - this.requestUri = requestUri.setKeyType("USK").setDocName("Sone").setMetaString(new String[0]); - return this; - } - if (!this.requestUri.equalsKeypair(requestUri)) { - logger.log(Level.WARNING, String.format("Request URI %s tried to overwrite %s!", requestUri, this.requestUri)); - return this; + try { + return new FreenetURI(getIdentity().getRequestUri()) + .setKeyType("USK") + .setDocName("Sone") + .setMetaString(new String[0]) + .setSuggestedEdition(latestEdition); + } catch (MalformedURLException e) { + throw new IllegalStateException( + format("Identity %s's request URI is incorrect.", + getIdentity()), e); } - return this; } /**