# BUG: NPE in CookieCollector

**URL:** <https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [November 22, 2018, 12:06pm UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611 "2018-11-22T12:06:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dennis\_Vonk](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dennis_vonk/32/369_2.png) [@Dennis\_Vonk](https://community.bloomreach.com/u/Dennis_Vonk)\
**Post date:** [November 22, 2018, 12:06pm UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611/1 "2018-11-22T12:06:10Z")

</div>

Hi,

At our client we use hippo 11.2.4 and the Relevance module. On our server we get errormessages like these:

```
29.10.2018 12:59:04 ERROR http-nio-8080-exec-47 [TargetingUpdateValve.invoke:73] Error while updating targeting data
java.lang.NullPointerException
    at java.util.Arrays.stream(Arrays.java:5004)
    at java.util.stream.Stream.of(Stream.java:1000)
    at org.onehippo.forge.bundledcollectors.CookieCollector.extractTerms(CookieCollector.java:45)
    at com.onehippo.cms7.targeting.collectors.AbstractTermsCollector.getTargetingRequestData(AbstractTermsCollector.java:37)
    at com.onehippo.cms7.targeting.collectors.AbstractTermsCollector.getTargetingRequestData(AbstractTermsCollector.java:17)
    at com.onehippo.cms7.targeting.TargetingServiceImpl.updateVisitorTargetingData(TargetingServiceImpl.java:208)
    at com.onehippo.cms7.targeting.TargetingServiceImpl.obtainTargetingState(TargetingServiceImpl.java:115)
    at com.onehippo.cms7.targeting.hst.container.TargetingUpdateValve.obtainTargetingState(TargetingUpdateValve.java:122)
    at com.onehippo.cms7.targeting.hst.container.TargetingUpdateValve.invoke(TargetingUpdateValve.java:57)
    at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:288)
    at org.hippoecm.hst.core.container.LocalizationValve.invoke(LocalizationValve.java:96)
    at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:288)
    at nl.unive.customvalve.RedirectZakelijkValve.invoke(RedirectZakelijkValve.java:85)

```

After some research of the code, this is what I found.

- Arrays.java:5004 ==\> stream(array, 0, array.length) ==\> null for value ‘array’ results in NPE
- called by Stream.of(values) ==\> has a NotNull annnotation
- CookieCollector.java:45 ==\> Stream.of(request.getCookies()) ==\> request.getCookies() can be null (see [https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getCookies()](https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getCookies()))

There should be a check here for null value before feeding it to Stream.of().

I am willing to make a pullrequest in the code repository of that collector, but couldn’t find it in bloomreach git repository([https://github.com/search?p=2&q=Bloomreach&type=Repositories](https://github.com/search?p=2&q=Bloomreach&type=Repositories)).  
Am I looking in the wrong place or is this closed source?

If I can’t change the code, where can I submit a bug report?

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [November 22, 2018, 12:26pm UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611/2 "2018-11-22T12:26:46Z")

</div>

The relevance module is an enterprise module and only available to clients. You should report the issue in a client project.

In general for reporting issues see:

> **[Report an Issue - Enterprise Java Content management system - Hippo CMS](https://www.onehippo.org/about/reporting-cms-issues-in-jira.html)**
>
> Hippo Open Source Enterprise Content Management

---

<div class="post-metadata">

**Author:** ![bertleunis](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bertleunis](https://community.bloomreach.com/u/bertleunis)\
**Post date:** [November 22, 2018, 12:53pm UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611/3 "2018-11-22T12:53:47Z")

</div>

> ![](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/7f0983f4482afe3a9f968b6ef1a5ecdb88dbbb3f.png "Dennis\_Vonk")
> 
> [Dennis\_Vonk](https://community.bloomreach.com/u/dennis_vonk)
> 
> ```
> November 22
> 
> ```
> 
> Hi,

> At our client we use hippo 11.2.4 and the Relevance module. On our server we get errormessages like these:

> ```auto
> 
> 29.10.2018 12:59:04 ERROR http-nio-8080-exec-47 [TargetingUpdateValve.invoke:73] Error while updating targeting data java.lang.NullPointerException at java.util.Arrays.stream(Arrays.java:5004) at java.util.stream.Stream.of(Stream.java:1000) at org.onehippo.forge.bundledcollectors.CookieCollector.extractTerms(CookieCollector.java:45) at com.onehippo.cms7.targeting.collectors.AbstractTermsCollector.getTargetingRequestData(AbstractTermsCollector.java:37) at com.onehippo.cms7.targeting.collectors.AbstractTermsCollector.getTargetingRequestData(AbstractTermsCollector.java:17) at com.onehippo.cms7.targeting.TargetingServiceImpl.updateVisitorTargetingData(TargetingServiceImpl.java:208) at com.onehippo.cms7.targeting.TargetingServiceImpl.obtainTargetingState(TargetingServiceImpl.java:115) at com.onehippo.cms7.targeting.hst.container.TargetingUpdateValve.obtainTargetingState(TargetingUpdateValve.java:122) at com.onehippo.cms7.targeting.hst.container.TargetingUpdateValve.invoke(TargetingUpdateValve.java:57) at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:288) at org.hippoecm.hst.core.container.LocalizationValve.invoke(LocalizationValve.java:96) at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:288) at nl.unive.customvalve.RedirectZakelijkValve.invoke(RedirectZakelijkValve.java:85)
> 
> ```
> 
> After some research of the code, this is what I found.

> - Arrays.java:5004 ==\> stream(array, 0, array.length) ==\> null for value ‘array’ results in NPE
> - called by Stream.of(values) ==\> has a NotNull annnotation
> - CookieCollector.java:45 ==\> Stream.of(request.getCookies()) ==\> request.getCookies() can be null (see [https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getCookies()](https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getCookies()))  
> There should be a check here for null value before feeding it to Stream.of().

> I am willing to make a pullrequest in the code repository of that collector, but couldn’t find it in bloomreach git repository([https://github.com/search?p=2&q=Bloomreach&type=Repositories](https://github.com/search?p=2&q=Bloomreach&type=Repositories)).
> 
> Am I looking in the wrong place or is this closed source?

> If I can’t change the code, where can I submit a bug report?

Hi Dennis,

The Relevance module is part of the Enterprise edition, which is not open source indeed.

This bug was fixed already two years ago. If you upgrade your project to the latest 11.2 project your problem should be solved.

---

<div class="post-metadata">

**Author:** ![bertleunis](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bertleunis](https://community.bloomreach.com/u/bertleunis)\
**Post date:** [November 22, 2018, 1:16pm UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611/4 "2018-11-22T13:16:35Z")

</div>

> > ![](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/7f0983f4482afe3a9f968b6ef1a5ecdb88dbbb3f.png "Dennis\_Vonk")
> > 
> > [Dennis\_Vonk](https://community.bloomreach.com/u/dennis_vonk)
> > 
> > ```
> > November 22
> > 
> > ```
> > 
> > Hi,

> > At our client we use hippo 11.2.4 and the Relevance module. On our server we get errormessages like these:

> > ```auto
> > 
> > 29.10.2018 12:59:04 ERROR http-nio-8080-exec-47 [TargetingUpdateValve.invoke:73] Error while updating targeting data java.lang.NullPointerException at java.util.Arrays.stream(Arrays.java:5004) at java.util.stream.Stream.of(Stream.java:1000) at org.onehippo.forge.bundledcollectors.CookieCollector.extractTerms(CookieCollector.java:45) at com.onehippo.cms7.targeting.collectors.AbstractTermsCollector.getTargetingRequestData(AbstractTermsCollector.java:37) at com.onehippo.cms7.targeting.collectors.AbstractTermsCollector.getTargetingRequestData(AbstractTermsCollector.java:17) at com.onehippo.cms7.targeting.TargetingServiceImpl.updateVisitorTargetingData(TargetingServiceImpl.java:208) at com.onehippo.cms7.targeting.TargetingServiceImpl.obtainTargetingState(TargetingServiceImpl.java:115) at com.onehippo.cms7.targeting.hst.container.TargetingUpdateValve.obtainTargetingState(TargetingUpdateValve.java:122) at com.onehippo.cms7.targeting.hst.container.TargetingUpdateValve.invoke(TargetingUpdateValve.java:57) at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:288) at org.hippoecm.hst.core.container.LocalizationValve.invoke(LocalizationValve.java:96) at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:288) at nl.unive.customvalve.RedirectZakelijkValve.invoke(RedirectZakelijkValve.java:85)
> > 
> > ```
> > 
> > After some research of the code, this is what I found.

> > - Arrays.java:5004 ==\> stream(array, 0, array.length) ==\> null for value ‘array’ results in NPE
> > - called by Stream.of(values) ==\> has a NotNull annnotation
> > - CookieCollector.java:45 ==\> Stream.of(request.getCookies()) ==\> request.getCookies() can be null (see [https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getCookies()](https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getCookies()))  
> > There should be a check here for null value before feeding it to Stream.of().

> > I am willing to make a pullrequest in the code repository of that collector, but couldn’t find it in bloomreach git repository([https://github.com/search?p=2&q=Bloomreach&type=Repositories](https://github.com/search?p=2&q=Bloomreach&type=Repositories)).
> > 
> > Am I looking in the wrong place or is this closed source?

> > If I can’t change the code, where can I submit a bug report?

> Hi Dennis,

> 

> The Relevance module is part of the Enterprise edition, which is not open source indeed.

> This bug was fixed already two years ago. If you upgrade your project to the latest 11.2 project

- I mean: “the latest 11.2 version”

---

<div class="post-metadata">

**Author:** ![Dennis\_Vonk](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dennis_vonk/32/369_2.png) [@Dennis\_Vonk](https://community.bloomreach.com/u/Dennis_Vonk)\
**Post date:** [November 23, 2018, 8:26am UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611/5 "2018-11-23T08:26:00Z")

</div>

Thanks,

I have been away from this client for over a year. Now returning, I noticed that no minor upgrade has been done.  
It actually is one of the first things I am doing here.

---

<div class="post-metadata">

**Author:** ![jpierson](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@jpierson](https://community.bloomreach.com/u/jpierson)\
**Post date:** [September 24, 2019, 8:49pm UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611/6 "2019-09-24T20:49:09Z")

</div>

> [@bertleunis](#):
>
> I can’t change the code, where can I submit a bug report?

Any followup on this issue. We are seeing this same error and I’m curious if it’s been addressed.

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [September 25, 2019, 9:49am UTC](https://community.bloomreach.com/t/bug-npe-in-cookiecollector/611/7 "2019-09-25T09:49:39Z")

</div>

The error discussed here has been fixed, as was stated. If you are seeing the same or similar error and are on the latest version then you should enter a new bug report.
