From 4a7d3364125fb6d87b557a0d710e39bc1cbc245d Mon Sep 17 00:00:00 2001 From: Xuan Chen Date: Thu, 4 Oct 2007 13:49:44 +0000 Subject: [PATCH] [190824] fix: Incorrect result for DStore#getSeparator() function when parent is "/" --- .../dstore/files/DStoreFileService.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java index 4e45f9aeb4a..423d6477306 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java @@ -19,6 +19,7 @@ * David McKnight (IBM) - [196035] Wrapper SystemMessageExceptions for createFile and createFolder with RemoteFileSecurityException * Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error * Xuan Chen (IBM) - [202670] [Supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted" + * Xuan Chen (IBM) - [190824] Incorrect result for DStore#getSeparator() function when parent is "/" ********************************************************************************/ package org.eclipse.rse.internal.services.dstore.files; @@ -789,7 +790,22 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer */ protected String getSeparator(String parentPath) { - if (parentPath == null || parentPath.length() < 2) return "/"; //$NON-NLS-1$ + if (parentPath == null || parentPath.length() < 1) return "/"; //$NON-NLS-1$ + if (parentPath.length() == 1) + { + //deal with the case where parentPath has only one character here + //since the code below assumes parentPath has at least two characters. + if (parentPath.charAt(0) == '/') + { + return ""; //$NON-NLS-1$ + } + else + { + //If only one character, but not '/', just return "/" as default. But this should not happen. + return "/"; //$NON-NLS-1$ + } + } + if (parentPath.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR)) return ""; //$NON-NLS-1$ if (parentPath.endsWith(ArchiveHandlerManager.VIRTUAL_CANONICAL_SEPARATOR))