activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-493 - NullPointerException when trying a null connection remote properties are passed by client
Date Tue, 19 Apr 2016 13:50:23 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master bfa3b27cf -> b4a6427d6


ARTEMIS-493 - NullPointerException when trying a null connection remote properties are passed
by client

adde a check and fixed a couple of other potential NPE's

https://issues.apache.org/jira/browse/ARTEMIS-493


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

Branch: refs/heads/master
Commit: 97f3fb241ccc72d230dabef4deb028219f8ac8ad
Parents: bfa3b27
Author: Andy Taylor <andy.tayls67@gmail.com>
Authored: Tue Apr 19 11:21:14 2016 +0100
Committer: Andy Taylor <andy.tayls67@gmail.com>
Committed: Tue Apr 19 11:21:33 2016 +0100

----------------------------------------------------------------------
 .../plug/ProtonSessionIntegrationCallback.java  | 30 ++++++++++++--------
 .../plug/context/AbstractConnectionContext.java |  6 +++-
 2 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/97f3fb24/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/plug/ProtonSessionIntegrationCallback.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/plug/ProtonSessionIntegrationCallback.java
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/plug/ProtonSessionIntegrationCallback.java
index aa42a92..2dccc30 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/plug/ProtonSessionIntegrationCallback.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/plug/ProtonSessionIntegrationCallback.java
@@ -242,23 +242,29 @@ public class ProtonSessionIntegrationCallback implements AMQPSessionCallback,
Se
 
    @Override
    public void rollbackCurrentTX() throws Exception {
-      recoverContext();
-      try {
-         serverSession.rollback(false);
-      }
-      finally {
-         resetContext();
+      //need to check here as this can be called if init fails
+      if (serverSession != null) {
+         recoverContext();
+         try {
+            serverSession.rollback(false);
+         }
+         finally {
+            resetContext();
+         }
       }
    }
 
    @Override
    public void close() throws Exception {
-      recoverContext();
-      try {
-         serverSession.close(false);
-      }
-      finally {
-         resetContext();
+      //need to check here as this can be called if init fails
+      if (serverSession != null) {
+         recoverContext();
+         try {
+            serverSession.close(false);
+         }
+         finally {
+            resetContext();
+         }
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/97f3fb24/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java
b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java
index fd1ae99..93442de 100644
--- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java
+++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractConnectionContext.java
@@ -182,7 +182,11 @@ public abstract class AbstractConnectionContext extends ProtonInitializable
impl
             connection.open();
          }
          initialise();
-         if (!connection.getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED)) {
+         /*
+         * This can be null which is in effect an empty map, also we really dont need to
check this for in bound connections
+         * but its here in case we add support for outbound connections.
+         * */
+         if (connection.getRemoteProperties() == null || !connection.getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED))
{
             long nextKeepAliveTime = handler.tick(true);
             flushBytes();
             if (nextKeepAliveTime > 0 && scheduledPool != null) {


Mime
View raw message