[ 
https://issues.apache.org/jira/browse/ARTEMIS-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Justin Bertram updated ARTEMIS-4804:
------------------------------------
    Description: 
In [line 
332|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java]
 in file {{ScaleDownHandler.java}} variable {{session}} is initialized
{code:java}
ClientSession session = sessionFactory.createSession(user, password, true, 
false, false, false, 0);{code}
In  [line 
851|https://github.com/apache/activemq-artemis/blob/main/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java]
 in {{{}ClientSessionFactoryImp.java{}}}, the code synchronizes with the 
sessions collection and checks whether the current session is closed or whether 
the client protocol manager is down. If the closed session or inactive client 
protocol manager condition is met, the session is closed and null is returned
{code:java}
if (closed || !clientProtocolManager.isAlive()){
    session.close();
    return null;
}{code}
The {{session}} variable could potentially be {{{}null{}}}.

In [line 
339|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java]
 in file {{ScaleDownHandler.java}} potential null dereference occurs.
{code:java}
session.start(xid, XAResource.TMNOFLAGS);
{code}

  was:
In [line 
332|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java]
 in file {{ScaleDownHandler.java}} variable {{session}} is initialized
{code:java}
ClientSession session = sessionFactory.createSession(user, password, true, 
false, false, false, 0);{code}
In  [line 
851|https://github.com/apache/activemq-artemis/blob/main/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java]
 in {{{}ClientSessionFactoryImp.java{}}}, the code synchronizes with the 
sessions collection and checks whether the current session is closed or whether 
the client protocol manager is down. If the closed session or inactive client 
protocol manager condition is met, the session is closed and null is returned
{code:java}
if (closed || !clientProtocolManager.isAlive()){
    session.close();
    return null;
}{code}
The {{session}} variable could potentially be {{{}null{}}}.

In [line 
339|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java]
 in file {{ScaleDownHandler.java}} potential null dereference occurs.
{code:java}
session.start(xid, XAResource.TMNOFLAGS);
{code}
 

Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author Alexey Galkin.


> Null dereferencing in ScaleDownHandler.java
> -------------------------------------------
>
>                 Key: ARTEMIS-4804
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4804
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Galkin Alexey
>            Priority: Major
>
> In [line 
> 332|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java]
>  in file {{ScaleDownHandler.java}} variable {{session}} is initialized
> {code:java}
> ClientSession session = sessionFactory.createSession(user, password, true, 
> false, false, false, 0);{code}
> In  [line 
> 851|https://github.com/apache/activemq-artemis/blob/main/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java]
>  in {{{}ClientSessionFactoryImp.java{}}}, the code synchronizes with the 
> sessions collection and checks whether the current session is closed or 
> whether the client protocol manager is down. If the closed session or 
> inactive client protocol manager condition is met, the session is closed and 
> null is returned
> {code:java}
> if (closed || !clientProtocolManager.isAlive()){
>     session.close();
>     return null;
> }{code}
> The {{session}} variable could potentially be {{{}null{}}}.
> In [line 
> 339|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java]
>  in file {{ScaleDownHandler.java}} potential null dereference occurs.
> {code:java}
> session.start(xid, XAResource.TMNOFLAGS);
> {code}



--
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