[ 
https://issues.apache.org/jira/browse/ARTEMIS-5534?focusedWorklogId=972661&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-972661
 ]

ASF GitHub Bot logged work on ARTEMIS-5534:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Jun/25 20:19
            Start Date: 11/Jun/25 20:19
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on code in PR #5771:
URL: https://github.com/apache/activemq-artemis/pull/5771#discussion_r2140987076


##########
artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java:
##########
@@ -555,7 +555,7 @@ public static <T> T getProperty(Class<T> type, 
MqttProperties properties, MqttPr
          }
       }
 
-      return defaultReturnValue == null ? null : defaultReturnValue;
+      return Objects.requireNonNullElse(defaultReturnValue, null);

Review Comment:
   I'll need to review again since I now realize `null` is not a valid default.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 972661)
    Time Spent: 50m  (was: 40m)

> Use Objects.requireNonNullElse() where sensible
> -----------------------------------------------
>
>                 Key: ARTEMIS-5534
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5534
>             Project: ActiveMQ Artemis
>          Issue Type: Task
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> There are lots of places across the code-base which do a check like this:
> {code:java}
> foo != null ? foo : bar{code}
> or
> {code:java}
> foo == null ? bar : foo{code}
> These can be replaced, e.g.:
> {code:java}
> Objects.requireNonNullElse(foo, bar){code}
> This code is more clear and will make the code-base more consistent overall.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to