Skip to content

Commit

Permalink
Use equals instead of == to compare strings (apache#11462) (apache#11497
Browse files Browse the repository at this point in the history
)

Fix to use == instead of equals to compare strings in PulsarColumnMetadata and ZooKeeperUtil

Fixes apache#11462
  • Loading branch information
skyguard1 authored Aug 23, 2021
1 parent a7a3721 commit 0db6d23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.List;
import java.util.concurrent.CountDownLatch;

import org.apache.bookkeeper.zookeeper.ZooKeeperClient;
Expand Down Expand Up @@ -116,7 +115,7 @@ public void startServer(String path) throws Exception {
// create a zookeeper client
LOG.debug("Instantiate ZK Client");
zkc = ZooKeeperClient.newBuilder().connectString(getZooKeeperConnectString()).build();
if (path != "") {
if (!"".equals(path)) {
zkc.create(path, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
// initialize the zk client with values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ public boolean equals(Object o) {
if (isInternal != that.isInternal) {
return false;
}
if (nameWithCase != null ? !nameWithCase.equals(that.nameWithCase) : that.nameWithCase != null) {
if (!Objects.equals(nameWithCase, that.nameWithCase)) {
return false;
}
if (decoderExtraInfo != null ? !decoderExtraInfo.equals(that.decoderExtraInfo) : that.decoderExtraInfo != null) {
if (!Objects.equals(decoderExtraInfo, that.decoderExtraInfo)) {
return false;
}
return Objects.equals(handleKeyValueType, that.handleKeyValueType);
Expand Down Expand Up @@ -187,10 +187,10 @@ public boolean equals(Object o) {

DecoderExtraInfo that = (DecoderExtraInfo) o;

if (mapping != that.mapping) {
if (!Objects.equals(mapping, that.mapping)) {
return false;
}
if (dataFormat != null ? !dataFormat.equals(that.dataFormat) : that.dataFormat != null) {
if (!Objects.equals(dataFormat, that.dataFormat)) {
return false;
}
return Objects.equals(formatHint, that.formatHint);
Expand Down

0 comments on commit 0db6d23

Please sign in to comment.