From 003533324695d43e920cfa0068e408fd955b6435 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Fri, 11 Mar 2016 22:26:23 +0000 Subject: [PATCH] Merged 5.1.N (5.1.1) to HEAD (5.2) 122470 dhulley: Request failure details from SQL execution in method 'PropertyValueDAOImpl.cleanupUnusedValues()' (ACE-5143) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123664 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../propval/ibatis/PropertyValueDAOImpl.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/source/java/org/alfresco/repo/domain/propval/ibatis/PropertyValueDAOImpl.java b/source/java/org/alfresco/repo/domain/propval/ibatis/PropertyValueDAOImpl.java index 305559a4bb..091e5039b7 100644 --- a/source/java/org/alfresco/repo/domain/propval/ibatis/PropertyValueDAOImpl.java +++ b/source/java/org/alfresco/repo/domain/propval/ibatis/PropertyValueDAOImpl.java @@ -699,24 +699,35 @@ public class PropertyValueDAOImpl extends AbstractPropertyValueDAOImpl public void cleanupUnusedValues() { // execute clean up in case of previous failures - scriptExecutor.exec("alfresco/dbscripts/utility/${db.script.dialect}", "CleanAlfPropTablesPostExec.sql"); try { - scriptExecutor.exec("alfresco/dbscripts/utility/${db.script.dialect}", "CleanAlfPropTables.sql"); + scriptExecutor.exec("alfresco/dbscripts/utility/${db.script.dialect}", "CleanAlfPropTablesPostExec.sql"); + } + catch (RuntimeException e) + { + logger.error("The pre-exec cleanup script failed: ", e); + } + // Run the main script + try + { + scriptExecutor.exec(false, "alfresco/dbscripts/utility/${db.script.dialect}", "CleanAlfPropTables.sql"); + } + catch (RuntimeException e) + { + logger.error("The cleanup script failed: ", e); + throw e; } finally { try { // execute clean up - scriptExecutor.exec("alfresco/dbscripts/utility/${db.script.dialect}", "CleanAlfPropTablesPostExec.sql"); + scriptExecutor.exec(false, "alfresco/dbscripts/utility/${db.script.dialect}", "CleanAlfPropTablesPostExec.sql"); } - catch (Exception e) + catch (RuntimeException e) { - if (logger.isErrorEnabled()) - { - logger.error("The cleanup failed with an error: ", e); - } + logger.error("The post-exec cleanup script failed: ", e); + // We do not rethrow this as we want to preserve the original failure } clearCaches(); }