Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 74891 Details for
Bug 198046
[dstore] Cannot copy a folder into an archive file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
fix for bug 198046
patch_198046.txt (text/plain), 4.33 KB, created by
Xuan Chen
on 2007-07-29 22:51:01 EDT
(
hide
)
Description:
fix for bug 198046
Filename:
MIME Type:
Creator:
Xuan Chen
Created:
2007-07-29 22:51:01 EDT
Size:
4.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services.dstore >Index: miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java,v >retrieving revision 1.15 >diff -u -r1.15 UniversalFileSystemMiner.java >--- miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 24 Jul 2007 16:55:14 -0000 1.15 >+++ miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 30 Jul 2007 02:47:47 -0000 >@@ -19,6 +19,7 @@ > * Xuan Chen (IBM) - [191280] [dstore] Expand fails for folder "/folk" with 3361 children > * Kevin Doyle (IBM) - [195709] Windows Copying doesn't work when path contains space > * Kevin Doyle (IBM) - [196211] DStore Move tries rename if that fails copy/delete >+ * Xuan Chen (IBM) - [198046] [dstore] Cannot copy a folder into an archive file > *******************************************************************************/ > > package org.eclipse.rse.dstore.universal.miners; >@@ -26,7 +27,9 @@ > import java.io.IOException; > import java.io.InputStream; > import java.net.ServerSocket; >+import java.util.ArrayList; > import java.util.HashMap; >+import java.util.HashSet; > import java.util.Iterator; > import java.util.List; > >@@ -237,6 +240,8 @@ > > File[] srcFiles = new File[numOfSources]; > String[] names = new String[numOfSources]; >+ ArrayList allSrcFilesArrayList = new ArrayList(); >+ ArrayList allNamesArrayList = new ArrayList(); > > for (int i = 0; i < numOfSources; i++) > { >@@ -263,6 +268,21 @@ > VirtualChild child = shandler.getVirtualFile(svpath.getVirtualPart()); > srcFiles[i] = child.getExtractedFile(); > } >+ //We need to check if this is File object is an Directory. If yes, >+ //we need to also find out all its descendants . >+ HashSet children = new HashSet(); >+ listAllFiles(srcFiles[i], children); >+ Object[] kids = children.toArray(); >+ int charsToTrim = srcFiles[i].getParentFile().getAbsolutePath().length() + 1; >+ for (int j = 0; j < children.size(); j++) >+ { >+ allSrcFilesArrayList.add(kids[j]); >+ String thisName = ((File)(kids[j])).getAbsolutePath().substring(charsToTrim); >+ thisName = thisName.replace('\\','/'); >+ allNamesArrayList.add(thisName); >+ } >+ allSrcFilesArrayList.add(srcFiles[i]); >+ allNamesArrayList.add(names[i]); > } > String virtualContainer = ""; //$NON-NLS-1$ > >@@ -271,7 +291,18 @@ > virtualContainer = vpath.getVirtualPart(); > } > >- boolean result = handler.add(srcFiles, virtualContainer, names); >+ //Now, we need to create a real list of files (including all the descendant) and pass it to the add() method >+ File[] resultSrcFiles = new File[allSrcFilesArrayList.size()]; >+ String[] resultNames = new String[allNamesArrayList.size()]; >+ //From the way we add all source files and their corresponding names into the two arrays, the sizes of those two >+ //arrays should be the same. >+ for (int i = 0; i < allSrcFilesArrayList.size(); i++) >+ { >+ resultSrcFiles[i] = (File)allSrcFilesArrayList.get(i); >+ resultNames[i] = (String)allNamesArrayList.get(i); >+ } >+ >+ boolean result = handler.add(resultSrcFiles, virtualContainer, resultNames); > > if (result) { > status.setAttribute(DE.A_SOURCE, IServiceConstants.SUCCESS); >@@ -2434,4 +2465,33 @@ > { > return "7.0.0"; //$NON-NLS-1$ > } >+ >+ /** >+ * Helper method. . . populates <code>found</code> with a >+ * collapsed list of all nodes in the subtree >+ * of the file system rooted at <code>parent</code>. >+ */ >+ private static void listAllFiles(File parent, HashSet found) >+ { >+ File[] children = parent.listFiles(); >+ if (children == null) // DKM - 56031, no authority on parent yields null >+ { >+ found.remove(parent); >+ return; >+ } >+ for (int i = 0; i < children.length; i++) >+ { >+ if (!found.contains(children[i])) // prevent infinite loops due to symlinks >+ { >+ if (children[i].canRead()) >+ { >+ found.add(children[i]); >+ if (children[i].isDirectory()) >+ { >+ listAllFiles(children[i], found); >+ } >+ } >+ } >+ } >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198046
:
74891
|
75376
|
75426