Skip to content

fix(jmx): avoid NPE in ConnectionView.getWireFormatInfo - #2270

Open
arimu1 wants to merge 1 commit into
apache:mainfrom
arimu1:fix/2203-connectionview-wireformatinfo-npe
Open

fix(jmx): avoid NPE in ConnectionView.getWireFormatInfo#2270
arimu1 wants to merge 1 commit into
apache:mainfrom
arimu1:fix/2203-connectionview-wireformatinfo-npe

Conversation

@arimu1

@arimu1 arimu1 commented Jul 31, 2026

Copy link
Copy Markdown

Summary

ConnectionView.getWireFormatInfo() called getRemoteWireFormatInfo().toString() without a null check. TransportConnection.wireFormatInfo is only set after wire-format negotiation, so reading the JMX attribute earlier (or for transports that never set it) threw a NullPointerException.

This change returns the existing "WireFormatInfo not available" placeholder when the remote WireFormatInfo is null, matching the non-TransportConnection path.

Fixes #2203

Changes

  • ConnectionView.getWireFormatInfo(): null-safe remote WireFormatInfo handling
  • ConnectionViewTest: regression coverage for present and null remote info

Test plan

  • mvn -pl activemq-broker test -Dtest=ConnectionViewTest (JDK 17)
    • testGetWireFormatInfoWhenPresent
    • testGetWireFormatInfoWhenRemoteInfoNull

getRemoteWireFormatInfo() can be null before wire-format negotiation
completes (or for transports that never set it). Calling toString() on
that null caused an NPE when the JMX attribute was read.

Return the existing "WireFormatInfo not available" placeholder when the
remote WireFormatInfo is missing.

Fixes apache#2203

@mattrpav mattrpav 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

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

NPE at ConnectionView.java > getWireFormatInfo()

2 participants