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

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

                Author: ASF GitHub Bot
            Created on: 25/Oct/21 18:47
            Start Date: 25/Oct/21 18:47
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on a change in pull request #3811:
URL: https://github.com/apache/activemq-artemis/pull/3811#discussion_r735869578



##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/embedded/EmbeddedActiveMQ.java
##########
@@ -139,7 +139,9 @@ protected void initStart() throws Exception {
    }
 
    public EmbeddedActiveMQ stop() throws Exception {
-      activeMQServer.stop();
+      if (activeMQServer != null) {
+         activeMQServer.stop();
+      }
       return this;

Review comment:
       The existing behavior which allows a `NullPointerException` is 
functionally no different from checking for `null` and throwing some other kind 
of `RuntimeException` (e.g. `java.lang.IllegalArgumentException`). The Jira was 
opened specifically to avoid such an exception.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 669723)
    Time Spent: 2h 10m  (was: 2h)

> EmbeddedActiveMQ.stop() should check for null
> ---------------------------------------------
>
>                 Key: ARTEMIS-2582
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2582
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.10.1
>            Reporter: SL
>            Priority: Trivial
>              Labels: easy
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/embedded/EmbeddedActiveMQ.java
> when calling {{EmbeddedActiveMQ.stop()}} method, there is no guarantee that 
> the init was called or successful (responsability of the caller)
> the method should check that activeMQServer is not null
> {code:java}
>    public EmbeddedActiveMQ stop() throws Exception {
> +      if (activeMQServer != null) {
>            activeMQServer.stop();
> +      }
>       return this;
>    }
> {code}
> use case : after methods in unit tests.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to