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/BRANCHES/DEV/5.1.N/root@122997 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2016-03-02 14:52:16 +00:00
parent 7721384025
commit 74686dc957

View File

@@ -19,8 +19,10 @@
package org.alfresco.repo.module.tool; package org.alfresco.repo.module.tool;
import de.schlichtherle.truezip.file.*; import de.schlichtherle.truezip.file.*;
import de.schlichtherle.truezip.fs.FsSyncException;
import de.schlichtherle.truezip.fs.archive.zip.JarDriver; import de.schlichtherle.truezip.fs.archive.zip.JarDriver;
import de.schlichtherle.truezip.socket.sl.IOPoolLocator; import de.schlichtherle.truezip.socket.sl.IOPoolLocator;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.module.ModuleVersionNumber; import org.alfresco.repo.module.ModuleVersionNumber;
import org.alfresco.service.cmr.module.ModuleDetails; 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. * 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 * @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. * 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) public void installModule(String ampFileLocation, String warFileLocation, boolean preview, boolean forceInstall, boolean backupWAR)
{ {
TFile warFile = new TFile(warFileLocation);
try try
{ {
outputVerboseMessage("Installing AMP '" + ampFileLocation + "' into WAR '" + warFileLocation + "'"); outputVerboseMessage("Installing AMP '" + ampFileLocation + "' into WAR '" + warFileLocation + "'");
TFile warFile = new TFile(warFileLocation);
if (!warFile.exists()) if (!warFile.exists())
{ {
throw new ModuleManagementToolException("The war file '" + warFile + "' does not exist."); throw new ModuleManagementToolException("The war file '" + warFile + "' does not exist.");
@@ -273,9 +275,6 @@ public class ModuleManagementTool implements LogOutput
{ {
warFile.setLastModified(System.currentTimeMillis()); warFile.setLastModified(System.currentTimeMillis());
} }
// Update the zip filessync
TVFS.umount();
} }
} }
catch (AlfrescoRuntimeException exception) 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); 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, private void uninstallIfNecessary(String warFileLocation, ModuleDetails installedModuleDetails, boolean preview,