-
Notifications
You must be signed in to change notification settings - Fork 30
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
NPE when invoking generate #12
Comments
Hi @chrisime This exception is thrown when url is null on one of your pages. I think it's set to null by ResourceMapper of your theme. Grain is not very helpful with identifying the resource on which url is null, hence I've added resource location printing when this type of error happens to 0.7.0-SNAPSHOT. Please update your application.properties to have the line: Note, that \n (end of line character) is important at the end of application.properties. This will help you understand what is the location of resource that has url = null. If everything will be fine I will backport this extended diagnostics into stable Grain version. Victor |
Hi @Vlasenko Thanks for your reply. Unfortunately, the error still happens in your snapshot version. The url where the NPE is thrown isn't shown. Any ideas? Cheers, |
Hi. The snapshot version was not meant to "fix this error", it will dump extended diagnostic info instead. The error is not in the Grain at all, it's in the theme code. In the stack trace from snapshot version there should be location of the resource with null URL. Please post dumped stack trace here and source code of your ResourceMapper |
Closing due to not a Grain issue and inactivity |
Gonna post the problem on the weekend, didn't have time. Please reopen. Thanks! |
Okay, thanks for update. Looking forward to hear from you soon |
Hi, I got the following stacktrace now:
The relevant parts of
|
Hi @chrisime def map = { resources ->
println 'Input pages with null location: ' + resources.findAll { !it.location }
...
def refinedResources = resources.findResults(filterPublished).collect {
customizeUrls <<
fillDates <<
resource
}.sort { -it.date.time }
def result = customizeModels << refinedResources
println 'Output pages with null location: ' + result.findAll { !it.location }
result
} |
Please note, that the problem in your code is here: updatedResources << [pageable: isPageable] You are adding malformed resource with only one property here: [pageable: true/false] and it's location = null of course, because it's not set. You should add pageable property to existing pages instead |
Hi @Vlasenko, so far 'input pages' doesn't give me any null locations. So it seems to be the output. How can I get around adding malformed resources. I don't see what's wrong since in each case Thanks! |
Hi @chrisime, I've pointed out what's wrong in your code already: You are adding malformed resources in the line of your code pointed out in the comment above. Please see Resource representation of Grain documentation: The Groovy map of invalid resource in your case is: |
Hello @Vlasenko, thanks for the link, gonna try this. You can close the issue for now. Cheers, |
With my current setup I get an NPE when I'm trying to generate html pages. grain doesn't tell me what's wrong about my configuration and/or urls.
The text was updated successfully, but these errors were encountered: