Skip to content

Commit 5ef583c

Browse files
wenyanshi-123shiwenyan
andauthored
Disable the parameter 'ALLOW_ZERO-BYTE_CITE_SIDED_PROPERTY1 NAME' and fix null pointer exception (#15866)
Co-authored-by: shiwenyan <[email protected]>
1 parent f8e24dc commit 5ef583c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ public String getID() {
9191

9292
@Override
9393
public void onConnect(InterceptConnectMessage msg) {
94+
if (msg.getClientID() == null || msg.getClientID().trim().isEmpty()) {
95+
LOG.error(
96+
"Connection refused: client_id is missing or empty. A valid client_id is required to establish a connection.");
97+
}
9498
if (!clientIdToSessionMap.containsKey(msg.getClientID())) {
9599
MqttClientSession session = new MqttClientSession(msg.getClientID());
96100
sessionManager.login(

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,8 +3650,10 @@ public SettableFuture<ConfigTaskResult> dropDatabase(
36503650
}
36513651

36523652
public static void unsetDatabaseIfNotExist(final String database, final IClientSession session) {
3653-
if (database.equals(session.getDatabaseName())) {
3654-
session.setDatabaseName(null);
3653+
if (session != null) {
3654+
if (database.equals(session.getDatabaseName())) {
3655+
session.setDatabaseName(null);
3656+
}
36553657
}
36563658
}
36573659

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/MQTTService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private IConfig createBrokerConfig(IoTDBConfig iotDBConfig) {
9696
BrokerConstants.DATA_PATH_PROPERTY_NAME, String.valueOf(iotDBConfig.getMqttDataPath()));
9797
properties.setProperty(BrokerConstants.IMMEDIATE_BUFFER_FLUSH_PROPERTY_NAME, "true");
9898
properties.setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME, "false");
99-
properties.setProperty(BrokerConstants.ALLOW_ZERO_BYTE_CLIENT_ID_PROPERTY_NAME, "true");
99+
properties.setProperty(BrokerConstants.ALLOW_ZERO_BYTE_CLIENT_ID_PROPERTY_NAME, "false");
100100
properties.setProperty(
101101
BrokerConstants.NETTY_MAX_BYTES_PROPERTY_NAME,
102102
String.valueOf(iotDBConfig.getMqttMaxMessageSize()));

0 commit comments

Comments
 (0)