kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [3/8] kudu git commit: [java client] Fix an NPE in KuduException
Date Mon, 03 Oct 2016 21:50:37 GMT
[java client] Fix an NPE in KuduException

Saw this in a Jenkins run and also running ITClient on my machine.

Change-Id: Iceddc6931e8d3a8cb807657fc5c0804f7052e48f
Reviewed-on: http://gerrit.cloudera.org:8080/4488
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins
(cherry picked from commit 8fc75a5c654e100871316e61878b141df4707d0e)
Reviewed-on: http://gerrit.cloudera.org:8080/4605
Reviewed-by: Jean-Daniel Cryans <jdcryans@apache.org>


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

Branch: refs/heads/branch-1.0.x
Commit: 80629bb9d3c447caec8cecc3b540183a268c4acb
Parents: c4d3fb6
Author: Jean-Daniel Cryans <jdcryans@apache.org>
Authored: Tue Sep 20 18:02:36 2016 -0700
Committer: Jean-Daniel Cryans <jdcryans@apache.org>
Committed: Mon Oct 3 21:39:19 2016 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/kudu/client/KuduException.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/80629bb9/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
index 16b1072..f3afe92 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduException.java
@@ -80,20 +80,23 @@ public abstract class KuduException extends IOException {
    * @return a KuduException that's easier to handle
    */
   static KuduException transformException(Exception e) {
+    // The message may be null.
+    String message =  e.getMessage() == null ? "" : e.getMessage();
     if (e instanceof KuduException) {
       return (KuduException) e;
     } else if (e instanceof DeferredGroupException) {
       // TODO anything we can do to improve on that kind of exception?
     } else if (e instanceof TimeoutException) {
-      Status statusTimeout = Status.TimedOut(e.getMessage());
+      Status statusTimeout = Status.TimedOut(message);
       return new NonRecoverableException(statusTimeout, e);
     } else if (e instanceof InterruptedException) {
       // Need to reset the interrupt flag since we caught it but aren't handling it.
       Thread.currentThread().interrupt();
-      Status statusAborted = Status.Aborted(e.getMessage());
+
+      Status statusAborted = Status.Aborted(message);
       return new NonRecoverableException(statusAborted, e);
     }
-    Status status = Status.IOError(e.getMessage());
+    Status status = Status.IOError(message);
     return new NonRecoverableException(status, e);
   }
 }


Mime
View raw message