View | Details | Raw Unified | Return to bug 191048 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rse/internal/services/files/ftp/FTPServiceResources.java (-1 lines)
Lines 29-35 Link Here
29
	public static String FTP_File_Service_Monitor_Format;
29
	public static String FTP_File_Service_Monitor_Format;
30
	public static String FTP_File_Service_Name;
30
	public static String FTP_File_Service_Name;
31
	public static String FTP_File_Service_Description;
31
	public static String FTP_File_Service_Description;
32
	public static String FTPService_FTP_File_Service_Not_Found;
33
	
32
	
34
	static {
33
	static {
35
		// load message values from bundle file
34
		// load message values from bundle file
(-)src/org/eclipse/rse/internal/services/files/ftp/FTPService.java (-23 / +25 lines)
Lines 57-62 Link Here
57
import java.io.BufferedOutputStream;
57
import java.io.BufferedOutputStream;
58
import java.io.File;
58
import java.io.File;
59
import java.io.FileInputStream;
59
import java.io.FileInputStream;
60
import java.io.FileNotFoundException;
60
import java.io.FileOutputStream;
61
import java.io.FileOutputStream;
61
import java.io.IOException;
62
import java.io.IOException;
62
import java.io.InputStream;
63
import java.io.InputStream;
Lines 674-695 Link Here
674
		
688
		
675
		if (monitor!=null){
689
		if (monitor!=null){
676
			if (monitor.isCanceled()) {
690
			if (monitor.isCanceled()) {
677
				return false;
691
				throw new RemoteFileCancelledException();
678
			}	
692
			}	
679
		}
693
		}
680
		
694
		
681
		IHostFile remoteHostFile = getFile(remoteParent,remoteFile,null);
695
		IHostFile remoteHostFile = getFile(remoteParent,remoteFile,null);
682
		
696
		
683
		if(remoteHostFile == null)
684
		{
685
			return false;
686
		}
687
		
688
		if(!remoteHostFile.exists())
689
		{
690
			throw new RemoteFileIOException(new Exception(FTPServiceResources.FTPService_FTP_File_Service_Not_Found));
691
		} 
692
		
693
		if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE))
697
		if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE))
694
		{
698
		{
695
			try
699
			try
Lines 703-723 Link Here
703
				
707
				
704
				ftpClient.changeWorkingDirectory(remoteParent);
708
				ftpClient.changeWorkingDirectory(remoteParent);
705
				setFileType(isBinary);
709
				setFileType(isBinary);
706
				if (!localFile.exists())
707
				{
708
					File localParentFile = localFile.getParentFile();
709
					if (!localParentFile.exists())
710
					{
711
						localParentFile.mkdirs();
712
					}
713
					localFile.createNewFile();
714
				}
715
				
710
				
716
				output = new FileOutputStream(localFile);
717
				input = ftpClient.retrieveFileStream(remoteFile);
711
				input = ftpClient.retrieveFileStream(remoteFile);
718
				
712
				
719
				if(input != null)
713
				if(input != null)
720
				{
714
				{
715
					if (!localFile.exists())
716
					{
717
						File localParentFile = localFile.getParentFile();
718
						if (!localParentFile.exists())
719
						{
720
							localParentFile.mkdirs();
721
						}
722
						localFile.createNewFile();
723
					}
724
					
725
					output = new FileOutputStream(localFile);
721
					progressMonitor.init(0, remoteFile, localFile.getName(), remoteHostFile.getSize());
726
					progressMonitor.init(0, remoteFile, localFile.getName(), remoteHostFile.getSize());
722
					byte[] buffer = new byte[4096];
727
					byte[] buffer = new byte[4096];
723
					int readCount;
728
					int readCount;
Lines 740-751 Link Here
740
					output.close();
745
					output.close();
741
					
746
					
742
					ftpClient.completePendingCommand();
747
					ftpClient.completePendingCommand();
748
					
749
				}
750
				else
751
				{
752
					throw new RemoteFileIOException(new Exception(ftpClient.getReplyString()));
743
				}
753
				}
744
			}
754
			}
745
			catch (Exception e)
755
			catch (FileNotFoundException e)
756
			{
757
				throw new RemoteFileIOException(e);
758
			}
759
			catch (IOException e)
746
			{
760
			{
747
				throw new RemoteFileIOException(e);
761
				throw new RemoteFileIOException(e);
748
			} finally
762
			} 
763
			finally
749
			{
764
			{
750
				_commandMutex.release();
765
				_commandMutex.release();
751
			}
766
			}
(-)src/org/eclipse/rse/internal/services/files/ftp/FTPServiceResources.properties (-1 lines)
Lines 24-28 Link Here
24
FTP_File_Service_Copy_Not_Supported=FTP copy not supported, use move instead
24
FTP_File_Service_Copy_Not_Supported=FTP copy not supported, use move instead
25
FTP_File_Service_Listing_Job=Listing files...
25
FTP_File_Service_Listing_Job=Listing files...
26
FTP_File_Service_Listing_Job_Success=Success
26
FTP_File_Service_Listing_Job_Success=Success
27
FTPService_FTP_File_Service_Not_Found=File not found
28
FTP_File_Service_Monitor_Format={0,number,integer} KB of {1,number,integer} KB complete ({2,number,percent})
27
FTP_File_Service_Monitor_Format={0,number,integer} KB of {1,number,integer} KB complete ({2,number,percent})

Return to bug 191048