asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject asterixdb git commit: [NO ISSUE][HYR] Avoid ClassCastException in processIncomingMessages
Date Tue, 24 Oct 2017 16:13:01 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 0a5d7466c -> b0f40dba4


[NO ISSUE][HYR] Avoid ClassCastException in processIncomingMessages

If an error occurs while in state of CONNECT_RECEIVED, a
ClassCastException would occur attempting to cast the exception to a
InetSocketAddress

Change-Id: Ie738cede8e0a6ec98857505f8b27624b77c34256
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2094
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/b0f40dba
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/b0f40dba
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/b0f40dba

Branch: refs/heads/master
Commit: b0f40dba488859c625c008f9b61800f09318e27a
Parents: 0a5d746
Author: Michael Blow <michael.blow@couchbase.com>
Authored: Mon Oct 23 22:23:40 2017 -0400
Committer: Michael Blow <mblow@apache.org>
Committed: Tue Oct 24 09:12:36 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hyracks/ipc/impl/IPCHandle.java  | 10 +++++-----
 .../main/java/org/apache/hyracks/ipc/impl/IPCSystem.java  |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/b0f40dba/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
index efd9830..b3a992b 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCHandle.java
@@ -148,21 +148,21 @@ final class IPCHandle implements IIPCHandle {
             }
             system.getPerformanceCounters().addMessageReceivedCount(1);
 
-            if (state == HandleState.CONNECT_RECEIVED) {
+            final boolean error = message.getFlag() == Message.ERROR;
+            if (!error && state == HandleState.CONNECT_RECEIVED) {
                 remoteAddress = (InetSocketAddress) message.getPayload();
                 system.getConnectionManager().registerHandle(this);
                 setState(HandleState.CONNECTED);
                 system.getConnectionManager().ack(this, message);
-                continue;
-            } else if (state == HandleState.CONNECT_SENT) {
+            } else if (!error && state == HandleState.CONNECT_SENT) {
                 if (message.getFlag() == Message.INITIAL_ACK) {
                     setState(HandleState.CONNECTED);
                 } else {
                     throw new IllegalStateException();
                 }
-                continue;
+            } else {
+                system.deliverIncomingMessage(message);
             }
-            system.deliverIncomingMessage(message);
         }
         inBuffer.compact();
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/b0f40dba/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCSystem.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCSystem.java
b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCSystem.java
index f27b268..f7e0af1 100644
--- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCSystem.java
+++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCSystem.java
@@ -94,7 +94,7 @@ public class IPCSystem {
         Exception exception = null;
         if (message.getFlag() == Message.ERROR) {
             exception = (Exception) message.getPayload();
-            LOGGER.log(Level.INFO, "Exception in message " + message.toString());
+            LOGGER.log(Level.INFO, "Exception in message", exception);
         } else {
             payload = message.getPayload();
         }


Mime
View raw message