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>
27 public class ProtocolError extends BaseMessage {
30 * Creates a new “ProtocolError” message that wraps the received message.
32 * @param receivedMessage
33 * The received message
35 ProtocolError(FcpMessage receivedMessage) {
36 super(receivedMessage);
40 * Returns whether the causing message had the “Global” flag set.
42 * @return <code>true</code> if the causing message had the “Global” flag
45 public boolean isGlobal() {
46 return Boolean.valueOf(getField("Global"));
50 * Returns the error code.
52 * @return The error code, or <code>-1</code> if the error code could not
55 public int getCode() {
56 return FcpUtils.safeParseInt(getField("Code"));
60 * Returns the description of the error.
62 * @return The description of the error
64 public String getCodeDescription() {
65 return getField("CodeDescription");
69 * Returns some extra description of the error.
71 * @return Extra description of the error, or <code>null</code> if there
74 public String getExtraDescription() {
75 return getField("ExtraDescription");
79 * Returns whether the connection to the node can stay open.
81 * @return <code>true</code> when the connection has to be closed,
82 * <code>false</code> otherwise
84 public boolean isFatal() {
85 return Boolean.valueOf(getField("Fatal"));
89 * The identifier of the causing request, if any.
91 * @return The identifier of the causing request
93 public String getIdentifier() {
94 return getField("Identifier");