activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/3] activemq-artemis git commit: ARTEMIS-1779 Fixing CoverityScan finding
Date Wed, 04 Apr 2018 23:55:22 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 2feacd5d5 -> eec109947


ARTEMIS-1779 Fixing CoverityScan finding

There was a logic to validate if member is null.
Which seemed a bit weird considering the else would throw a NPE.
Fixing it proactively based on Coverity-scan findings.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/0bd99dff
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/0bd99dff
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/0bd99dff

Branch: refs/heads/master
Commit: 0bd99dfff7c297953f03fa9b06f27305fc1a1341
Parents: 2feacd5
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Apr 4 17:15:38 2018 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Apr 4 17:55:26 2018 -0400

----------------------------------------------------------------------
 .../core/server/cluster/impl/BridgeImpl.java    | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0bd99dff/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
index 5e0eb17..e40bc46 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
@@ -1014,17 +1014,18 @@ public class BridgeImpl implements Bridge, SessionFailureListener,
SendAcknowled
    // To be called by the topology update
    // This logic will be updated on the cluster connection
    protected void nodeUP(TopologyMember member, boolean last) {
-      ClientSessionInternal sessionToUse = session;
-      RemotingConnection connectionToUse = sessionToUse != null ? sessionToUse.getConnection()
: null;
-
-      if (member != null && this.targetNodeID != null && this.targetNodeID.equals(member.getNodeId()))
{
-         // this could be an update of the topology say after a backup started
-         BridgeImpl.this.targetNode = member;
-      } else {
-         // we don't need synchronization here, but we need to make sure we won't get a NPE
on races
-         if (connectionToUse != null && member.isMember(connectionToUse)) {
-            this.targetNode = member;
-            this.targetNodeID = member.getNodeId();
+      if (member != null) {
+         ClientSessionInternal sessionToUse = session;
+         RemotingConnection connectionToUse = sessionToUse != null ? sessionToUse.getConnection()
: null;
+         if (this.targetNodeID != null && this.targetNodeID.equals(member.getNodeId()))
{
+            // this could be an update of the topology say after a backup started
+            BridgeImpl.this.targetNode = member;
+         } else {
+            // we don't need synchronization here, but we need to make sure we won't get
a NPE on races
+            if (connectionToUse != null && member.isMember(connectionToUse)) {
+               this.targetNode = member;
+               this.targetNodeID = member.getNodeId();
+            }
          }
       }
 


Mime
View raw message