diff --git a/rse/plugins/org.eclipse.rse.connectorservice.telnet/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.connectorservice.telnet/META-INF/MANIFEST.MF index 27821e37bd2..5f88dd381cb 100644 --- a/rse/plugins/org.eclipse.rse.connectorservice.telnet/META-INF/MANIFEST.MF +++ b/rse/plugins/org.eclipse.rse.connectorservice.telnet/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)", org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", org.eclipse.ui, - org.apache.commons.net;bundle-version="[1.4.1,2.0.0)" + org.apache.commons.net;bundle-version="[1.4.1,3.0.0)" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Export-Package: org.eclipse.rse.internal.connectorservice.telnet;x-friends:="org.eclipse.rse.subsystems.shells.telnet" diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.services.files.ftp/META-INF/MANIFEST.MF index 1ad20dca024..d9d5ea27951 100644 --- a/rse/plugins/org.eclipse.rse.services.files.ftp/META-INF/MANIFEST.MF +++ b/rse/plugins/org.eclipse.rse.services.files.ftp/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)", - org.apache.commons.net;bundle-version="[1.4.1,2.0.0)", + org.apache.commons.net;bundle-version="[1.4.1,3.0.0)", org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java index 22cefd1e4d8..67b42233afe 100644 --- a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java +++ b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java @@ -94,6 +94,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.text.MessageFormat; import java.util.ArrayList; @@ -101,6 +102,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.net.ProtocolCommandEvent; +import org.apache.commons.net.ProtocolCommandListener; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClientConfig; @@ -151,6 +154,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil private transient String _controlEncoding; //Encoding to be used for file and path names private OutputStream _ftpLoggingOutputStream; + private ProtocolCommandListener _ftpProtocolCommandListener; private IPropertySet _ftpPropertySet; private Exception _exception; @@ -368,7 +372,20 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil if(_ftpLoggingOutputStream!=null) { - _ftpClient.registerSpyStream(_ftpLoggingOutputStream); + _ftpProtocolCommandListener = new ProtocolCommandListener() { + + private PrintStream os = new PrintStream(_ftpLoggingOutputStream); + + public void protocolCommandSent(ProtocolCommandEvent event) { + os.print(event.getMessage()); + } + + public void protocolReplyReceived(ProtocolCommandEvent event) { + os.println(event.getMessage()); + } + + }; + _ftpClient.addProtocolCommandListener(_ftpProtocolCommandListener); } if (_portNumber == 0) { @@ -382,18 +399,17 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil if(FTPReply.isPositiveIntermediate(userReply)) { //intermediate response, provide password and hide it from the console - - String newLine = System.getProperty("line.separator"); //$NON-NLS-1$ - - _ftpClient.registerSpyStream(null); - - _ftpLoggingOutputStream.write(("PASS ******"+newLine).getBytes()); //$NON-NLS-1$ - int passReply = _ftpClient.pass(_password); - _ftpLoggingOutputStream.write((_ftpClient.getReplyString()+newLine).getBytes()); - - if(_ftpLoggingOutputStream!=null) + int passReply; + if (_ftpProtocolCommandListener != null) { - _ftpClient.registerSpyStream(_ftpLoggingOutputStream); + _ftpClient.removeProtocolCommandListener(_ftpProtocolCommandListener); + String newLine = System.getProperty("line.separator"); //$NON-NLS-1$ + _ftpLoggingOutputStream.write(("PASS ******" + newLine).getBytes()); //$NON-NLS-1$ + passReply = _ftpClient.pass(_password); + _ftpLoggingOutputStream.write((_ftpClient.getReplyString() + newLine).getBytes()); + _ftpClient.addProtocolCommandListener(_ftpProtocolCommandListener); + } else { + passReply = _ftpClient.pass(_password); } if(!FTPReply.isPositiveCompletion(passReply)) @@ -548,7 +564,9 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil } else { ftpClient.setFileType(FTP.ASCII_FILE_TYPE); } - ftpClient.registerSpyStream(_ftpLoggingOutputStream); + if (_ftpProtocolCommandListener != null) { + ftpClient.addProtocolCommandListener(_ftpProtocolCommandListener); + } ok=true; } finally { //disconnect the erroneous ftpClient, but forward the exception diff --git a/rse/plugins/org.eclipse.rse.services.telnet/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.services.telnet/META-INF/MANIFEST.MF index 32d70c13735..537e38291ae 100644 --- a/rse/plugins/org.eclipse.rse.services.telnet/META-INF/MANIFEST.MF +++ b/rse/plugins/org.eclipse.rse.services.telnet/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-Activator: org.eclipse.rse.internal.services.telnet.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, org.eclipse.rse.services;bundle-version="[3.1.0,4.0.0)", - org.apache.commons.net;bundle-version="[1.4.1,2.0.0)" + org.apache.commons.net;bundle-version="[1.4.1,3.0.0)" Export-Package: org.eclipse.rse.internal.services.telnet;x-friends:="org.eclipse.rse.connectorservice.telnet,org.eclipse.rse.subsystems.shells.telnet", org.eclipse.rse.internal.services.telnet.terminal;x-friends:="org.eclipse.rse.subsystems.shells.telnet" Bundle-ActivationPolicy: lazy diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF index cab6d180159..9c8da42a5c3 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF +++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", org.eclipse.ui.console, org.eclipse.rse.services.files.ftp;bundle-version="[3.0.0,4.0.0)", - org.apache.commons.net;bundle-version="[1.4.1,2.0.0)" + org.apache.commons.net;bundle-version="[1.4.1,3.0.0)" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Export-Package: org.eclipse.rse.internal.subsystems.files.ftp;x-internal:=true, diff --git a/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF b/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF index 5e603fbf474..43c145e66ef 100644 --- a/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF +++ b/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF @@ -27,7 +27,7 @@ Require-Bundle: org.junit, org.eclipse.rse.files.ui, org.eclipse.rse.efs, org.eclipse.rse.tests.framework;bundle-version="[2.0.0,3.0.0)", - org.apache.commons.net;bundle-version="[1.4.1,2.0.0)", + org.apache.commons.net;bundle-version="[1.4.1,3.0.0)", org.eclipse.rse.subsystems.terminals.core;bundle-version="[1.0.0,2.0.0)" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true