Skip to content

Commit

Permalink
remove unnecessary string operation (apache#12719)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaozhangmin authored and eolivelli committed Nov 29, 2021
1 parent ce902d0 commit a31af46
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public CompletableFuture<ResourceQuota> getResourceQuota(NamespaceBundle bundle)
}

public CompletableFuture<ResourceQuota> getResourceQuota(String bundle) {
return resourceQuotaCache.get(RESOURCE_QUOTA_ROOT + "/" + bundle.toString())
return resourceQuotaCache.get(RESOURCE_QUOTA_ROOT + "/" + bundle)
.thenCompose(optResourceQuota -> {
if (optResourceQuota.isPresent()) {
return CompletableFuture.completedFuture(optResourceQuota.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ private List<Message<byte[]>> getMessagesFromHttpResponse(String topic, Response
} else {
brokerEntryMetadata = new BrokerEntryMetadata();
if (brokerEntryTimestamp != null) {
brokerEntryMetadata.setBrokerTimestamp(DateFormatter.parse(brokerEntryTimestamp.toString()));
brokerEntryMetadata.setBrokerTimestamp(DateFormatter.parse(brokerEntryTimestamp));
}

if (brokerEntryIndex != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ void run() throws Exception {
.withPojo(cls)
.withAlwaysAllowNull(alwaysAllowNull)
.build();
if (type.toLowerCase().equalsIgnoreCase("avro")) {
if (type.equalsIgnoreCase("avro")) {
input.setType("AVRO");
input.setSchema(SchemaExtractor.getAvroSchemaInfo(schemaDefinition));
} else if (type.toLowerCase().equalsIgnoreCase("json")){
} else if (type.equalsIgnoreCase("json")){
input.setType("JSON");
input.setSchema(SchemaExtractor.getJsonSchemaInfo(schemaDefinition));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static void main(String[] args) throws Exception {
}

++cmdPos;
boolean isLocalRun = cmdPos < args.length && "localrun".equals(args[cmdPos].toLowerCase());
boolean isLocalRun = cmdPos < args.length && "localrun".equalsIgnoreCase(args[cmdPos]);

Function<PulsarAdminBuilder, ? extends PulsarAdmin> adminFactory;
if (isLocalRun) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private static int getServicePort(String serviceName, String[] serviceInfos) {
case BINARY_SERVICE:
if (serviceInfos.length == 0) {
port = BINARY_PORT;
} else if (serviceInfos.length == 1 && serviceInfos[0].toLowerCase().equals(SSL_SERVICE)) {
} else if (serviceInfos.length == 1 && serviceInfos[0].equalsIgnoreCase(SSL_SERVICE)) {
port = BINARY_TLS_PORT;
} else {
throw new IllegalArgumentException("Invalid pulsar service : " + serviceName + "+"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public byte[] formatMessage(String producerName, long msgId, byte[] message) {
break;
}
if (i != 1) {
size = Float.valueOf(new String(sMessage.substring(idx+1,idx+i)));
size = Float.parseFloat(sMessage.substring(idx + 1, idx + i));
}

String sub = sMessage.substring(idx, idx+i+1);
Expand Down

0 comments on commit a31af46

Please sign in to comment.