add IdentifierCollision
[jSite2.git] / src / net / pterodactylus / util / fcp / PeerNote.java
index a1a0e35..4efbc4f 100644 (file)
@@ -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 <code>1</code> 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 <code>-1</code> 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"));
        }
 
 }