2 * jSite2 - ProtocolError.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.fcp;
23 * The “ProtocolError” message signals that something has gone really wrong.
25 * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
28 public class ProtocolError extends BaseMessage {
31 * Creates a new “ProtocolError” message that wraps the received message.
33 * @param receivedMessage
34 * The received message
36 ProtocolError(FcpMessage receivedMessage) {
37 super(receivedMessage);
41 * Returns whether the causing message had the “Global” flag set.
43 * @return <code>true</code> if the causing message had the “Global” flag
46 public boolean isGlobal() {
47 return Boolean.valueOf(getField("Global"));
51 * Returns the error code.
53 * @return The error code, or <code>-1</code> if the error code could not
56 public int getCode() {
57 return FcpUtils.safeParseInt(getField("Code"));
61 * Returns the description of the error.
63 * @return The description of the error
65 public String getCodeDescription() {
66 return getField("CodeDescription");
70 * Returns some extra description of the error.
72 * @return Extra description of the error, or <code>null</code> if there
75 public String getExtraDescription() {
76 return getField("ExtraDescription");
80 * Returns whether the connection to the node can stay open.
82 * @return <code>true</code> when the connection has to be closed,
83 * <code>false</code> otherwise
85 public boolean isFatal() {
86 return Boolean.valueOf(getField("Fatal"));
90 * The identifier of the causing request, if any.
92 * @return The identifier of the causing request
94 public String getIdentifier() {
95 return getField("Identifier");