Skip to content

The RenderFileAction throws NullPointerException #304

Description

@marek-parfianowicz

originally reported in #122

2. The RenderFileAction NPE

java.lang.NullPointerException
    at ...reporters.html.RenderFileAction.call(RenderFileAction.java:111)
    at ...util.CloverExecutors$LoggingCallable.call(CloverExecutors.java:91)

This is still reproducible on 5.0.0. @JasonWThompson's diagnosis was correct. The details:

RenderFileAction holds its column/context state in two static fields:

protected static ThreadLocal<List<Column>> columnsTL;
protected static ThreadLocal<ContextSet> contextSetTL;

but their lifecycle is owned by HtmlReporter, which calls initThreadLocals() before submitting render tasks and resetThreadLocals() in a finally block — and that reset assigns the statics back to null.

I've reproduced this with a unit test on the 5.0.x branch.

Fix direction: make this state per-report rather than static, so each HtmlReporter owns its own lifecycle and one report's cleanup can't affect another's in-flight tasks. Additionally, the finally reset shouldn't run while tasks may still be executing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions