X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FGetFailed.java;h=e624644d22adf7a3c2ccceeeef8a2de8d931565f;hb=859f956efc6d45942e13e590b4d66340beedf0ce;hp=161da9eb327305a0138b838e660cf0485a8f4bfc;hpb=64c2c9bd494f3ea9d1ae84f8d86827dea025bee6;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/GetFailed.java b/src/net/pterodactylus/fcp/GetFailed.java index 161da9e..e624644 100644 --- a/src/net/pterodactylus/fcp/GetFailed.java +++ b/src/net/pterodactylus/fcp/GetFailed.java @@ -45,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")); @@ -101,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")); @@ -143,6 +143,17 @@ 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. @@ -152,7 +163,7 @@ public class GetFailed extends BaseMessage { 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); @@ -166,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;