X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FGetFailed.java;h=ca9492712fea90ade89991a0e49a91c106e75470;hb=cde203c6dd3f3e7429d1f51816a0ee28763a8abf;hp=cd14e96df979430cb223ae28cb2692834b52f2af;hpb=f553531be78d6d6d95dc152728f2b8d40242b57d;p=jFCPlib.git
diff --git a/src/net/pterodactylus/fcp/GetFailed.java b/src/net/pterodactylus/fcp/GetFailed.java
index cd14e96..ca94927 100644
--- a/src/net/pterodactylus/fcp/GetFailed.java
+++ b/src/net/pterodactylus/fcp/GetFailed.java
@@ -28,15 +28,14 @@ import java.util.Map.Entry;
* The âGetFailedâ message signals the client that a {@link ClientGet} request
* has failed. This also means that no further progress messages for that
* request will be sent.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
- * @version $Id$
*/
public class GetFailed extends BaseMessage {
/**
* Creates a new âGetFailedâ message that wraps the received message.
- *
+ *
* @param receivedMessage
* The received message
*/
@@ -46,9 +45,9 @@ public class GetFailed extends BaseMessage {
/**
* Returns the code of the error.
- *
- * @return The code of the error, or -1
if the error code
- * could not be parsed
+ *
+ * @return The code of the error, or -1
if the error code could
+ * not be parsed
*/
public int getCode() {
return FcpUtils.safeParseInt(getField("Code"));
@@ -56,7 +55,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns the identifier of the request.
- *
+ *
* @return The identifier of the request
*/
public String getIdentifier() {
@@ -65,7 +64,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns whether the request is on the global queue.
- *
+ *
* @return true
if the request is on the global queue,
* false
if it is on the client-local queue
*/
@@ -75,7 +74,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns the description of the error code.
- *
+ *
* @return The description of the error code
*/
public String getCodeDescription() {
@@ -84,7 +83,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns the extra description of the error.
- *
+ *
* @return The extra description of the error
*/
public String getExtraDescription() {
@@ -93,7 +92,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns the short description of the error.
- *
+ *
* @return The short description of the error
*/
public String getShortCodeDescription() {
@@ -102,9 +101,9 @@ public class GetFailed extends BaseMessage {
/**
* Returns the expected data length, if already knows.
- *
- * @return The expected data length, or -1
if the length
- * could not be parsed
+ *
+ * @return The expected data length, or -1
if the length could
+ * not be parsed
*/
public long getExpectedDataLength() {
return FcpUtils.safeParseLong(getField("ExpectedDataLength"));
@@ -112,7 +111,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns the expected content type of the request.
- *
+ *
* @return The expected content type
*/
public String getExpectedMetadataContentType() {
@@ -124,7 +123,7 @@ public class GetFailed extends BaseMessage {
* and {@link #getExpectedMetadataContentType()}) have already been
* finalized and can be trusted. If the values have not been finalized that
* can change over time.
- *
+ *
* @return true
if the expected values have already been
* finalized, false
otherwise
*/
@@ -136,7 +135,7 @@ public class GetFailed extends BaseMessage {
* Returns the URI the request is redirected to (in case of a request for a
* USK). This is returned so that client applications know that the URI of
* the key has updated.
- *
+ *
* @return The URI the request was redirected to
*/
public String getRedirectURI() {
@@ -144,16 +143,27 @@ public class GetFailed extends BaseMessage {
}
/**
+ * Returns whether the request failed fatally. If a request fails fatally it
+ * can never complete, even with inifinite retries.
+ *
+ * @return true
if the request failed fatally,
+ * false
otherwise
+ */
+ public boolean isFatal() {
+ return Boolean.valueOf(getField("Fatal"));
+ }
+
+ /**
* Returns a list of complex error codes with the message. Use
* {@link #getComplexErrorDescription(int)} and
* {@link #getComplexErrorCount(int)} to get details.
- *
+ *
* @return A list of complex error codes
*/
public int[] getComplexErrorCodes() {
Map allFields = getFields();
List errorCodeList = new ArrayList();
- for (Entry field: allFields.entrySet()) {
+ for (Entry field : allFields.entrySet()) {
String fieldKey = field.getKey();
if (fieldKey.startsWith("Errors.")) {
int nextDot = fieldKey.indexOf('.', 7);
@@ -167,7 +177,7 @@ public class GetFailed extends BaseMessage {
}
int[] errorCodes = new int[errorCodeList.size()];
int errorIndex = 0;
- for (int errorCode: errorCodeList) {
+ for (int errorCode : errorCodeList) {
errorCodes[errorIndex++] = errorCode;
}
return errorCodes;
@@ -176,7 +186,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns the description of the complex error. You should only hand it
* error codes you got from {@link #getComplexErrorCodes()}!
- *
+ *
* @param errorCode
* The error code
* @return The description of the complex error
@@ -188,7 +198,7 @@ public class GetFailed extends BaseMessage {
/**
* Returns the count of the complex error. You should only hand it error
* codes you got from {@link #getComplexErrorCodes()}!
- *
+ *
* @param errorCode
* The error code
* @return The count of the complex error, or -1
if the count