1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55:22 +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) - [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 * 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 * 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; package org.eclipse.rse.internal.services.dstore.files;
@ -2023,7 +2024,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return true; return this.unixStyle;
} }
public void setLastModified(String parent, String name, public void setLastModified(String parent, String name,

View file

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

View file

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

View file

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