X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Futil%2Ffcp%2FPeerNote.java;h=4efbc4fba8b509d287e23206ba4a2a930296559d;hb=b905d1b51018f68ba5e8c598781a494921318c91;hp=a1a0e355c1bf939b5cee918da005fc05a4646cc0;hpb=474a0f39c87d520b0ce8c23ea8e8046441e13ea7;p=jSite2.git diff --git a/src/net/pterodactylus/util/fcp/PeerNote.java b/src/net/pterodactylus/util/fcp/PeerNote.java index a1a0e35..4efbc4f 100644 --- a/src/net/pterodactylus/util/fcp/PeerNote.java +++ b/src/net/pterodactylus/util/fcp/PeerNote.java @@ -3,7 +3,6 @@ */ package net.pterodactylus.util.fcp; - /** * The “PeerNote” message contains a private note that has been entered for a * darknet peer. @@ -14,7 +13,7 @@ package net.pterodactylus.util.fcp; public class PeerNote extends BaseMessage { /** The type for base64 encoded peer notes. */ - public static final int NOTE_TYPE_BASE64 = 1; + public static final int TYPE_PRIVATE_PEER_NOTE = 1; /** * Creates a “PeerNote” message that wraps the recevied message. @@ -22,13 +21,12 @@ public class PeerNote extends BaseMessage { * @param receivedMessage * The received message */ - public PeerNote(FcpMessage receivedMessage) { + PeerNote(FcpMessage receivedMessage) { super(receivedMessage); } /** - * Returns the note text in whatever format is specified by - * {@link #getPeerNoteType()}. + * Returns the base64-encoded note text. * * @return The note text */ @@ -37,15 +35,13 @@ public class PeerNote extends BaseMessage { } /** - * Returns the type of the peer note. The type 1 means that - * the text of the note is base64-encoded. + * Returns the type of the peer note. * - * @return The type of the peer note - * @throws NumberFormatException - * if the field can not be parsed + * @return The type of the peer note, or -1 if the type can + * not be parsed */ - public int getPeerNoteType() throws NumberFormatException { - return Integer.valueOf(getField("PeerNoteType")); + public int getPeerNoteType() { + return FcpUtils.safeParseInt(getField("PeerNoteType")); } }