You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "romain.gauthier (Jira)" <ji...@apache.org> on 2021/01/08 02:07:00 UTC
[jira] [Created] (UNOMI-414) in ScorePersonalizationStrategy,
nullpointer if visitor has no interest
romain.gauthier created UNOMI-414:
-------------------------------------
Summary: in ScorePersonalizationStrategy, nullpointer if visitor has no interest
Key: UNOMI-414
URL: https://issues.apache.org/jira/browse/UNOMI-414
Project: Apache Unomi
Issue Type: Bug
Affects Versions: 1.5.4
Reporter: romain.gauthier
When executing a personalization with sorted by score strategy, I get a nullpointer if the current visitor doesnt have any interest set on his profile.
I tested only with 1.5.4 but it can easily be reproduced.
Nullpointer is Ligne 54 in the file [https://github.com/apache/unomi/blob/unomi-root-1.5.4/services/src/main/java/org/apache/unomi/services/sorts/ScorePersonalizationStrategy.java]
A null check on interestValues (the interests frome the profile) should be added.
{code:java}
if (interestList != null) {
Map<String,Integer> interestValues = (Map<String, Integer>) profile.getProperties().get("interests");
for (String interest : interestList.split(" ")) {
if (interestValues.get(interest) != null) {
score += interestValues.get(interest);
}
}
}
{code}
java.lang.NullPointerException: nulljava.lang.NullPointerException: null at org.apache.unomi.services.sorts.ScorePersonalizationStrategy.personalizeList(ScorePersonalizationStrategy.java:54) ~[?:?]
Request to test with (using context.json):
{code:java}
{
"source": {
"itemId": "JahiaDXServer",
"itemType": "custom",
"scope": "digit",
"version": null,
"properties": {}
},
"requireSegments": true,
"requiredProfileProperties": [
"interests"
],
"requiredSessionProperties": [
"*"
],
"events": null,
"filters": null,
"personalizations": [
{
"id": "jexperience-recommendations-by-interest",
"strategy": "score-sorted",
"strategyOptions": {
"threshold": -1
},
"contents": [
{
"id": "ac02dbe3-2445-4727-acea-50cfed001996",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "ac02dbe3-2445-4727-acea-50cfed001996"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": {
"interests": "health food"
}
},
{
"id": "62194fdd-2a1c-46ce-8f9b-19dc168f3454",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "62194fdd-2a1c-46ce-8f9b-19dc168f3454"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "dbb3a797-d24e-4701-97ad-dc0a708fa06f",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "dbb3a797-d24e-4701-97ad-dc0a708fa06f"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "90664d1d-6558-4239-a024-8212f2652673",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "90664d1d-6558-4239-a024-8212f2652673"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "f13af275-2002-4200-bd58-96847c74dafb",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "f13af275-2002-4200-bd58-96847c74dafb"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "2305ab1a-f6b1-47c1-bc46-a8c69c553d87",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "2305ab1a-f6b1-47c1-bc46-a8c69c553d87"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "50c4064c-ef6e-4afe-adcf-f876111f50bc",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "50c4064c-ef6e-4afe-adcf-f876111f50bc"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "55371bb0-c516-4038-ab6d-0acab57b4790",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "55371bb0-c516-4038-ab6d-0acab57b4790"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "eaaa15eb-e2c2-49cf-bb99-20ea90bd3fdb",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "eaaa15eb-e2c2-49cf-bb99-20ea90bd3fdb"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
},
{
"id": "15cdd5dd-909d-4d91-8f79-62226b96843a",
"filters": [
{
"appliesOn": null,
"condition": {
"parameterValues": {
"minimumEventCount": 1,
"eventCondition": {
"type": "pageViewEventCondition",
"parameterValues": {
"pageID": "15cdd5dd-909d-4d91-8f79-62226b96843a"
}
},
"numberOfDays": 30
},
"type": "pastEventCondition"
},
"properties": {
"score": -1000
}
}
],
"properties": null
}
]
}
],
"profileOverrides": null,
"sessionPropertiesOverrides": null,
"sessionId": "21bf6d3d-ba5d-4b8c-98bb-af4dcf506c03"
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)