You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "e.bykhanova (Jira)" <ji...@apache.org> on 2024/05/01 10:45:00 UTC

[jira] [Updated] (ARTEMIS-4749) SIMILAR_BRANCHES.SWITCH in ../activemq/artemis/utils/ThreadDumpUtil.java

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

e.bykhanova updated ARTEMIS-4749:
---------------------------------
    Description: 
The static analyzer has detected SIMILAR_BRANCHES.SWITCH: we have identical branches in switch node in {_}[{_}{_}[private static String threadInfoToString|#L106C1-L113C25]]{_}{_}|https://github.com/apache/activemq-artemis/blob/fb1b362b473cad51ae5d05a897be02b1fa8461d4/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ThreadDumpUtil.java#L106-L113]{_}

 

!image-2024-05-01-13-30-38-262.png|width=518,height=321!

 

It seems better to change code this way: 

 

{{case WAITING:}}

{{case TIMED_WAITING:}}
{{                  sb.append("\t-  waiting on " + threadInfo.getLockInfo());}}
{{                  sb.append('\n');}}
{{                  break;}}

{{               default:}}
{\{            }}}

 

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

Author E. Bykhanova (e.bykhanova@fobos-nt.ru).

  was:
The static analyzer has detected SIMILAR_BRANCHES.SWITCH: we have identical branches in switch node in _[private static String threadInfoToString|[https://github.com/apache/activemq-artemis/blob/fb1b362b473cad51ae5d05a897be02b1fa8461d4/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ThreadDumpUtil.java#L106C1-L113C25]]_

 

!image-2024-05-01-13-30-38-262.png|width=518,height=321!

 

It seems better to change code this way: 

 

{{case WAITING:}}

{{case TIMED_WAITING:}}
{{                  sb.append("\t-  waiting on " + threadInfo.getLockInfo());}}
{{                  sb.append('\n');}}
{{                  break;}}

{{               default:}}
{{            }}}

 

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

Author E. Bykhanova (e.bykhanova@fobos-nt.ru).


> SIMILAR_BRANCHES.SWITCH in ../activemq/artemis/utils/ThreadDumpUtil.java
> ------------------------------------------------------------------------
>
>                 Key: ARTEMIS-4749
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4749
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.25.0
>            Reporter: e.bykhanova
>            Priority: Minor
>         Attachments: image-2024-05-01-13-29-32-686.png, image-2024-05-01-13-30-38-262.png
>
>
> The static analyzer has detected SIMILAR_BRANCHES.SWITCH: we have identical branches in switch node in {_}[{_}{_}[private static String threadInfoToString|#L106C1-L113C25]]{_}{_}|https://github.com/apache/activemq-artemis/blob/fb1b362b473cad51ae5d05a897be02b1fa8461d4/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ThreadDumpUtil.java#L106-L113]{_}
>  
> !image-2024-05-01-13-30-38-262.png|width=518,height=321!
>  
> It seems better to change code this way: 
>  
> {{case WAITING:}}
> {{case TIMED_WAITING:}}
> {{                  sb.append("\t-  waiting on " + threadInfo.getLockInfo());}}
> {{                  sb.append('\n');}}
> {{                  break;}}
> {{               default:}}
> {\{            }}}
>  
> Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
> Author E. Bykhanova (e.bykhanova@fobos-nt.ru).



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