2 * jFCPlib - ProtocolError.java - Copyright © 2008–2016 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 3 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, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.fcp;
21 * The “ProtocolError” message signals that something has gone really wrong.
23 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
25 public class ProtocolError extends BaseMessage {
28 * Creates a new “ProtocolError” message that wraps the received message.
30 * @param receivedMessage
31 * The received message
33 public ProtocolError(FcpMessage receivedMessage) {
34 super(receivedMessage);
38 * Returns whether the causing message had the “Global” flag set.
40 * @return <code>true</code> if the causing message had the “Global” flag
43 public boolean isGlobal() {
44 return Boolean.valueOf(getField("Global"));
48 * Returns the error code.
50 * @return The error code, or <code>-1</code> if the error code could not
53 public int getCode() {
54 return FcpUtils.safeParseInt(getField("Code"));
58 * Returns the description of the error.
60 * @return The description of the error
62 public String getCodeDescription() {
63 return getField("CodeDescription");
67 * Returns some extra description of the error.
69 * @return Extra description of the error, or <code>null</code> if there is
72 public String getExtraDescription() {
73 return getField("ExtraDescription");
77 * Returns whether the connection to the node can stay open.
79 * @return <code>true</code> when the connection has to be closed,
80 * <code>false</code> otherwise
82 public boolean isFatal() {
83 return Boolean.valueOf(getField("Fatal"));
87 * The identifier of the causing request, if any.
89 * @return The identifier of the causing request
91 public String getIdentifier() {
92 return getField("Identifier");