|
1 | 1 | /* |
2 | | - * Copyright 2012-2024 the original author or authors. |
| 2 | + * Copyright 2012-2025 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
20 | 20 | import java.time.temporal.ChronoUnit; |
21 | 21 | import java.util.ArrayList; |
22 | 22 | import java.util.List; |
23 | | -import java.util.Optional; |
24 | 23 |
|
25 | 24 | import org.springframework.amqp.core.AcknowledgeMode; |
26 | 25 | import org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.AddressShuffleMode; |
@@ -194,7 +193,7 @@ public int determinePort() { |
194 | 193 | if (port != null) { |
195 | 194 | return port; |
196 | 195 | } |
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; |
198 | 197 | } |
199 | 198 | return this.parsedAddresses.get(0).port; |
200 | 199 | } |
@@ -235,7 +234,7 @@ public void setAddresses(List<String> addresses) { |
235 | 234 | private List<Address> parseAddresses(List<String> addresses) { |
236 | 235 | List<Address> parsedAddresses = new ArrayList<>(); |
237 | 236 | 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()))); |
239 | 238 | } |
240 | 239 | return parsedAddresses; |
241 | 240 | } |
@@ -475,7 +474,7 @@ public Boolean getEnabled() { |
475 | 474 | * @see #getEnabled() () |
476 | 475 | */ |
477 | 476 | public boolean determineEnabled() { |
478 | | - boolean defaultEnabled = Optional.ofNullable(getEnabled()).orElse(false) || this.bundle != null; |
| 477 | + boolean defaultEnabled = Boolean.TRUE.equals(getEnabled()) || this.bundle != null; |
479 | 478 | if (CollectionUtils.isEmpty(RabbitProperties.this.parsedAddresses)) { |
480 | 479 | return defaultEnabled; |
481 | 480 | } |
|
0 commit comments