Uploaded image for project: 'E-commerce'
  1. E-commerce
  2. ECOMMERCE-421

NPE throws when create new password in Password app

XMLWordPrintable

      Steps to reproduce

      1. Running addon wepp app
      2. Provide commerce tools yaml as below:
      3. class: info.magnolia.ecommerce.common.EcommerceDefinition
        type: commercetools
        enabled: true
        implementation:
          products:
            all: info.magnolia.ecommerce.commercetools.products.All
            byId: info.magnolia.ecommerce.commercetools.products.ById
            byCategoryId: info.magnolia.ecommerce.commercetools.products.ByCategoryId
            searchByText: info.magnolia.ecommerce.commercetools.products.SearchByText
          categories:
            all: info.magnolia.ecommerce.commercetools.categories.All
            byId: info.magnolia.ecommerce.commercetools.categories.ById
            byParentCategoryId: info.magnolia.ecommerce.commercetools.categories.ByParentCategoryId
            byProductId: info.magnolia.ecommerce.commercetools.categories.ByProductId
          connectionValidator: info.magnolia.ecommerce.commercetools.common.CommercetoolsConnectionValidator
        connections:
          connection:
            authUrl: https://auth.sphere.io
            parameters:
        
      1.  Open Password app
      2. Add 1 folder and 1 password
      3. See NPE throws in log

      .. Logs, screenshots, gifs...

      Expected results

      No log error

      Actual results

      Exception in thread "Thread-24" java.lang.NullPointerExceptionException in thread "Thread-24" java.lang.NullPointerException at info.magnolia.ecommerce.EcommerceConnectionProvider.lambda$reinitializeAffectedConnections$8(EcommerceConnectionProvider.java:237) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at info.magnolia.ecommerce.EcommerceConnectionProvider.reinitializeAffectedConnections(EcommerceConnectionProvider.java:239) at java.util.ArrayList.forEach(ArrayList.java:1257) at info.magnolia.ecommerce.EcommerceConnectionProvider.lambda$startListenerOnKeyStoreWorkspace$7(EcommerceConnectionProvider.java:218) at info.magnolia.observation.DeferringEventListener$ObservationBasedDelayedExecutor$1.run(DeferringEventListener.java:102) at info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExecutor.java:103) at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown Source) at java.lang.Thread.run(Thread.java:748)Exception in thread "Thread-26" java.lang.NullPointerException at info.magnolia.ecommerce.EcommerceConnectionProvider.lambda$reinitializeAffectedConnections$8(EcommerceConnectionProvider.java:237) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at info.magnolia.ecommerce.EcommerceConnectionProvider.reinitializeAffectedConnections(EcommerceConnectionProvider.java:239) at java.util.ArrayList.forEach(ArrayList.java:1257) at info.magnolia.ecommerce.EcommerceConnectionProvider.lambda$startListenerOnKeyStoreWorkspace$7(EcommerceConnectionProvider.java:218) at info.magnolia.observation.DeferringEventListener$ObservationBasedDelayedExecutor$1.run(DeferringEventListener.java:102) at info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExecutor.java:103) at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown Source) at java.lang.Thread.run(Thread.java:748) 

      Workaround

      Development notes :

      Must check null before access connection.getParameters() in EcommerceConnectionProvider below*:*

      List<Connection> affectedConnections = connections.stream()
              .filter(connection -> connection.getParameters().containsKey("passwordPath"))
              .filter(connection -> StringUtils.equalsIgnoreCase(connection.getParameters().get("passwordPath"), alteredPasswordPath))
              .collect(Collectors.toList()); 

        Acceptance criteria

              yen.lactue Yen Lac Tue
              oanh.thai Oanh Thai Hoang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Time Spent - 1d 1.25h Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - 1d 1.25h Remaining Estimate - 1h
                  1d 1.25h