Skip to content

Benchmark tests consistently fail due to NullPointerException in TjDefault during timings.csv writing #1114

Description

@volodya-lombrozo

mvn clean test -Pbenchmark currently fails on every run, so there's no way to get lint timing numbers right now - this breaks both the benchmark.yml push-to-master workflow and the new PR-comment-triggered pr-benchmark.yml workflow (#1109).

Steps to Reproduce

  1. Run mvn clean test -Pbenchmark (JDK 21, -P!hone locally to skip Docker)
  2. Both SourceTest.lintsBenchmarkSourcesFromJava and SourceTest.checksLintTimeFormattingInBenchmarkResults fail

Expected Behavior

Both benchmark tests pass and target/timings.csv gets populated with lint timings for every SourceSize.

Actual Behavior

java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "java.util.Map.get(Object)" is null
	at com.yegor256.tojos.TjDefault.lambda$add$0(TjDefault.java:54)
	at org.eolang.lints.SourceTest$TimedLint.defects(SourceTest.java:573)
	at org.eolang.lints.SourceTest$BcSource.timed(SourceTest.java:517)
	at org.eolang.lints.SourceTest$BcSource.defects(SourceTest.java:499)
	at org.eolang.lints.SourceTest.benchmarkResults(SourceTest.java:400)

Both benchmark test methods independently call the shared benchmarkResults() helper (SourceTest.java:392), and each BcSource constructs its own TjCached(new TjDefault(new MnCsv(target/timings.csv))) writing to the same file. Something about a second set of Tojos instances re-opening a file a prior instance already wrote to in the same run trips this NPE in the com.yegor256:tojos library.

This is pre-existing, not caused by any recent change - confirmed on master's own benchmark.yml runs on 2026-07-24 (x3 failures) and 2026-07-27, with only one success on 2026-07-23:

Full stack trace
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "java.util.Map.get(Object)" is null
	at com.yegor256.tojos.TjDefault.lambda$add$0(TjDefault.java:54)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.LinkedList$LLSpliterator.tryAdvance(LinkedList.java:1263)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
	at com.yegor256.tojos.TjDefault.add(TjDefault.java:55)
	at com.yegor256.tojos.TjCached.add(TjCached.java:58)
	at org.eolang.lints.SourceTest$TimedLint.defects(SourceTest.java:573)
	at org.eolang.lints.SourceTest$BcSource.timed(SourceTest.java:517)
	at org.eolang.lints.SourceTest$BcSource.defects(SourceTest.java:499)
	at org.eolang.lints.SourceTest.benchmarkResults(SourceTest.java:400)
	at org.eolang.lints.SourceTest.lintsBenchmarkSourcesFromJava(SourceTest.java:330)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood-titleThe title was checked and improved by ChatGPT

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions