Skip to content

Preserve JPA throwable messages with no-arg constructors - #4401

Merged
ramanathan1504 merged 4 commits into
apache:2.xfrom
curforever:fix/jpa-no-arg-message
Oct 30, 2026
Merged

ramanathan1504 merged 4 commits into
apache:2.xfrom
curforever:fix/jpa-no-arg-message

Conversation

@curforever

Copy link
Copy Markdown
Contributor

ThrowableAttributeConverter loses a non-null message when restoring a throwable that has a public no-arg constructor but no String constructor and no cause. The fallback assigns cause (null in that branch) to detailMessage.

Assign the parsed message instead. Add round-trip coverage for no-arg-only exceptions with a message, with a cause, and without a message; verify type, message, cause and stack trace. No database-format or public API changes.

Validation on Windows / JDK 17.0.5 / the Maven 3.9.16 wrapper:

  • The identical 8-test converter suite has 1 failure on the original source (expected message, actual null); all 8 pass with the fix.
  • ./mvnw verify site -pl :log4j-jpa: 60 passed, 0 default skips, no failures/errors, including the 8 converter tests. No test selector, additional skip flags or build-file changes in this verification. Local reactor dependencies were installed separately using the converter test selector.
  • Full ./mvnw verify site was attempted but stops in log4j-core-test: 1 UTF-8 decoding error in RollingAppenderCronOnStartupTest and 8 timeouts in TlsSocketAppenderTest. Restoring the original production source reproduces the same 9 failing cases. Process-level UTF-8 configuration resolves the decoding error; 8 TLS timeouts remain. Later reactor modules were not reported as passing. Docker/Java 8 and the wider CI matrix were not run locally.

AI-generated with OpenAI Codex; the reported tests and checks were executed locally.

@ramanathan1504

Copy link
Copy Markdown
Contributor

@curforever thanks, the fix in ThrowableAttributeConverter is right, and testConvertDefaultConstructor covers it.
Could you add a changelog entry, for example src/changelog/.2.x.x/4401_jpa_throwable_message.xml with type="fixed"?

@ramanathan1504 ramanathan1504 added the port-done No further port needed: all required ports are merged, or none was needed label Oct 30, 2026
@ramanathan1504
ramanathan1504 enabled auto-merge (squash) October 30, 2026 07:22

@ramanathan1504 ramanathan1504 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ramanathan1504
ramanathan1504 merged commit f894af9 into apache:2.x Oct 30, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Merged in Log4j pull request tracker Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

port-done No further port needed: all required ports are merged, or none was needed

Projects

Development

Successfully merging this pull request may close these issues.

2 participants