2 * jFCPlib - ProtocolError.java - Copyright © 2008 David Roden
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package net.pterodactylus.fcp;
22 * The “ProtocolError” message signals that something has gone really wrong.
24 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
26 public class ProtocolError extends BaseMessage {
29 * Creates a new “ProtocolError” message that wraps the received message.
31 * @param receivedMessage
32 * The received message
34 public ProtocolError(FcpMessage receivedMessage) {
35 super(receivedMessage);
39 * Returns whether the causing message had the “Global” flag set.
41 * @return <code>true</code> if the causing message had the “Global” flag
44 public boolean isGlobal() {
45 return Boolean.valueOf(getField("Global"));
49 * Returns the error code.
51 * @return The error code, or <code>-1</code> if the error code could not
54 public int getCode() {
55 return FcpUtils.safeParseInt(getField("Code"));
59 * Returns the description of the error.
61 * @return The description of the error
63 public String getCodeDescription() {
64 return getField("CodeDescription");
68 * Returns some extra description of the error.
70 * @return Extra description of the error, or <code>null</code> if there is
73 public String getExtraDescription() {
74 return getField("ExtraDescription");
78 * Returns whether the connection to the node can stay open.
80 * @return <code>true</code> when the connection has to be closed,
81 * <code>false</code> otherwise
83 public boolean isFatal() {
84 return Boolean.valueOf(getField("Fatal"));
88 * The identifier of the causing request, if any.
90 * @return The identifier of the causing request
92 public String getIdentifier() {
93 return getField("Identifier");