1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 21:15:23 +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) - [244277] [dstore] NPE on file save from old client
* David McKnight (IBM) - [246234] Change of file permissions changes the file owner * 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) - [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; package org.eclipse.rse.dstore.universal.miners;
@ -897,6 +898,7 @@ public class UniversalFileSystemMiner extends Miner {
*/ */
public DataElement handleQueryGetRemoteObject(DataElement subject, public DataElement handleQueryGetRemoteObject(DataElement subject,
DataElement status, String queryType) throws SystemMessageException { DataElement status, String queryType) throws SystemMessageException {
File fileobj = null; File fileobj = null;
boolean isVirtual = false; boolean isVirtual = false;
boolean isFilter = false; boolean isFilter = false;
@ -915,11 +917,20 @@ public class UniversalFileSystemMiner extends Miner {
else { else {
filterValue = System.getProperty("user.home"); //$NON-NLS-1$ 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); subject.setAttribute(DE.A_VALUE, filterValue);
} }
if (!isVirtual) else if (!isVirtual){
fileobj = new File(filterValue); fileobj = new File(filterValue);
} }
}
else if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR)) else if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR))
{ {
String name = subject.getName(); String name = subject.getName();
@ -951,6 +962,12 @@ public class UniversalFileSystemMiner extends Miner {
if (!isVirtual && fileobj != null && fileobj.exists()) { if (!isVirtual && fileobj != null && fileobj.exists()) {
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 // Get the canonical path name so that we preserve case for Windows
// systems. // systems.
// Even though Windows is case insensitive, we still want to // Even though Windows is case insensitive, we still want to
@ -958,10 +975,11 @@ public class UniversalFileSystemMiner extends Miner {
// when we show the path as a property to the user // when we show the path as a property to the user
try { try {
fullName = fileobj.getCanonicalPath(); fullName = fileobj.getCanonicalPath();
} catch (IOException e) { } catch (IOException e) {
return statusDone(status); return statusDone(status);
} }
}
*/
if (fileobj.isFile()) if (fileobj.isFile())
{ {
@ -996,22 +1014,20 @@ public class UniversalFileSystemMiner extends Miner {
subject.setAttribute(DE.A_NAME, name); subject.setAttribute(DE.A_NAME, name);
subject.setAttribute(DE.A_VALUE, path); subject.setAttribute(DE.A_VALUE, path);
String properties = setProperties(fileobj);
// if this is a symbolic link or a file, reclassify
// DKM - do basic property stuff here if (fileobj.isFile() || isSymlink){ //$NON-NLS-1$
subject.setAttribute(DE.A_SOURCE, setProperties(fileobj));
/*
// classify the file too // classify the file too
if (fileobj.isFile()) { FileClassifier classifier = new FileClassifier(subject);
subject.setAttribute(DE.A_SOURCE, subject subject.setAttribute(DE.A_SOURCE, properties + "|" + classifier.classifyFile(fileobj)); //$NON-NLS-1$
.getAttribute(DE.A_SOURCE) }
+ "|" + FileClassifier.classifyFile(fileobj)); else {
subject.setAttribute(DE.A_SOURCE, properties + "|" + "directory"); //$NON-NLS-1$//$NON-NLS-2$
} }
*/
status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS); status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS);
} else if (isVirtual) { } else if (isVirtual) {
try { try {
String goodFullPath = ArchiveHandlerManager String goodFullPath = ArchiveHandlerManager
@ -1114,7 +1130,7 @@ public class UniversalFileSystemMiner extends Miner {
return null; return null;
return (str[10]); return (str[11]);
} }
/** /**
* Method to obtain the filter string of file or folder. * 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) - [191280] [dstore] Expand fails for folder "/folk" with 3361 children
* Xuan Chen (IBM) - [215863]] NPE when Expanding Empty Zip File * Xuan Chen (IBM) - [215863]] NPE when Expanding Empty Zip File
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers * 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; package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -540,7 +541,7 @@ public class FileClassifier extends Thread
try try
{ {
String referencedFile = aFile.getCanonicalPath(); String referencedFile = aFile.getAbsolutePath();
// DKM - not sure why this was commented out but keeping it that way for now // DKM - not sure why this was commented out but keeping it that way for now
String specialEncoding = null;//System.getProperty("dstore.stdin.encoding"); 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) * 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 * 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) - [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; package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -116,9 +117,11 @@ public class FileQueryThread extends QueryThread
if (list != null) if (list != null)
{ {
createDataElement(_dataStore, _subject, list, _queryType, _filter,_inclusion); createDataElement(_dataStore, _subject, list, _queryType, _filter,_inclusion);
if (_subject.getSource() == null || _subject.getSource().equals("")){ //$NON-NLS-1$
String folderProperties = setProperties(_fileobj); String folderProperties = setProperties(_fileobj);
if (_subject.getSource() == null || _subject.getSource().equals("")) //$NON-NLS-1$
_subject.setAttribute(DE.A_SOURCE, folderProperties); _subject.setAttribute(DE.A_SOURCE, folderProperties);
}
if (!_isCancelled) if (!_isCancelled)
{ {
@ -151,7 +154,6 @@ public class FileQueryThread extends QueryThread
protected void createDataElement(DataStore ds, DataElement subject, protected void createDataElement(DataStore ds, DataElement subject,
File[] list, String queryType, String filter, int include, String types[]) File[] list, String queryType, String filter, int include, String types[])
{ {
HashMap filteredChildren = new HashMap(); HashMap filteredChildren = new HashMap();
List children = subject.getNestedData(); List children = subject.getNestedData();
if (children != null) if (children != null)