[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tm-cvs-commit] dmcknight org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem FileClassifier.java

Update of /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem
In directory dev1:/tmp/cvs-serv31258/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem

Modified Files:
	FileClassifier.java 
Log Message:
[153635] [dstore-linux] dangling symbolic links are not classified properly


Index: FileClassifier.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileClassifier.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** FileClassifier.java	25 Feb 2011 16:37:01 -0000	1.13
--- FileClassifier.java	8 Mar 2011 18:59:08 -0000	1.14
***************
*** 21,24 ****
--- 21,25 ----
   * Noriaki Takatsu  (IBM)        - [256724] thread-level security is not established
   * David McKnight   (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support
+  * David McKnight   (IBM)        - [153635] [dstore-linux] dangling symbolic links are not classified properly
   *******************************************************************************/
  
***************
*** 164,168 ****
          // determine if we are classifying virtual files
          // we are if the subject is an archive, virtual folder or a virtual file
!         if (objType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR) || objType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)
                  || objType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR))
          {
--- 165,170 ----
          // determine if we are classifying virtual files
          // we are if the subject is an archive, virtual folder or a virtual file
!         if (objType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR) || 
!         		objType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)
                  || objType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR))
          {
***************
*** 192,217 ****
                  if (child != null && !child.isDeleted())
                  {
!                 if (child.getType().equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR)
!                         || child.getType().equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
!                         || child.getType().equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR))
!                 {
!                     String name = child.getName();
!                     String properties = child.getSource();
! 
!                     // if this file has already been classified
!                     // ignore it
!                     String[] tokens = properties.split("\\" + IServiceConstants.TOKEN_SEPARATOR); //$NON-NLS-1$
! 
!                     if (tokens.length < 12)
!                     {
!                         putElement(name, child);
!                     }
!                     /*
!                      * StringTokenizer tokenizer = new
!                      * StringTokenizer(properties,
!                      * IUniversalDataStoreConstants.TOKEN_SEPARATOR); if
!                      * (tokenizer.countTokens() < 12) { putElement(name, child); }
!                      */
!                 }
                  }
              }
--- 194,221 ----
                  if (child != null && !child.isDeleted())
                  {
!                 	String type = child.getType();
! 	                if (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR)
! 	                        || type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
! 	                        || type.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR)
! 	                        || type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR))
! 	                {
! 	                    String name = child.getName();
! 	                    String properties = child.getSource();
! 	
! 	                    // if this file has already been classified
! 	                    // ignore it
! 	                    String[] tokens = properties.split("\\" + IServiceConstants.TOKEN_SEPARATOR); //$NON-NLS-1$
! 	
! 	                    if (tokens.length < 12)
! 	                    {
! 	                        putElement(name, child);
! 	                    }
! 	                    /*
! 	                     * StringTokenizer tokenizer = new
! 	                     * StringTokenizer(properties,
! 	                     * IUniversalDataStoreConstants.TOKEN_SEPARATOR); if
! 	                     * (tokenizer.countTokens() < 12) { putElement(name, child); }
! 	                     */
! 	                }
                  }
              }
***************
*** 792,799 ****
                                  	path.append(File.separatorChar);
                                  	path.append(element.getName());
!                                     File refFile = new File(path.toString());
  
                                      // canonical file path
- 
                                      String canonicalPath = null;
  
--- 796,802 ----
                                  	path.append(File.separatorChar);
                                  	path.append(element.getName());
!                                    
  
                                      // canonical file path
                                      String canonicalPath = null;
  
***************
*** 803,807 ****
                                      if (type.equals(STR_SYMBOLIC_LINK) && !resolveLinks)
                                      {
! 
                                          // get canonical file path
                                          canonicalPath = refFile.getCanonicalPath();
--- 806,810 ----
                                      if (type.equals(STR_SYMBOLIC_LINK) && !resolveLinks)
                                      {
!                                     	File refFile = new File(path.toString());
                                          // get canonical file path
                                          canonicalPath = refFile.getCanonicalPath();
***************
*** 844,847 ****
--- 847,851 ----
                                          if (type.equals(STR_SYMBOLIC_LINK))
                                          {
+                                         	File refFile = new File(path.toString());
                                              canonicalPath = refFile.getCanonicalPath();
                                          }
***************
*** 869,874 ****
  
                                      int linkIndex = currentProperties.lastIndexOf(textToCheck);
  
!                                     if (linkIndex != -1)
                                      {
                                          int cutOffIndex = linkIndex + textToCheck.length();
--- 873,879 ----
  
                                      int linkIndex = currentProperties.lastIndexOf(textToCheck);
+                                //     int brokenLink = currentProperties.lastIndexOf(STR_BROKEN_SYMBOLIC_LINK);
  
!                                     if (linkIndex != -1)// && brokenLink == 0)
                                      {
                                          int cutOffIndex = linkIndex + textToCheck.length();
***************
*** 906,909 ****
--- 911,915 ----
              }
  
+         	_dataStore.trace("out of loop");
              if (reader != null)
                  reader.close();
***************
*** 913,916 ****
--- 919,923 ----
              if (hasLinks)
              {
+             	_dataStore.trace("has links");
                  // if we were told not to resolve them, but we are capable of
                  // doing so, then