From c4b6a1e7a79c402e50e61942bbf32ffe7450c774 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Fri, 11 Mar 2016 22:32:52 +0000 Subject: [PATCH] Merged 5.1.N (5.1.1) to HEAD (5.2) 122997 mrogers: Merged WOLF-8 (5.1.0) to 5.1.N (5.1.1) 114287 mward: UTF-170: Move TrueZip unmount call to a final block. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123690 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../module/tool/ModuleManagementTool.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/source/java/org/alfresco/repo/module/tool/ModuleManagementTool.java b/source/java/org/alfresco/repo/module/tool/ModuleManagementTool.java index 266d054733..9804276c9d 100644 --- a/source/java/org/alfresco/repo/module/tool/ModuleManagementTool.java +++ b/source/java/org/alfresco/repo/module/tool/ModuleManagementTool.java @@ -19,8 +19,10 @@ package org.alfresco.repo.module.tool; import de.schlichtherle.truezip.file.*; +import de.schlichtherle.truezip.fs.FsSyncException; import de.schlichtherle.truezip.fs.archive.zip.JarDriver; import de.schlichtherle.truezip.socket.sl.IOPoolLocator; + import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.module.ModuleVersionNumber; import org.alfresco.service.cmr.module.ModuleDetails; @@ -192,14 +194,14 @@ public class ModuleManagementTool implements LogOutput * installation will be followed and reported, but the WAR file will not be modified. * @param forceInstall indicates whether the installed files will be replaced regardless of the currently installed * version of the AMP. Generally used during development of the AMP. - * @param backupWAR indicates whether we should backup the war we are modifying or not + * @param backupWAR indicates whether we should backup the war we are modifying or not */ public void installModule(String ampFileLocation, String warFileLocation, boolean preview, boolean forceInstall, boolean backupWAR) { + TFile warFile = new TFile(warFileLocation); try { outputVerboseMessage("Installing AMP '" + ampFileLocation + "' into WAR '" + warFileLocation + "'"); - TFile warFile = new TFile(warFileLocation); if (!warFile.exists()) { throw new ModuleManagementToolException("The war file '" + warFile + "' does not exist."); @@ -273,9 +275,6 @@ public class ModuleManagementTool implements LogOutput { warFile.setLastModified(System.currentTimeMillis()); } - - // Update the zip filessync - TVFS.umount(); } } catch (AlfrescoRuntimeException exception) @@ -286,6 +285,19 @@ public class ModuleManagementTool implements LogOutput { throw new ModuleManagementToolException("An IO error was encountered during deployment of the AMP into the WAR", exception); } + finally + { + try + { + TVFS.umount(warFile); + } + catch (FsSyncException e) + { + throw new ModuleManagementToolException( + "Error when attempting to unmount WAR file: "+warFile.getPath(), + e); + } + } } private void uninstallIfNecessary(String warFileLocation, ModuleDetails installedModuleDetails, boolean preview,