bertramdev / grails-asset-pipeline

Grails Asset Pipeline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nullpointer Exception in AssetPipelineFilter.doFilter line 66 when lastModified is NULL

bmsteinke opened this issue · comments

We use grails 2.5.2 with the asset pipeline plugin 2.5.7. The application is deployed an a WebSphere server Version 8.5.5 and our log is full of Nullpointer exceptions.

at asset.pipeline.grails.AssetPipelineFilter.doFilter(AssetPipelineFilter.groovy:66)

The reason is that the attribute cache lastModified date shall be formatted but obviously the date is null.

I would like to undestand why this can happen.

In the meantime I patched the code so that the request header will not be set if the last modified date is null. Naturally I don't know if patch has any side effects.

Thanks for your help.
Boris

fixed in 3.2.0 / 2.8.0

whoops this is a different issue, ill take a look

certain resource loaders don't allow you to find out last modified date of a file

Ok, and what shall I do? Version 2.8.0 is not compatible with Java 1.6 (have to stick 1.6 because of other appliacations that are running on that server). So what I did as an intermediate solution is the following:

if (null != attributeCache?.getLastModified()) { // BMS: 25/4/2016
response.setHeader('Last-Modified',
attributeCache.getLastModified().format(HTTP_DATE_FORMAT))
}
Is that OK or has my change any other impacts?
Boris

that is an A-ok change you'll still get a proper E-Tag header too so your good to go

what version are you using then if not 2.8.0?

the last version that I can use is 2.5.7. All newer versions produce a ClassNotFoundException for java.util.Objects

FYI I have this fixed for next release monay