Search and Promote OOTB component NullPointerException | Adobe Higher Education
Skip to main content
Level 2
February 24, 2017
Beantwoord

Search and Promote OOTB component NullPointerException

  • February 24, 2017
  • 3 reacties
  • 1029 Bekeken

[http://stackoverflow.com/questions/42446673/search-and-promote-null-pointer]

 

Using the provided OOTB Search & Promote components with an S&P service the following error is thrown when I try and search:

GET /content/Search/Results.html HTTP/1.1] org.apache.commons.httpclient.HttpMethodBaseGoing to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.GET /content/Search/Results.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service:Uncaught SlingExceptionjava.lang.NullPointerException: null at com.day.cq.searchpromote.xml.result.Pagination.getResultPages(Pagination.java:69)

So there's a null in the following code on the getResultPages call, in the results component.

 Pagination pagination = search.getPagination();if(pagination != null) {totalPages = pagination.getTotalPages();for (ResultPage resultPage : pagination.getResultPages()) {if (resultPage.isSelected()) {currentPageNumber = resultPage.getPosition();}}}

Does anyone know why this might be null? Even if I have no valid search results I'm assuming this should still provide me with a valid view of zero results.

 
Er kunnen geen reacties meer worden geplaatst op dit onderwerp.
Beste antwoord door edubey

I worked with S&P where it used to return JSON and it was client side driven project.

But I would say, if you add null checks where you are getting this error. It should solve the issue.

3 reacties

edubey
Level 10
February 27, 2017

S&P might remove inner array when there are no results.

I have worked with S&P for AEM projects, Can you share the response you get when there are no result?

Thanks

Level 2
February 28, 2017

Hi edubey, 

Thanks for getting back to me.

There is no response because it breaks on an internal server error.

edubey
edubeyAntwoord
Level 10
February 28, 2017

I worked with S&P where it used to return JSON and it was client side driven project.

But I would say, if you add null checks where you are getting this error. It should solve the issue.