Repository navigation
Conversation
… set path in SFTP
…the root cause of errors
|
1. Must fix: public static String keepDataSetPrefix(String path) {
return path != null && path.length() > 2 && path.startsWith("//")
&& path.charAt(2) != '/' && path.indexOf('/', 2) < 0
? path + "/"
: path;
}Add 2. Must fix: PR description. It's still the template text. Add the cause, the fix, and what stays open from #9033: the hint for invalid data set names, and the jsch upstream report. 3. Should do: check a sequential data set. Every single-level path now ends in 4. Nit: add the z/OS sentence of |
…ths in SftpClient too
| && path.startsWith("//") | ||
| && path.charAt(2) != '/' | ||
| && path.indexOf('/', 2) < 0 | ||
| ? path + "/" |
There was a problem hiding this comment.
[suggestion] keepDataSetPrefix appends / to every single-level // path, and SftpFileObject.remotePath plus SftpClient stat/delete/rename/cd all use it. jsch then sends //HLQ.SEQ/ for a sequential data set opened as a file, not only for a prefix used as a folder. The javadoc says that file form has not been verified on z/OS; a trailing slash is the directory/prefix spelling, so a read, write, or rm can miss //HLQ.SEQ or address a different name. Previously glob turned it into /HLQ.SEQ, so this is not a regression of a working path, but it is a different path.
Suggestion: Read and write one single-level sequential data set on z/OS. If //HLQ.SEQ/ is accepted, say so here. If it is refused, say in this comment that only a folder/prefix is covered, and do not treat file get/put/rm of //HLQ.SEQ as fixed.
| SftpPut.Error.CanNotFindRemoteFolder=Unable to find remote folder [{0}] | ||
| SftpPut.Error.MoveToDestinationFolderIsEmpty=The folder to move the source file to is empty | ||
| SftpPut.Error.UnableToUpload=Unable to upload to [{0}] | ||
| SftpPut.Error.TargetIsNotAFile=Unable to upload to [{0}]: it already exists on the server and isn''t a file, so it can''t be overwritten. On z/OS this is an existing data set the server lists as a folder, or a name other data sets are stored under. |
There was a problem hiding this comment.
[nit] The z/OS sentence is appended for every non-file target, including an ordinary directory on a Unix SFTP server.
Suggestion: Keep the first sentence for every target. Add the z/OS clause only when the name is a // path (targetFile.getName() is an IRootPrefixFileName with a non-empty root prefix).
| if (rootCause == null || rootCause == e) { | ||
| return e.toString(); | ||
| } | ||
| return e.toString() + Const.CR + "Root cause: " + ExceptionUtils.getRootCauseMessage(e); |
There was a problem hiding this comment.
[nit] Root cause: is a new string shown on the error row, and it is hardcoded in English while the other SFTP Put errors go through the message bundle.
Suggestion: Move it to messages_en_US.properties (for example SftpPut.Error.RootCause=Root cause: {0}) and pass ExceptionUtils.getRootCauseMessage(e) as the argument.
… translate the root cause label
…ath in SFTP
fixes #9033
Please add a meaningful description for your change here
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean install apache-rat:checkto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.git rebase -i.addresses #123), if applicable.To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.