1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 13:05:22 +02:00

[251729][dstore] problems querying symbolic link folder

This commit is contained in:
David McKnight 2008-10-22 17:25:50 +00:00
parent a39604971e
commit 532a076d3f
3 changed files with 51 additions and 32 deletions

View file

@ -38,6 +38,7 @@
* David McKnight (IBM) - [244277] [dstore] NPE on file save from old client
* David McKnight (IBM) - [246234] Change of file permissions changes the file owner
* David McKnight (IBM) - [250168] handleCommand should not blindly set the status to "done"
* David McKnight (IBM) - [251729][dstore] problems querying symbolic link folder
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@ -897,6 +898,7 @@ public class UniversalFileSystemMiner extends Miner {
*/
public DataElement handleQueryGetRemoteObject(DataElement subject,
DataElement status, String queryType) throws SystemMessageException {
File fileobj = null;
boolean isVirtual = false;
boolean isFilter = false;
@ -914,11 +916,20 @@ public class UniversalFileSystemMiner extends Miner {
}
else {
filterValue = System.getProperty("user.home"); //$NON-NLS-1$
}
try {
// "." needs canonical file
fileobj = new File(filterValue).getCanonicalFile();
}
catch (Exception e){
fileobj = new File(filterValue);
}
subject.setAttribute(DE.A_VALUE, filterValue);
}
if (!isVirtual)
else if (!isVirtual){
fileobj = new File(filterValue);
}
}
else if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR))
{
@ -950,19 +961,26 @@ public class UniversalFileSystemMiner extends Miner {
}
if (!isVirtual && fileobj != null && fileobj.exists()) {
// Get the canonical path name so that we preserve case for Windows
// systems.
// Even though Windows is case insensitive, we still want to
// preserve case
// when we show the path as a property to the user
try {
fullName = fileobj.getCanonicalPath();
} catch (IOException e) {
return statusDone(status);
String oldProperties = subject.getAttribute(DE.A_SOURCE);
boolean isSymlink = oldProperties != null && (oldProperties.indexOf("symbolic link") > 0);//$NON-NLS-1$
fullName = fileobj.getAbsolutePath();
/* should not need canonical path here. It causes bug 251729
{
// Get the canonical path name so that we preserve case for Windows
// systems.
// Even though Windows is case insensitive, we still want to
// preserve case
// when we show the path as a property to the user
try {
fullName = fileobj.getCanonicalPath();
} catch (IOException e) {
return statusDone(status);
}
}
*/
if (fileobj.isFile())
{
if (_archiveHandlerManager.isArchive(fileobj)) {
@ -996,22 +1014,20 @@ public class UniversalFileSystemMiner extends Miner {
subject.setAttribute(DE.A_NAME, name);
subject.setAttribute(DE.A_VALUE, path);
// DKM - do basic property stuff here
subject.setAttribute(DE.A_SOURCE, setProperties(fileobj));
/*
// classify the file too
if (fileobj.isFile()) {
subject.setAttribute(DE.A_SOURCE, subject
.getAttribute(DE.A_SOURCE)
+ "|" + FileClassifier.classifyFile(fileobj));
String properties = setProperties(fileobj);
// if this is a symbolic link or a file, reclassify
if (fileobj.isFile() || isSymlink){ //$NON-NLS-1$
// classify the file too
FileClassifier classifier = new FileClassifier(subject);
subject.setAttribute(DE.A_SOURCE, properties + "|" + classifier.classifyFile(fileobj)); //$NON-NLS-1$
}
else {
subject.setAttribute(DE.A_SOURCE, properties + "|" + "directory"); //$NON-NLS-1$//$NON-NLS-2$
}
*/
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
} else if (isVirtual) {
try {
String goodFullPath = ArchiveHandlerManager
@ -1114,7 +1130,7 @@ public class UniversalFileSystemMiner extends Miner {
return null;
return (str[10]);
return (str[11]);
}
/**
* Method to obtain the filter string of file or folder.

View file

@ -17,6 +17,7 @@
* Xuan Chen (IBM) - [191280] [dstore] Expand fails for folder "/folk" with 3361 children
* Xuan Chen (IBM) - [215863]] NPE when Expanding Empty Zip File
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
* David McKnight (IBM) - [251729][dstore] problems querying symbolic link folder
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -540,7 +541,7 @@ public class FileClassifier extends Thread
try
{
String referencedFile = aFile.getCanonicalPath();
String referencedFile = aFile.getAbsolutePath();
// DKM - not sure why this was commented out but keeping it that way for now
String specialEncoding = null;//System.getProperty("dstore.stdin.encoding");

View file

@ -14,6 +14,7 @@
* David McKnight (IBM) - [209387] Should not delete elements for files that still exist (but are filtered out)
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
* David McKnight (IBM) - [251650] [dstore] Multiple copies of symbolic link file show in Table view
* David McKnight (IBM) - [251729][dstore] problems querying symbolic link folder
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -116,10 +117,12 @@ public class FileQueryThread extends QueryThread
if (list != null)
{
createDataElement(_dataStore, _subject, list, _queryType, _filter,_inclusion);
String folderProperties = setProperties(_fileobj);
if (_subject.getSource() == null || _subject.getSource().equals("")) //$NON-NLS-1$
if (_subject.getSource() == null || _subject.getSource().equals("")){ //$NON-NLS-1$
String folderProperties = setProperties(_fileobj);
_subject.setAttribute(DE.A_SOURCE, folderProperties);
}
if (!_isCancelled)
{
FileClassifier clsfy = getFileClassifier(_subject);
@ -151,7 +154,6 @@ public class FileQueryThread extends QueryThread
protected void createDataElement(DataStore ds, DataElement subject,
File[] list, String queryType, String filter, int include, String types[])
{
HashMap filteredChildren = new HashMap();
List children = subject.getNestedData();
if (children != null)