From the DEV mailing list:
Hafner Ullrich wrote:
> Hi,
>
> In the findbugs and tasks plugins I currently update the trend images only for
new successful builds.
> There have been some request to change this behavior and always update the graph
> (see issue https://hudson.dev.java.net/issues/show_bug.cgi?id=795). What is
the desired
> way to update these images in Hudson? I copied the code from the Test Report
plugin, but
> I'm not sure whether this is the right way? The guard I use is
>
> if (request.checkIfModified(owner.getTimestamp(), response) ||
healthReportBuilder == null)
{
> return; // don't re-create image
> }
The code above is incorrect. The checkIfModified() method has a side
effect. Namely, when it returns true, it also sets the HTTP Status code
telling the browser that the browser can keep using its own cache.
When the method evaluates to false but healtHReportBuilder==null, then
you end up returning an empty response. You'd have to check this
separately, and if helthReportBuilder is null you'd have to return 404
or something.
From the DEV mailing list:
Hafner Ullrich wrote:
{ > return; // don't re-create image > }> Hi,
>
> In the findbugs and tasks plugins I currently update the trend images only for
new successful builds.
> There have been some request to change this behavior and always update the graph
> (see issue https://hudson.dev.java.net/issues/show_bug.cgi?id=795). What is
the desired
> way to update these images in Hudson? I copied the code from the Test Report
plugin, but
> I'm not sure whether this is the right way? The guard I use is
>
> if (request.checkIfModified(owner.getTimestamp(), response) ||
healthReportBuilder == null)
The code above is incorrect. The checkIfModified() method has a side
effect. Namely, when it returns true, it also sets the HTTP Status code
telling the browser that the browser can keep using its own cache.
When the method evaluates to false but healtHReportBuilder==null, then
you end up returning an empty response. You'd have to check this
separately, and if helthReportBuilder is null you'd have to return 404
or something.