Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 75778 Details for
Bug 199243
[ftp][efs] Renaming a file in an FTP-based EFS folder hangs all of Eclipse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch creating the streams in different FTP sessions
patch.txt (text/plain), 4.37 KB, created by
Javier Montalvo Orús
on 2007-08-09 13:30:35 EDT
(
hide
)
Description:
patch creating the streams in different FTP sessions
Filename:
MIME Type:
Creator:
Javier Montalvo Orús
Created:
2007-08-09 13:30:35 EDT
Size:
4.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services.files.ftp >Index: src/org/eclipse/rse/internal/services/files/ftp/FTPService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java,v >retrieving revision 1.33 >diff -u -r1.33 FTPService.java >--- src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 2 Aug 2007 15:23:58 -0000 1.33 >+++ src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 9 Aug 2007 17:28:07 -0000 >@@ -69,6 +69,7 @@ > import java.io.IOException; > import java.io.InputStream; > import java.io.OutputStream; >+import java.net.SocketException; > import java.text.MessageFormat; > import java.util.ArrayList; > import java.util.HashMap; >@@ -164,6 +165,7 @@ > public void close() throws IOException { > super.close(); > client.completePendingCommand(); >+ client.logout(); > } > } > >@@ -199,6 +201,7 @@ > public void close() throws IOException { > super.close(); > client.completePendingCommand(); >+ client.logout(); > } > } > >@@ -411,6 +414,48 @@ > return _ftpClient; > } > >+ >+ private FTPClient cloneFTPClient(boolean isBinary) >+ { >+ >+ FTPClient ftpClient = new FTPClient(); >+ try { >+ ftpClient.connect(_ftpClient.getRemoteAddress()); >+ ftpClient.login(_userId,_password); >+ >+ if (_clientConfigProxy != null) { >+ ftpClient.configure(_clientConfigProxy.getFTPClientConfig()); >+ } else { >+ // UNIX parsing by default if no suitable parser found >+ ftpClient.configure(new FTPClientConfig(FTPClientConfig.SYST_UNIX)); >+ } >+ >+ if (_isPassiveDataConnectionMode) { >+ ftpClient.enterLocalPassiveMode(); >+ } >+ >+ if (isBinary) { >+ ftpClient.setFileType(FTP.BINARY_FILE_TYPE); >+ } else { >+ ftpClient.setFileType(FTP.ASCII_FILE_TYPE); >+ } >+ >+ ftpClient.registerSpyStream(_ftpLoggingOutputStream); >+ >+ } catch (Exception e) {} >+ >+ >+ return ftpClient; >+ } >+ >+ private void disconnect(FTPClient ftpClient) >+ { >+ ftpClient.registerSpyStream(null); >+ try { >+ ftpClient.logout(); >+ } catch (IOException e) {} >+ } >+ > /* > * (non-Javadoc) > * @see org.eclipse.rse.services.files.IFileService#getFile(String, String, IProgressMonitor) >@@ -1305,29 +1350,15 @@ > > InputStream stream = null; > >- if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) >- { >- try { >- FTPClient ftpClient = getFTPClient(); >- ftpClient.changeWorkingDirectory(remoteParent); >- setFileType(isBinary); >- stream = new FTPBufferedInputStream(ftpClient.retrieveFileStream(remoteFile), ftpClient); >+ try { >+ FTPClient ftpClient = cloneFTPClient(isBinary); >+ ftpClient.changeWorkingDirectory(remoteParent); >+ stream = new FTPBufferedInputStream(ftpClient.retrieveFileStream(remoteFile), ftpClient); > } > catch (Exception e) { > throw new RemoteFileIOException(e); >- }finally { >- //TODO I am not 100% sure but I _think_ that the _commandMutex >- //may only be released once reading the stream is complete, >- //since in FTPBufferedInputStream.close() a pending command >- //is being sent. >- //After all, the safer solution would be to have a separate >- //FTP client connection to the remote for the download, such >- //that dir channel remains free. See bug #198636 >- _commandMutex.release(); > } >- } else { >- throw new RemoteFileCancelledException(); >- } >+ > return stream; > } > >@@ -1343,20 +1374,14 @@ > > OutputStream stream = null; > >- if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) >- { >- try { >- FTPClient ftpClient = getFTPClient(); >- clearCache(remoteParent); >- ftpClient.changeWorkingDirectory(remoteParent); >- setFileType(isBinary); >- stream = new FTPBufferedOutputStream(ftpClient.storeFileStream(remoteFile), ftpClient); >- } >- catch (Exception e) { >- throw new RemoteFileIOException(e); >- }finally { >- _commandMutex.release(); >- } >+ try { >+ FTPClient ftpClient = cloneFTPClient(isBinary); >+ clearCache(remoteParent); >+ ftpClient.changeWorkingDirectory(remoteParent); >+ stream = new FTPBufferedOutputStream(ftpClient.storeFileStream(remoteFile), ftpClient); >+ } >+ catch (Exception e) { >+ throw new RemoteFileIOException(e); > } > > return stream;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
mober.at+eclipse
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 199243
: 75778