this.extensionHandlerManager.upgrade(previousExtension, localExtension, namespace);
try {
this.localExtensionRepository.uninstallExtension(previousExtension, namespace);
} catch (UninstallException e) {
this.logger.error("Failed to uninstall extension [" + previousExtension + "]", e);
<BUG>}
this.observationManager.notify(new ExtensionUpgradedEvent(localExtension.getId()), localExtension,</BUG>
previousExtension);
} else {
<BUG>this.extensionHandlerManager.install(localExtension, namespace);
this.observationManager.notify(new ExtensionInstalledEvent(localExtension.getId()), localExtension,</BUG>
previousExtension);

this.extensionHandlerManager.upgrade(previousExtension, localExtension, namespace);
try {
this.localExtensionRepository.uninstallExtension(previousExtension, namespace);
} catch (UninstallException e) {
this.logger.error("Failed to uninstall extension [" + previousExtension + "]", e);
}
this.localExtensionRepository.installExtension(localExtension, namespace);
this.observationManager.notify(new ExtensionUpgradedEvent(localExtension.getId()), localExtension,
previousExtension);
} else {
this.extensionHandlerManager.install(localExtension, namespace);
this.localExtensionRepository.installExtension(localExtension, namespace);
this.observationManager.notify(new ExtensionInstalledEvent(localExtension.getId()), localExtension,
previousExtension);
