Netcentric / vault-upgrade-hook

Jackrabbit FileVault Install Hook to perform additional actions during package installation
Eclipse Public License 1.0
19 stars 13 forks source link

UpgradeHandlers with missing dependencies are silently ignored #48

Closed kwin closed 4 years ago

kwin commented 4 years ago

In case a package is installed containing the hook with some groovy scripts while the Groovy Console is not installed leads to no package installation exception. Instead the log says:

Installing content
Upgrade phase [PREPARE] 
Collecting import information... 
Installing node types... 
Installing privileges... 
Importing content... 
- /var/groovyconsole/scripts/...
saving approx 0 nodes... 
Package imported. 
Upgrade phase [INSTALLED] 
Upgrade phase [END] 
Upgrade saved status /var/upgrade/....

The exception handling in https://github.com/Netcentric/vault-upgrade-hook/blob/a93ad996151ed13e066d83992e9af0c0b8ae2058/vault-upgrade-hook/src/main/java/biz/netcentric/vlt/upgrade/UpgradeProcessor.java#L81 needs to be improved as the underlying exception from https://github.com/Netcentric/vault-upgrade-hook/blob/a93ad996151ed13e066d83992e9af0c0b8ae2058/vault-upgrade-hook/src/main/java/biz/netcentric/vlt/upgrade/handler/UpgradeType.java#L46 is somehow not ending up as package exception.

kwin commented 4 years ago

In the error.log you can see

27.05.2020 13:19:45.254 *WARN* [qtp1048661890-2132] org.apache.jackrabbit.vault.packaging.impl.InstallHookProcessorImpl Hook /META-INF/vault/hooks/vault-upgrade-hook-1.0.4.jar threw runtime exception.
java.lang.NoClassDefFoundError: com/icfolson/aem/groovy/console/GroovyConsoleService
    at biz.netcentric.vlt.upgrade.handler.groovy.GroovyConsoleHandler.isAvailable(GroovyConsoleHandler.java:42)
    at biz.netcentric.vlt.upgrade.handler.UpgradeType.create(UpgradeType.java:49)
    at biz.netcentric.vlt.upgrade.UpgradeInfo.<init>(UpgradeInfo.java:92)
    at biz.netcentric.vlt.upgrade.UpgradeProcessor.loadInfos(UpgradeProcessor.java:163)
    at biz.netcentric.vlt.upgrade.UpgradeProcessor.execute(UpgradeProcessor.java:69)
    at org.apache.jackrabbit.vault.packaging.impl.InstallHookProcessorImpl.execute(InstallHookProcessorImpl.java:143) [org.apache.jackrabbit.vault:3.4.5.SNAPSHOT]

The underlying NoClassDefFoundError is no Exception but just a Throwable and as such does no lead to package installation failure in Jackrabbit FileVault (https://issues.apache.org/jira/browse/JCRVLT-289)