Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Fix NPE and eager evaluation in traceEntry (Fixes #101)#102

Open
SpaceLeam wants to merge 1 commit into
apache:mainfrom
SpaceLeam:fix/trace-entry-npe-eager-eval
Open

Fix NPE and eager evaluation in traceEntry (Fixes #101)#102
SpaceLeam wants to merge 1 commit into
apache:mainfrom
SpaceLeam:fix/trace-entry-npe-eager-eval

Conversation

@SpaceLeam

Copy link
Copy Markdown

Fixes #101

Description

noticed that Logger.traceEntry was eagerly evaluating .toString on arguments and didn't check for nulls, which caused NPEs even when tracing was disabled.

In this PR, I've updated Logger.scala (for both Scala 2 and 3) to:

  • Check delegate.isTraceEnabled first (lazy evaluation).
  • Add a null check for params.head.

I also added unit tests in LoggerTest.scala to verify that passing null or an object with a throwing toString no longer crashes the application.

Verification

Ran ./mvnw clean test on both modules and everything passed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logger.traceEntry throws NPE on null arguments and eagerly evaluates toString

1 participant