diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 078d3e2f1..db70affe9 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -3441,15 +3441,13 @@ EOF } else { //we can directly apply the stimuli $sExceptionMessage = null; + $bApplyStimulus = false; try { - $bApplyStimulus = $this->ApplyStimulus($sStimulus); // will write the object in the DB - } - catch (Exception $oException) { + $bApplyStimulus = $this->ApplyStimulus($sStimulus); // will write the object in the DB + } catch (Exception $oException) { // Catch any exception happening during the stimulus - $bApplyStimulus = false; $sExceptionMessage = ($oException instanceof CoreCannotSaveObjectException) ? $oException->getHtmlMessage() : $oException->getMessage(); - } - finally { + } finally { if ($sOwnershipToken !== null) { // Release the concurrent lock, if any iTopOwnershipLock::ReleaseLock($sClass, $iKey, $sOwnershipToken); @@ -3457,9 +3455,8 @@ EOF if (!$bApplyStimulus) { // Throw an application oriented exception if necessary throw new ApplicationException($sExceptionMessage ?? Dict::S('UI:FailedToApplyStimuli')); - } else { - return true; } + return true; } }