Details

      Description

      Use case

      Define only a single dispatcher for a filter.

      1. Start portal
      2. Deploy com.liferay.support.filter-1.0.0.jar

       Expected behaviour: Filter deploys correctly
       Actual behaviour: ClassCastException as the single dispatcher as String object but a String array is expected 

      Background

      LPS-88047 changed how the dispatchers are retrieved from the components. Prior to LPS-88047 StringPlus.asList() method call was made on the retrieved data before setting "dispatchers" on the FilterMapping, and it converted the single String objects to a one element Array.
      https://github.com/brianchandotcom/liferay-portal/pull/66080/files#diff-ffc4c52c819af6823153be5f7c2524f0L513

      After LPS-88047, we expect Array of Strings without any casting which can lead to ClassCastException when only one "dispatcher" type is defined.
      https://github.com/brianchandotcom/liferay-portal/pull/66080/files#diff-ffc4c52c819af6823153be5f7c2524f0R512

      2019-03-12 15:56:58.289 ERROR [Framework Event Dispatcher: Equinox Container: 476fafed-7105-42cb-a7ae-10108d2d4936][org_eclipse_osgi:97] FrameworkEvent ERROR 
      java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;
       at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterHelper$FilterServiceTrackerCustomizer.addingService(InvokerFilterHelper.java:514)
       at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterHelper$FilterServiceTrackerCustomizer.addingService(InvokerFilterHelper.java:449)
       at com.liferay.registry.internal.ServiceTrackerCustomizerAdapter.addingService(ServiceTrackerCustomizerAdapter.java:35)
       at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
       at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
       at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
       at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
       at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
       at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
       at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:891)
       at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
       at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
       at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
       at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:906)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:892)
       at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:128)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:959)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:732)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666)
       at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432)
       at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665)
       at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339)
       at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:381)
       at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49)
       at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:263)
       at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196)
       at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169)
       at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49)
       at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488)
       at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
       at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
       at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
       at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
       at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
       at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
       at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
       at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
       at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
       at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
       at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
       at org.eclipse.osgi.container.Module.start(Module.java:467)
       at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
       at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:777)
       at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:768)
       at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:538)
       at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:484)
       at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:1028)
       at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1409)
       at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
       at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
       at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
      2019-03-12 15:56:58.379 INFO  [Refresh Thread: Equinox Container: 476fafed-7105-42cb-a7ae-10108d2d4936][BundleStartStopLogger:39] STARTED com.liferay.support.filter_1.0.0 [959]

      I've also attached my PoC sample, the behaviour can be verified with it, if we modify the component annotation and add/remove a dispatcher like:
      "dispatcher=FORWARD",

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                summer.zhang Summer Zhang
                Reporter:
                csaba.botos Csaba Botos (Inactive)
                Participants of an Issue:
                Recent user:
                Clarissa Velazquez
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  14 weeks, 2 days ago

                  Packages

                  Version Package
                  7.1.10 DXP FP10
                  7.1.10.2 SP2
                  7.1.3 CE GA4
                  7.1.X
                  Master