Skip to content

Fix: replace duplicated string literal '/myTopic' with constant#17419

Merged
HTHou merged 1 commit intoapache:masterfrom
A0R0P0I7T:fix-duplicate-string-myTopic
Apr 2, 2026
Merged

Fix: replace duplicated string literal '/myTopic' with constant#17419
HTHou merged 1 commit intoapache:masterfrom
A0R0P0I7T:fix-duplicate-string-myTopic

Conversation

@A0R0P0I7T
Copy link
Copy Markdown
Contributor

Description

This PR fixes a SonarCloud issue related to duplicated string literals in the MQTT example module.

The string literal "/myTopic" was used multiple times. It has been replaced with a constant to improve maintainability and readability.

Changes

  • Introduced a constant MY_TOPIC
  • Replaced all occurrences of "/myTopic" with the constant

Motivation

Fix SonarCloud issue:

  • java:S1192 (duplicated string literals)

SonarCloud link:

Verification

  • Ran mvn spotless:apply
  • Ran mvn clean install -DskipTests
  • Build passes locally

Checklist

  • been self-reviewed
  • follows project coding style (spotless applied)

Files Modified

  • example\mqtt\src\main\java\org\apache\iotdb\mqtt\MQTTClient.java

@HTHou HTHou merged commit 30a651a into apache:master Apr 2, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants