X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FReplyShell.java;h=355ef67888b97b69cdc2f5fcb79005fdaee8bf6f;hb=60e05f5839cc3c00610d861a24003781c3040e11;hp=6886a9da2f8e4fb8159ad3984a9e138acb5047e1;hpb=cd5e2259ab672c714a8fe2b632da670e30dee090;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/ReplyShell.java b/src/main/java/net/pterodactylus/sone/data/ReplyShell.java index 6886a9d..355ef67 100644 --- a/src/main/java/net/pterodactylus/sone/data/ReplyShell.java +++ b/src/main/java/net/pterodactylus/sone/data/ReplyShell.java @@ -18,6 +18,10 @@ package net.pterodactylus.sone.data; import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.pterodactylus.util.logging.Logging; /** * A shell around a {@link Reply} for replies that have not yet been retrieved @@ -27,12 +31,15 @@ import java.util.UUID; */ public class ReplyShell extends Reply implements Shell { + /** The logger. */ + private static final Logger logger = Logging.getLogger(ReplyShell.class); + /** The shell creator. */ public static final ShellCreator creator = new ShellCreator() { @Override public Shell createShell(String id) { - return new ReplyShell().setId(UUID.fromString(id)); + return new ReplyShell().setId(id); } }; @@ -101,8 +108,13 @@ public class ReplyShell extends Reply implements Shell { * The ID of this reply * @return This reply shell (for method chaining) */ - public ReplyShell setId(UUID id) { - this.id = id; + public ReplyShell setId(String id) { + try { + this.id = UUID.fromString(id); + } catch (IllegalArgumentException iae1) { + logger.log(Level.WARNING, "Invalid ID: “" + id + "”.", iae1); + this.id = UUID.randomUUID(); + } return this; }