You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Hans-Peter Stoerr (Jira)" <ji...@apache.org> on 2021/04/27 16:02:00 UTC

[jira] [Created] (JCRVLT-517) FSPackageRegistry.contains does not initialize packages

Hans-Peter Stoerr created JCRVLT-517:
----------------------------------------

             Summary: FSPackageRegistry.contains does not initialize packages
                 Key: JCRVLT-517
                 URL: https://issues.apache.org/jira/browse/JCRVLT-517
             Project: Jackrabbit FileVault
          Issue Type: Bug
    Affects Versions: 3.4.10
            Reporter: Hans-Peter Stoerr


The implementation of FSPackageRegistry.contains in the [current implementation line 249|https://github.com/apache/jackrabbit-filevault/blob/39b4463904719a423a3ebe000b049b0653557591/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSPackageRegistry.java]  does just `return stateCache.containsKey(id);` without initializing the stateCache, as e.g. the method packages() (line 640) does. I strongly suggest that it should initialize the stateCache (that is, call loadPackageCache() ) if it wasn't initialized before returning.

I stumbled over this because I'm using the Sling Feature Launcher and apply to [org.apache.sling.jcr.packageinit|https://github.com/apache/sling-org-apache-sling-jcr-packageinit] triggered by [org.apache.sling.extension.content|https://github.com/apache/sling-org-apache-sling-feature-extension-content] to deploy content packages from the feature launcher, and this always fails since it says the packages aren't found. The reason for this is that org.apache.jackrabbit.vault.packaging.registry.impl.ExecutionPlanBuilderImpl.validate gets called, which uses FSPackageRegistry.contains, and this fails since the FSPackageRegistry isn't initialized yet.

There is a workaround for this FSPackageRegistry problem by inserting a FSPackageRegistry.packages() call into [ExecutionPlanRepoinitializer|https://github.com/apache/sling-org-apache-sling-jcr-packageinit/blob/master/src/main/java/org/apache/sling/jcr/packageinit/impl/ExecutionPlanRepoInitializer.java] to initialize the FSPackageRegistry and throwing away the result, but I don't think this is the right way to solve this problem. :) So I'm reporting this as a bug in org.apache.jackrabbit.vault .
 Thank you!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)