From 78377ba5c3f68813849d0bd5615ebd0a546be6e1 Mon Sep 17 00:00:00 2001 From: Britt Park Date: Thu, 10 May 2007 15:55:41 +0000 Subject: [PATCH] Cleanup of goofy looking paths. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5656 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/deploy/DeploymentServiceImpl.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java b/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java index c1b843a791..d4c62e1a92 100644 --- a/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java +++ b/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java @@ -674,10 +674,10 @@ public class DeploymentServiceImpl implements DeploymentService // This means no entry on src so delete. if (src == null) { - String newDstPath = dstPath + '/' + dst.getName(); + String newDstPath = extendPath(dstPath, dst.getName()); service.delete(ticket, newDstPath); DeploymentEvent event = new DeploymentEvent(DeploymentEvent.Type.DELETED, - new Pair(version, srcPath + '/' + dst.getName()), + new Pair(version, extendPath(srcPath, dst.getName())), newDstPath); if (callback != null) { @@ -713,7 +713,7 @@ public class DeploymentServiceImpl implements DeploymentService if (src.isFile()) { copyFile(service, ticket, report, callback, version, src, - dstPath + '/' + dst.getName()); + extendPath(dstPath, dst.getName())); src = null; dst = null; continue; @@ -725,7 +725,7 @@ public class DeploymentServiceImpl implements DeploymentService { service.setGuid(ticket, dstPath, src.getGuid()); } - deployDirectoryPush(service, ticket, report, callback, version, src.getPath(), dstPath + '/' + dst.getName()); + deployDirectoryPush(service, ticket, report, callback, version, src.getPath(), extendPath(dstPath, dst.getName())); src = null; dst = null; continue; @@ -737,10 +737,10 @@ public class DeploymentServiceImpl implements DeploymentService } // diff > 0 // Destination is missing in source, delete it. - String newDstPath = dstPath + '/' + dst.getName(); + String newDstPath = extendPath(dstPath, dst.getName()); service.delete(ticket, newDstPath); DeploymentEvent event = new DeploymentEvent(DeploymentEvent.Type.DELETED, - new Pair(version, srcPath + '/' + dst.getName()), + new Pair(version, extendPath(srcPath, dst.getName())), newDstPath); if (callback != null) { @@ -801,7 +801,7 @@ public class DeploymentServiceImpl implements DeploymentService DeploymentReport report, DeploymentCallback callback, int version, AVMNodeDescriptor src, String parentPath) { - String dstPath = parentPath + '/' + src.getName(); + String dstPath = extendPath(parentPath, src.getName()); if (src.isFile()) { copyFile(service, ticket, report, callback, version, src, dstPath); @@ -823,4 +823,19 @@ public class DeploymentServiceImpl implements DeploymentService copy(service, ticket, report, callback, version, child, dstPath); } } + + /** + * Extend a path. + * @param path + * @param name + * @return + */ + private String extendPath(String path, String name) + { + if (path.endsWith("/")) + { + return path + name; + } + return path + '/' + name; + } }