Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30629

Fix NPE when overriding a binary metadata rule

    XMLWordPrintable

    Details

    • Release Notes Summary:
      Metadata rules with missing order value are taken into account
    • Backlog priority:
      500
    • Sprint:
      nxplatform #72
    • Story Points:
      3

      Description

      A NPE occurs when a metadata binary rule is overriden without mentioning the order attribute.

      How to reproduce:

      • start a 10.10 instance with nuxeo-dam addon installed and the following XML contribution deployed (e.g. in $NUXEO_HOME/nxserver/config/):
        <require>org.nuxeo.ecm.platform.picture.binary.metadata.contrib</require>
        
        <extension point="metadataRules" target="org.nuxeo.binary.metadata" >
            <rule id="iptc" enabled="false" />
        </extension>
        

      Expected result: the rule gets overriden and gets disabled
      Actual result: the following error occurs and compoment org.nuxeo.binary.metadata is unstarted:

      2021-09-24T17:25:29,672 ERROR [main] [org.nuxeo.runtime.model.ComponentManager] Component service:org.nuxeo.binary.metadata notification of application started failed: null
      java.lang.NullPointerException: null
      	at org.nuxeo.binary.metadata.internals.MetadataRuleRegistry$1.compare(MetadataRuleRegistry.java:38) ~[nuxeo-binary-metadata-10.10-HF49.jar:?]
      	at org.nuxeo.binary.metadata.internals.MetadataRuleRegistry$1.compare(MetadataRuleRegistry.java:34) ~[nuxeo-binary-metadata-10.10-HF49.jar:?]
      	at java.util.TreeMap.put(TreeMap.java:552) ~[?:1.8.0_302]
      	at java.util.TreeSet.add(TreeSet.java:255) ~[?:1.8.0_302]
      	at java.util.AbstractCollection.addAll(AbstractCollection.java:344) ~[?:1.8.0_302]
      	at java.util.TreeSet.addAll(TreeSet.java:312) ~[?:1.8.0_302]
      	at org.nuxeo.binary.metadata.internals.MetadataRuleRegistry.handleApplicationStarted(MetadataRuleRegistry.java:53) ~[nuxeo-binary-metadata-10.10-HF49.jar:?]
      	at org.nuxeo.binary.metadata.internals.BinaryMetadataComponent.applicationStarted(BinaryMetadataComponent.java:86) ~[nuxeo-binary-metadata-10.10-HF49.jar:?]
      	at org.nuxeo.runtime.model.DefaultComponent.start(DefaultComponent.java:110) ~[nuxeo-runtime-10.10-HF45.jar:?]
      	at org.nuxeo.runtime.model.impl.RegistrationInfoImpl.start(RegistrationInfoImpl.java:381) [nuxeo-runtime-10.10-HF45.jar:?]
      	at org.nuxeo.runtime.model.impl.ComponentManagerImpl.startComponent(ComponentManagerImpl.java:718) [nuxeo-runtime-10.10-HF45.jar:?]
      	at org.nuxeo.runtime.model.impl.ComponentManagerImpl.startComponents(ComponentManagerImpl.java:700) [nuxeo-runtime-10.10-HF45.jar:?]
      	at org.nuxeo.runtime.model.impl.ComponentManagerImpl.start(ComponentManagerImpl.java:801) [nuxeo-runtime-10.10-HF45.jar:?]
      	at org.nuxeo.runtime.osgi.OSGiRuntimeService.startComponents(OSGiRuntimeService.java:447) [nuxeo-runtime-10.10-HF45.jar:?]
      	at org.nuxeo.runtime.osgi.OSGiRuntimeService.frameworkEvent(OSGiRuntimeService.java:462) [nuxeo-runtime-10.10-HF45.jar:?]
      	at org.nuxeo.osgi.OSGiAdapter.fireFrameworkEvent(OSGiAdapter.java:223) [nuxeo-runtime-osgi-10.10-HF52.jar:?]
      	at org.nuxeo.osgi.application.loader.FrameworkLoader.doStart(FrameworkLoader.java:226) [nuxeo-runtime-osgi-10.10-HF52.jar:?]
      	at org.nuxeo.osgi.application.loader.FrameworkLoader.start(FrameworkLoader.java:125) [nuxeo-runtime-osgi-10.10-HF52.jar:?]
      	at org.nuxeo.runtime.deployment.NuxeoStarter.start(NuxeoStarter.java:124) [nuxeo-runtime-deploy-10.10.jar:?]
      	at org.nuxeo.runtime.deployment.NuxeoStarter.contextInitialized(NuxeoStarter.java:93) [nuxeo-runtime-deploy-10.10.jar:?]
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:690) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1889) [catalina-9.0.52.jar:9.0.52]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_302]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_302]
      	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util-9.0.52.jar:9.0.52]
      	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) [?:1.8.0_302]
      	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:583) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) [catalina-9.0.52.jar:9.0.52]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_302]
      	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util-9.0.52.jar:9.0.52]
      	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [?:1.8.0_302]
      	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina-9.0.52.jar:9.0.52]
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:772) [catalina-9.0.52.jar:9.0.52]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_302]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_302]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_302]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_302]
      	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345) [bootstrap-9.0.52.jar:9.0.52]
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476) [bootstrap-9.0.52.jar:9.0.52]
      
      2021-09-24T17:25:34,503 ERROR [main] [org.nuxeo.runtime.osgi.OSGiRuntimeService] Nuxeo Platform Started
      ======================================================================
      = Component Loading Status: Pending: 0 / Missing: 0 / Unstarted: 1 / Total: 931
        - service:org.nuxeo.binary.metadata
      ======================================================================
      

      Workaround:
      add the order attribute (with the same value as the original one) to the overriding rule:

      <require>org.nuxeo.ecm.platform.picture.binary.metadata.contrib</require>
      
      <extension point="metadataRules" target="org.nuxeo.binary.metadata" >
          <rule id="iptc" order="0" enabled="false" />
      </extension>
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                PagerDuty