273
+ − 1 /*
+ − 2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
+ − 3 * Please refer to the LICENSE.txt for licensing details.
+ − 4 */
+ − 5 package ch.ethz.ssh2.sftp;
+ − 6
+ − 7 /**
+ − 8 * SFTP Error Codes
+ − 9 *
+ − 10 * @author Christian Plattner
+ − 11 * @version 2.50, 03/15/10
+ − 12 */
+ − 13 public final class ErrorCodes {
+ − 14 private ErrorCodes() {
+ − 15 }
+ − 16
+ − 17 public static final int SSH_FX_OK = 0;
+ − 18 public static final int SSH_FX_EOF = 1;
+ − 19 public static final int SSH_FX_NO_SUCH_FILE = 2;
+ − 20 public static final int SSH_FX_PERMISSION_DENIED = 3;
+ − 21 public static final int SSH_FX_FAILURE = 4;
+ − 22 public static final int SSH_FX_BAD_MESSAGE = 5;
+ − 23 public static final int SSH_FX_NO_CONNECTION = 6;
+ − 24 public static final int SSH_FX_CONNECTION_LOST = 7;
+ − 25 /**
+ − 26 * The server MUST respond with SSH_FXP_STATUS(SSH_FX_OP_UNSUPPORTED) if
+ − 27 * it receives a packet it does not recognize.
+ − 28 */
+ − 29 public static final int SSH_FX_OP_UNSUPPORTED = 8;
+ − 30 public static final int SSH_FX_INVALID_HANDLE = 9;
+ − 31 public static final int SSH_FX_NO_SUCH_PATH = 10;
+ − 32 public static final int SSH_FX_FILE_ALREADY_EXISTS = 11;
+ − 33 public static final int SSH_FX_WRITE_PROTECT = 12;
+ − 34 public static final int SSH_FX_NO_MEDIA = 13;
+ − 35 public static final int SSH_FX_NO_SPACE_ON_FILESYSTEM = 14;
+ − 36 public static final int SSH_FX_QUOTA_EXCEEDED = 15;
+ − 37 public static final int SSH_FX_UNKNOWN_PRINCIPAL = 16;
+ − 38 public static final int SSH_FX_LOCK_CONFLICT = 17;
+ − 39 public static final int SSH_FX_DIR_NOT_EMPTY = 18;
+ − 40 public static final int SSH_FX_NOT_A_DIRECTORY = 19;
+ − 41 public static final int SSH_FX_INVALID_FILENAME = 20;
+ − 42 public static final int SSH_FX_LINK_LOOP = 21;
+ − 43 public static final int SSH_FX_CANNOT_DELETE = 22;
+ − 44 public static final int SSH_FX_INVALID_PARAMETER = 23;
+ − 45 public static final int SSH_FX_FILE_IS_A_DIRECTORY = 24;
+ − 46 public static final int SSH_FX_BYTE_RANGE_LOCK_CONFLICT = 25;
+ − 47 public static final int SSH_FX_BYTE_RANGE_LOCK_REFUSED = 26;
+ − 48 public static final int SSH_FX_DELETE_PENDING = 27;
+ − 49 public static final int SSH_FX_FILE_CORRUPT = 28;
+ − 50 public static final int SSH_FX_OWNER_INVALID = 29;
+ − 51 public static final int SSH_FX_GROUP_INVALID = 30;
+ − 52 public static final int SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK = 31;
+ − 53
+ − 54 private static final String[][] messages = {
+ − 55
307
+ − 56 {"SSH_FX_OK", "Indicates successful completion of the operation."},
+ − 57 {
+ − 58 "SSH_FX_EOF",
+ − 59 "An attempt to read past the end-of-file was made; or, there are no more directory entries to return."
+ − 60 },
+ − 61 {"SSH_FX_NO_SUCH_FILE", "A reference was made to a file which does not exist."},
+ − 62 {"SSH_FX_PERMISSION_DENIED", "The user does not have sufficient permissions to perform the operation."},
+ − 63 {"SSH_FX_FAILURE", "An error occurred, but no specific error code exists to describe the failure."},
+ − 64 {"SSH_FX_BAD_MESSAGE", "A badly formatted packet or other SFTP protocol incompatibility was detected."},
+ − 65 {"SSH_FX_NO_CONNECTION", "There is no connection to the server."},
+ − 66 {"SSH_FX_CONNECTION_LOST", "The connection to the server was lost."},
+ − 67 {
+ − 68 "SSH_FX_OP_UNSUPPORTED",
+ − 69 "An attempted operation could not be completed by the server because the server does not support the operation."
+ − 70 },
+ − 71 {"SSH_FX_INVALID_HANDLE", "The handle value was invalid."},
+ − 72 {"SSH_FX_NO_SUCH_PATH", "The file path does not exist or is invalid."},
+ − 73 {"SSH_FX_FILE_ALREADY_EXISTS", "The file already exists."},
+ − 74 {"SSH_FX_WRITE_PROTECT", "The file is on read-only media, or the media is write protected."},
+ − 75 {
+ − 76 "SSH_FX_NO_MEDIA",
+ − 77 "The requested operation cannot be completed because there is no media available in the drive."
+ − 78 },
+ − 79 {
+ − 80 "SSH_FX_NO_SPACE_ON_FILESYSTEM",
+ − 81 "The requested operation cannot be completed because there is insufficient free space on the filesystem."
+ − 82 },
+ − 83 {
+ − 84 "SSH_FX_QUOTA_EXCEEDED",
+ − 85 "The operation cannot be completed because it would exceed the user's storage quota."
+ − 86 },
+ − 87 {
+ − 88 "SSH_FX_UNKNOWN_PRINCIPAL",
+ − 89 "A principal referenced by the request (either the 'owner', 'group', or 'who' field of an ACL), was unknown. The error specific data contains the problematic names."
+ − 90 },
+ − 91 {"SSH_FX_LOCK_CONFLICT", "The file could not be opened because it is locked by another process."},
+ − 92 {"SSH_FX_DIR_NOT_EMPTY", "The directory is not empty."},
+ − 93 {"SSH_FX_NOT_A_DIRECTORY", "The specified file is not a directory."},
+ − 94 {"SSH_FX_INVALID_FILENAME", "The filename is not valid."},
+ − 95 {
+ − 96 "SSH_FX_LINK_LOOP",
+ − 97 "Too many symbolic links encountered or, an SSH_FXF_NOFOLLOW open encountered a symbolic link as the final component."
+ − 98 },
+ − 99 {
+ − 100 "SSH_FX_CANNOT_DELETE",
+ − 101 "The file cannot be deleted. One possible reason is that the advisory READONLY attribute-bit is set."
+ − 102 },
+ − 103 {
+ − 104 "SSH_FX_INVALID_PARAMETER",
+ − 105 "One of the parameters was out of range, or the parameters specified cannot be used together."
+ − 106 },
+ − 107 {
+ − 108 "SSH_FX_FILE_IS_A_DIRECTORY",
+ − 109 "The specified file was a directory in a context where a directory cannot be used."
+ − 110 },
+ − 111 {
+ − 112 "SSH_FX_BYTE_RANGE_LOCK_CONFLICT",
+ − 113 " A read or write operation failed because another process's mandatory byte-range lock overlaps with the request."
+ − 114 },
+ − 115 {"SSH_FX_BYTE_RANGE_LOCK_REFUSED", "A request for a byte range lock was refused."},
+ − 116 {"SSH_FX_DELETE_PENDING", "An operation was attempted on a file for which a delete operation is pending."},
+ − 117 {"SSH_FX_FILE_CORRUPT", "The file is corrupt; an filesystem integrity check should be run."},
+ − 118 {"SSH_FX_OWNER_INVALID", "The principal specified can not be assigned as an owner of a file."},
+ − 119 {"SSH_FX_GROUP_INVALID", "The principal specified can not be assigned as the primary group of a file."},
+ − 120 {
+ − 121 "SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK",
+ − 122 "The requested operation could not be completed because the specifed byte range lock has not been granted."
+ − 123 },
273
+ − 124
+ − 125 };
+ − 126
+ − 127 public static final String[] getDescription(int errorCode) {
307
+ − 128 if ((errorCode < 0) || (errorCode >= messages.length)) {
273
+ − 129 return null;
+ − 130 }
+ − 131
+ − 132 return messages[errorCode];
+ − 133 }
+ − 134 }