mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-18 13:45:45 +02:00
[267473] Prepare for Commons Net 2.0
This commit is contained in:
parent
ac5d34e066
commit
0986bc54f9
6 changed files with 36 additions and 18 deletions
|
@ -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.core;bundle-version="[3.0.0,4.0.0)",
|
||||||
org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
|
org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
|
||||||
org.eclipse.ui,
|
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
|
Bundle-ActivationPolicy: lazy
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
Export-Package: org.eclipse.rse.internal.connectorservice.telnet;x-friends:="org.eclipse.rse.subsystems.shells.telnet"
|
Export-Package: org.eclipse.rse.internal.connectorservice.telnet;x-friends:="org.eclipse.rse.subsystems.shells.telnet"
|
||||||
|
|
|
@ -8,7 +8,7 @@ Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)",
|
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)"
|
org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
|
|
|
@ -94,6 +94,7 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -101,6 +102,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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.FTP;
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.apache.commons.net.ftp.FTPClientConfig;
|
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 transient String _controlEncoding; //Encoding to be used for file and path names
|
||||||
|
|
||||||
private OutputStream _ftpLoggingOutputStream;
|
private OutputStream _ftpLoggingOutputStream;
|
||||||
|
private ProtocolCommandListener _ftpProtocolCommandListener;
|
||||||
private IPropertySet _ftpPropertySet;
|
private IPropertySet _ftpPropertySet;
|
||||||
private Exception _exception;
|
private Exception _exception;
|
||||||
|
|
||||||
|
@ -368,7 +372,20 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
||||||
|
|
||||||
if(_ftpLoggingOutputStream!=null)
|
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) {
|
if (_portNumber == 0) {
|
||||||
|
@ -382,18 +399,17 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
||||||
if(FTPReply.isPositiveIntermediate(userReply))
|
if(FTPReply.isPositiveIntermediate(userReply))
|
||||||
{
|
{
|
||||||
//intermediate response, provide password and hide it from the console
|
//intermediate response, provide password and hide it from the console
|
||||||
|
int passReply;
|
||||||
String newLine = System.getProperty("line.separator"); //$NON-NLS-1$
|
if (_ftpProtocolCommandListener != null)
|
||||||
|
|
||||||
_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)
|
|
||||||
{
|
{
|
||||||
_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))
|
if(!FTPReply.isPositiveCompletion(passReply))
|
||||||
|
@ -548,7 +564,9 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
|
||||||
} else {
|
} else {
|
||||||
ftpClient.setFileType(FTP.ASCII_FILE_TYPE);
|
ftpClient.setFileType(FTP.ASCII_FILE_TYPE);
|
||||||
}
|
}
|
||||||
ftpClient.registerSpyStream(_ftpLoggingOutputStream);
|
if (_ftpProtocolCommandListener != null) {
|
||||||
|
ftpClient.addProtocolCommandListener(_ftpProtocolCommandListener);
|
||||||
|
}
|
||||||
ok=true;
|
ok=true;
|
||||||
} finally {
|
} finally {
|
||||||
//disconnect the erroneous ftpClient, but forward the exception
|
//disconnect the erroneous ftpClient, but forward the exception
|
||||||
|
|
|
@ -7,7 +7,7 @@ Bundle-Activator: org.eclipse.rse.internal.services.telnet.Activator
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.rse.services;bundle-version="[3.1.0,4.0.0)",
|
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",
|
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"
|
org.eclipse.rse.internal.services.telnet.terminal;x-friends:="org.eclipse.rse.subsystems.shells.telnet"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
|
|
@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui,
|
||||||
org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
|
org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
|
||||||
org.eclipse.ui.console,
|
org.eclipse.ui.console,
|
||||||
org.eclipse.rse.services.files.ftp;bundle-version="[3.0.0,4.0.0)",
|
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
|
Bundle-ActivationPolicy: lazy
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
Export-Package: org.eclipse.rse.internal.subsystems.files.ftp;x-internal:=true,
|
Export-Package: org.eclipse.rse.internal.subsystems.files.ftp;x-internal:=true,
|
||||||
|
|
|
@ -27,7 +27,7 @@ Require-Bundle: org.junit,
|
||||||
org.eclipse.rse.files.ui,
|
org.eclipse.rse.files.ui,
|
||||||
org.eclipse.rse.efs,
|
org.eclipse.rse.efs,
|
||||||
org.eclipse.rse.tests.framework;bundle-version="[2.0.0,3.0.0)",
|
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)"
|
org.eclipse.rse.subsystems.terminals.core;bundle-version="[1.0.0,2.0.0)"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
|
|
Loading…
Add table
Reference in a new issue