Skip to content

Commit 49e1c04

Browse files
committed
Merge pull request #44393 from izeye
* pr/44393: Update copyright year of changed file Replace unconventional Optional usages Closes gh-44393
2 parents f7b23f5 + 56bd551 commit 49e1c04

File tree

1 file changed

+4
-5
lines changed
  • spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp

1 file changed

+4
-5
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import java.time.temporal.ChronoUnit;
2121
import java.util.ArrayList;
2222
import java.util.List;
23-
import java.util.Optional;
2423

2524
import org.springframework.amqp.core.AcknowledgeMode;
2625
import org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.AddressShuffleMode;
@@ -194,7 +193,7 @@ public int determinePort() {
194193
if (port != null) {
195194
return port;
196195
}
197-
return (Optional.ofNullable(getSsl().getEnabled()).orElse(false)) ? DEFAULT_PORT_SECURE : DEFAULT_PORT;
196+
return Boolean.TRUE.equals(getSsl().getEnabled()) ? DEFAULT_PORT_SECURE : DEFAULT_PORT;
198197
}
199198
return this.parsedAddresses.get(0).port;
200199
}
@@ -235,7 +234,7 @@ public void setAddresses(List<String> addresses) {
235234
private List<Address> parseAddresses(List<String> addresses) {
236235
List<Address> parsedAddresses = new ArrayList<>();
237236
for (String address : addresses) {
238-
parsedAddresses.add(new Address(address, Optional.ofNullable(getSsl().getEnabled()).orElse(false)));
237+
parsedAddresses.add(new Address(address, Boolean.TRUE.equals(getSsl().getEnabled())));
239238
}
240239
return parsedAddresses;
241240
}
@@ -475,7 +474,7 @@ public Boolean getEnabled() {
475474
* @see #getEnabled() ()
476475
*/
477476
public boolean determineEnabled() {
478-
boolean defaultEnabled = Optional.ofNullable(getEnabled()).orElse(false) || this.bundle != null;
477+
boolean defaultEnabled = Boolean.TRUE.equals(getEnabled()) || this.bundle != null;
479478
if (CollectionUtils.isEmpty(RabbitProperties.this.parsedAddresses)) {
480479
return defaultEnabled;
481480
}

0 commit comments

Comments
 (0)