[improvement](broker) TOperationStatus determines that a null pointer is redundant. (#18712)

TOperationStatus determines that a null pointer is redundant. If tOperationStatus is a null pointer, then tOperationStatus.getMessage() will have a null pointer exception.
This commit is contained in:
zzzzzzzs
2023-05-04 10:03:09 +08:00
committed by GitHub
parent 52d25f41a4
commit ffd50b6aeb
2 changed files with 7 additions and 3 deletions

View File

@ -126,7 +126,9 @@ public class BrokerReader {
} catch (TException e) {
LOG.warn("Broker close reader failed. fd={}, address={}", fd.toString(), address, e);
}
if (tOperationStatus == null || tOperationStatus.getStatusCode() != TBrokerOperationStatusCode.OK) {
if (tOperationStatus == null) {
LOG.warn("Broker close reader failed. fd={}, address={}", fd.toString(), address);
} else if (tOperationStatus.getStatusCode() != TBrokerOperationStatusCode.OK) {
LOG.warn("Broker close reader failed. fd={}, address={}, error={}", fd.toString(), address,
tOperationStatus.getMessage());
}

View File

@ -263,7 +263,7 @@ public class BrokerUtil {
LOG.warn("Broker close reader failed. path={}, address={}", path, address, ex);
}
}
if (tOperationStatus == null || tOperationStatus.getStatusCode() != TBrokerOperationStatusCode.OK) {
if (tOperationStatus.getStatusCode() != TBrokerOperationStatusCode.OK) {
LOG.warn("Broker close reader failed. path={}, address={}, error={}", path, address,
tOperationStatus.getMessage());
} else {
@ -564,7 +564,9 @@ public class BrokerUtil {
LOG.warn("Broker close writer failed. filePath={}, address={}", brokerFilePath, address, ex);
}
}
if (tOperationStatus == null || tOperationStatus.getStatusCode() != TBrokerOperationStatusCode.OK) {
if (tOperationStatus == null) {
LOG.warn("Broker close reader failed. fd={}, address={}", fd.toString(), address);
} else if (tOperationStatus.getStatusCode() != TBrokerOperationStatusCode.OK) {
LOG.warn("Broker close writer failed. filePath={}, address={}, error={}", brokerFilePath,
address, tOperationStatus.getMessage());
} else {