SFTP in Camel populates wrong parent folder for a file -
using camel sftp consumer polls remote folder files, have following endpoint configuration:
sftp://user@server:22\     ?password=xxx\     &delete=false\     &move=.done\     &localworkdirectory=/tmp\     &delay=60000   (\ wrap end lines in yaml, gets stitched on 1 line.)
with setup when file gets downloaded user's home directory, tries move remote file .done directory (as per camel documentation, ".done" should enough). however, exception:
org.apache.camel.component.file.genericfileoperationfailedexception -      cannot create directory: /.done (could because of denied permissions)   i have permissions since create directory , rename file manually using interactive sftp command in bash.
i have debugged through camel's processing , found out parent folder of file (camelfileparent header) evaluated "/" means final path rename file evaluated "//.done/some-file-name.csv". is, of course, wrong , fails above exception.
the question why can't resolve home directory? when try running pwd in interactive sftp command, resolves correctly "/home/user".
after debugging more found out how camel resolving parent folder path, , it's purely based on file class, , not query remote server parent folder:
        string name = getrelativefilepath();         file path;         if (name != null) {             path = new file(endpointpath, name);         } else {             path = new file(endpointpath);         }         parent = path.getparent();   where endpointpath "" , name "some-file-name.csv" , getparent() call resolved "/".
what can correct home path (without hard-coding path endpoint configuration)? bug?
 
 
Comments
Post a Comment