1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 23:25:26 +02:00

[235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote

This commit is contained in:
Martin Oberhuber 2008-06-03 21:12:00 +00:00
parent f02280993f
commit 7fd4ac6495
4 changed files with 71 additions and 57 deletions

View file

@ -45,6 +45,7 @@
* David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
* David McKnight (IBM) - [221211] [api][breaking][files] need batch operations to indicate which operations were successful
* Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean
* Martin Oberhuber (Wind River) - [235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote
*******************************************************************************/
package org.eclipse.rse.internal.services.dstore.files;
@ -2023,7 +2024,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
public boolean isCaseSensitive()
{
return true;
return this.unixStyle;
}
public void setLastModified(String parent, String name,

View file

@ -76,6 +76,7 @@
* Radoslav Gerganov (ProSyst) - [230919] IFileService.delete() should not return a boolean
* Martin Oberhuber (Wind River) - [218040] FTP should support permission modification
* Martin Oberhuber (Wind River) - [234045] FTP Permission Error Handling
* Martin Oberhuber (Wind River) - [235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote
********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp;
@ -137,6 +138,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
private Mutex _commandMutex = new Mutex();
private String _userHome;
private boolean _caseSensitive = true;
private transient String _hostName;
private transient String _userId;
private transient String _password;
@ -572,7 +574,7 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
*/
protected FTPHostFile getFileInternal(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
{
remoteParent = checkEncoding(remoteParent);
remoteParent = checkEncoding(remoteParent);
fileName = checkEncoding(fileName);
if (monitor!=null){
if (monitor.isCanceled()) {
@ -603,50 +605,46 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
FTPHostFile file = null;
if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE))
{
try{
try {
//try to retrieve the file
_ftpClient = getFTPClient();
if(!_ftpClient.changeWorkingDirectory(remoteParent))
{
throw new RemoteFileIOException(new Exception(_ftpClient.getReplyString()));
}
throw new RemoteFileIOException(new Exception(_ftpClient.getReplyString()));
}
if(!listFiles(monitor))
{
throw new SystemOperationCancelledException();
}
throw new SystemOperationCancelledException();
}
synchronized(_fCachePreviousFiles) {
cacheFiles(remoteParent);
synchronized (_fCachePreviousFiles) {
cacheFiles(remoteParent);
//Bug 198645: try exact match first
Object o = _fCachePreviousFiles.get(fileName);
//Bug 198645: try exact match first
Object o = _fCachePreviousFiles.get(fileName);
if (o!=null) return (FTPHostFile)o;
//try case insensitive match (usually never executed)
if (!isCaseSensitive()) {
for (int i = 0; i < _ftpFiles.length; i++) {
String tempName = _ftpFiles[i].getName();
if(tempName.equalsIgnoreCase(fileName)) {
file = (FTPHostFile)_fCachePreviousFiles.get(tempName);
break;
//try case insensitive match (usually never executed)
if (!isCaseSensitive()) {
for (int i = 0; i < _ftpFiles.length; i++) {
String tempName = _ftpFiles[i].getName();
if (tempName.equalsIgnoreCase(fileName)) {
file = (FTPHostFile) _fCachePreviousFiles.get(tempName);
break;
}
}
}
}
}
// if not found, create new object with non-existing flag
if(file == null)
{
file = new FTPHostFile(remoteParent,fileName, false, false, 0, 0, false);
}
}catch (Exception e){
} catch (Exception e) {
throw new RemoteFileIOException(e);
} finally {
_commandMutex.release();
@ -1362,10 +1360,13 @@ public class FTPService extends AbstractFileService implements IFTPService, IFil
}
}
public void setIsCaseSensitive(boolean b) {
_caseSensitive = b;
}
public boolean isCaseSensitive()
{
//TODO find out whether remote is case sensitive or not
return true;
return _caseSensitive;
}
/**

View file

@ -7,13 +7,14 @@
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
*
* Contributors:
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David Dykstal (IBM) - [222270] clean up interfaces in org.eclipse.rse.core.filters
* Martin Oberhuber (Wind River) - [235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote
*******************************************************************************/
package org.eclipse.rse.subsystems.files.dstore;
@ -28,13 +29,19 @@ import org.eclipse.rse.ui.SystemBasePlugin;
public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystemConfiguration
{
public DStoreWindowsFileSubSystemConfiguration() {
super();
_isWindows = true;
setIsUnixStyle(!_isWindows);
}
protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr)
{
ISystemFilterPool pool = null;
try {
// -----------------------------------------------------
// create a pool named filters
// -----------------------------------------------------
// -----------------------------------------------------
pool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user
if (pool == null) // hmmm, why would this happen?
{
@ -53,7 +60,7 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem
ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings);
filter.setNonChangable(true);
filter.setSingleFilterStringOnly(true);
RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this);
filterStrings = new String[] {defaultFilterString.toString()};
String filterName = SystemFileResources.RESID_FILTER_DRIVES;
@ -86,6 +93,6 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem
return '\\';
}
}

View file

@ -7,10 +7,10 @@
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
*
* Contributors:
* Javier Montalvo Orus (Symbian) - Bug 140348 - FTP did not use port number
* Javier Montalvo Orus (Symbian) - Bug 161209 - Need a Log of ftp commands
@ -23,6 +23,7 @@
* David McKnight (IBM) - [196632] [ftp] Passive mode setting does not work
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
* Martin Oberhuber (Wind River) - [203500] Support encodings for FTP paths
* Martin Oberhuber (Wind River) - [235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.ftp.connectorservice;
@ -50,41 +51,45 @@ import org.eclipse.ui.console.MessageConsole;
public class FTPConnectorService extends StandardConnectorService
public class FTPConnectorService extends StandardConnectorService
{
protected FTPService _ftpService;
/** Indicates the default string encoding on this platform */
private static String _defaultEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding();
public FTPConnectorService(IHost host, int port)
{
{
super(FTPSubsystemResources.RESID_FTP_CONNECTORSERVICE_NAME,FTPSubsystemResources.RESID_FTP_CONNECTORSERVICE_DESCRIPTION, host, port);
_ftpService = new FTPService();
if (getHost().getSystemType().isWindows()) {
// Configured against a Windows-specific system type
_ftpService.setIsCaseSensitive(false);
}
getPropertySet();
}
private IPropertySet getPropertySet()
{
IPropertySet propertySet = getPropertySet("FTP Settings"); //$NON-NLS-1$
if(propertySet==null)
{
//Active - passive mode
propertySet = createPropertySet("FTP Settings"); //$NON-NLS-1$
propertySet.addProperty("passive","false",PropertyType.getEnumPropertyType(new String[]{"true","false"})); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// FTP List parser
String[] keys = FTPClientConfigFactory.getParserFactory().getKeySet();
String[] keysArray = new String[keys.length+1];
System.arraycopy(keys, 0, keysArray, 0, keys.length);
keysArray[keysArray.length-1]="AUTO"; //$NON-NLS-1$
Arrays.sort(keysArray);
propertySet.addProperty("parser","AUTO",PropertyType.getEnumPropertyType(keysArray)); //$NON-NLS-1$ //$NON-NLS-2$
}
if (propertySet instanceof ILabeledObject) {
@ -93,7 +98,7 @@ public class FTPConnectorService extends StandardConnectorService
}
return propertySet;
}
protected void internalConnect(IProgressMonitor monitor) throws RemoteFileException, IOException
{
internalConnect();
@ -119,7 +124,7 @@ public class FTPConnectorService extends StandardConnectorService
if (encoding==null) encoding = _defaultEncoding;
//</code to be in IHost>
_ftpService.setControlEncoding(encoding);
_ftpService.connect();
}
@ -140,36 +145,36 @@ public class FTPConnectorService extends StandardConnectorService
private OutputStream getLoggingStream(String hostName,int portNumber)
{
MessageConsole messageConsole=null;
IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
for (int i = 0; i < consoles.length; i++) {
if(consoles[i].getName().equals("FTP log: "+hostName+":"+portNumber)) { //$NON-NLS-1$ //$NON-NLS-2$
messageConsole = (MessageConsole)consoles[i];
break;
}
}
}
if(messageConsole==null){
messageConsole = new MessageConsole("FTP log: "+hostName+":"+portNumber, null); //$NON-NLS-1$ //$NON-NLS-2$
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[]{ messageConsole });
}
ConsolePlugin.getDefault().getConsoleManager().showConsoleView(messageConsole);
return messageConsole.newOutputStream();
}
public IFileService getFileService()
{
return _ftpService;
}
protected void internalDisconnect(IProgressMonitor monitor)
{
_ftpService.disconnect();
}
public boolean isConnected()
public boolean isConnected()
{
return (_ftpService != null && _ftpService.isConnected());
}