@@ -203,7 +203,6 @@ def __init__(self, model_context, exception_type):
203203 self ._os_helper = SSHUnixCommandLineHelper ()
204204
205205 self .path_helper = path_helper .get_path_helper ()
206-
207206 self ._logger .exiting (class_name = self ._class_name , method_name = _method_name )
208207
209208 def is_connected (self ):
@@ -251,7 +250,7 @@ def download(self, source_path, target_path):
251250
252251 def upload (self , source_path , target_path ):
253252 _method_name = 'upload'
254- self ._logger .entering (target_path , source_path , class_name = self ._class_name , method_name = _method_name )
253+ self ._logger .entering (source_path , target_path , class_name = self ._class_name , method_name = _method_name )
255254
256255 if StringUtils .isEmpty (target_path ):
257256 ex = exception_helper .create_exception (self ._exception_type , 'WLSDPLY-32018' )
@@ -272,9 +271,25 @@ def upload(self, source_path, target_path):
272271
273272 try :
274273 remote_host = self ._ssh_client .getRemoteHostname ()
275- self ._logger .info ('WLSDPLY-32022' , abs_source_path , remote_host , abs_target_path ,
276- class_name = self ._class_name , method_name = _method_name )
277- self ._ssh_client .newSCPFileTransfer ().upload (abs_source_path , target_path )
274+
275+ # By default, sshj newSCPFileTransfer().upload() uses single quotes, which
276+ # do not work on Windows. Have to go another level down to make this works
277+ # properly.
278+ #
279+ if self .is_windows :
280+ from net .schmizz .sshj .xfer import FileSystemFile
281+ from net .schmizz .sshj .xfer .scp .ScpCommandLine import EscapeMode
282+
283+ self ._logger .info ('WLSDPLY-32044' , abs_source_path , remote_host , target_path ,
284+ class_name = self ._class_name , method_name = _method_name )
285+ self ._ssh_client .newSCPFileTransfer ().newSCPUploadClient ().copy (FileSystemFile (abs_source_path ),
286+ target_path ,
287+ EscapeMode .DoubleQuote )
288+ else :
289+ self ._logger .info ('WLSDPLY-32022' , abs_source_path , remote_host , abs_target_path ,
290+ class_name = self ._class_name , method_name = _method_name )
291+ self ._ssh_client .newSCPFileTransfer ().upload (abs_source_path , target_path )
292+
278293 self ._logger .info ('WLSDPLY-32023' , abs_source_path , remote_host , abs_target_path ,
279294 class_name = self ._class_name , method_name = _method_name )
280295 except IOException ,ioe :
0 commit comments