annotate src/ch/ethz/ssh2/sftp/ErrorCodes.java @ 402:14aa0621aa7d stable-1.9.0

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