-
Notifications
You must be signed in to change notification settings - Fork 1.3k
DATAES-274 prevent NPE in FacetedPageImpl #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if blocks are too big in my opinion. It should be moved to smaller methods.
I agree, will change it. I did it that way to be consistent with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks quite clean
I'm also facing the same issue after upgrading form 2.0.6.RELEASE to 2.1.1, will be hot fixed to 2.1.1.RELEASE sooner else may i know which will be the safest version to upgrade? |
We are having the same problem with 2.1.1.RELEASE... |
as a workaround before serialization we are doing a trick like this: private <T> Page<T> fixEmptyPage(Page<T> page) {
AggregatedPageImpl<T> aggregatedPage = (AggregatedPageImpl<T>) page;
Aggregations aggregations = aggregatedPage.getAggregations();
if (aggregations == null) {
Field field = ReflectionUtils.findField(AggregatedPageImpl.class, "aggregations");
ReflectionUtils.makeAccessible(field);
ReflectionUtils.setField(field, aggregatedPage, InternalAggregations.EMPTY);
return aggregatedPage;
}
return page;
} |
@a-poptsov thank you for the workaround, I prefer not to do your workaround (would have to add it with todo, just more technical debt..) as I am sure the PR is going to be merged soon. Right, @evelan ? |
Hi, The stack trace is as below java.lang.NullPointerException: null at org.springframework.data.elasticsearch.core.FacetedPageImpl.processAggregations(FacetedPageImpl.java:89) ~[spring-data-elasticsearch-2.1.0.RELEASE.jar:na] Can please suggest a work around on this issue. |
2.1.2 and 2.1.3 also having the same issue. may i please know, does this issue can be hotfixed to any of the 2.1.X branch ? |
I am also having the same problem. The fix above works but would be great if we didn't need it. |
+1 having similar problems. |
@olivergierke can you please tell us when this is going to be fixed and in which release, due to this issue we could not upgrade the entire spring data stack. |
Unfortunately I can't, as the project is a community project and not run by the core Spring Data team. |
@akonczak can you please tell us when this is going to be merged and in which release? Due to this issue we could not upgrade the entire spring data stack. According to https://jira.spring.io/browse/DATAES-274 you are the Assignee of the issue. |
Hello @pkraeutli Can you please add at least one test in ElasticsearchTemplateFacetTests.java to cover this bug ? Or give us request and response as json or java code when you are getting this error, so that we can add test ourself. fix is simple and easily mergeable afterwords. 👍 |
I added a test @mohsinh |
@mohsinh is the test ok like that? Can this be merged? |
merged with master. |
I am using the spring boot.The spring boot version is 1.5.6 RELEASED,the spring data elasticsearch version is 2.16, the elasticsearch version is 2.4.5 . Still have the problem: nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: org.springframework.data.elasticsearch.core.aggregation.impl.AggregatedPageImpl["facets"]) |
@liuyatao According to https://jira.spring.io/browse/DATAES-274 this has been fixed only for version 3.0 RC1 (Kay). I can approve that this is not fixed for version spring-data-elasticsearch-2.1.6 and spring-boot 1.5.6 still has the problem. @mohsinh Could this also be cherry-picked for the 2.1.x branch (preferably 2.1.7)? |
How many thumbs up are needed for a small fix to be backported? |
This is not backported to any 2.1.x releases...!, Should we have to create a new issue in spring Jira? |
I only added the
if (aggregations != null) {
in line 91. The diff looks big because of the indented block.