Repository: drill Updated Branches: refs/heads/master 2311843ba -> 83d460cfe
DRILL-4358: Fix NPE in UserServer.close() - Also remove untested CustomSerDe's from CustomTunnel. - Fix GuavaPatcher copy-paste comment mistake. closes #362 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/83d460cf Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/83d460cf Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/83d460cf Branch: refs/heads/master Commit: 83d460cfebbed8d70f4363dd21c95f1636f7472e Parents: 2311843 Author: Jacques Nadeau <[email protected]> Authored: Fri Feb 5 10:45:32 2016 -0800 Committer: Jason Altekruse <[email protected]> Committed: Fri Feb 5 19:50:44 2016 -0800 ---------------------------------------------------------------------- .../org/apache/drill/hbase/GuavaPatcher.java | 8 +--- .../drill/exec/rpc/control/ControlTunnel.java | 42 -------------------- .../apache/drill/exec/rpc/user/UserServer.java | 4 +- 3 files changed, 4 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/83d460cf/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java ---------------------------------------------------------------------- diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java index 3e0cdee..8f24da8 100644 --- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java +++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java @@ -74,14 +74,8 @@ public class GuavaPatcher { ClassPool cp = ClassPool.getDefault(); CtClass cc = cp.get("com.google.common.io.Closeables"); - // Expose the constructor for Stopwatch for old libraries who use the pattern new Stopwatch().start(). - for (CtConstructor c : cc.getConstructors()) { - if (!Modifier.isStatic(c.getModifiers())) { - c.setModifiers(Modifier.PUBLIC); - } - } - // Add back the Stopwatch.elapsedMillis() method for old consumers. + // Add back the Closeables.closeQuietly() method for old consumers. CtMethod newmethod = CtNewMethod.make( "public static void closeQuietly(java.io.Closeable closeable) { try{closeable.close();}catch(Exception e){} }", cc); http://git-wip-us.apache.org/repos/asf/drill/blob/83d460cf/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java index ad6601c..9b46a7a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java @@ -39,11 +39,6 @@ import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.rpc.RpcOutcomeListener; import org.apache.drill.exec.rpc.control.Controller.CustomSerDe; -import com.dyuproject.protostuff.JsonIOUtil; -import com.dyuproject.protostuff.LinkedBuffer; -import com.dyuproject.protostuff.ProtobufIOUtil; -import com.dyuproject.protostuff.ProtostuffIOUtil; -import com.dyuproject.protostuff.Schema; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonSerializer; @@ -435,41 +430,4 @@ public class ControlTunnel { } - public static class ProtostuffBinarySerDe<MSG extends com.dyuproject.protostuff.Message<MSG>> implements - CustomSerDe<MSG> { - private Schema<MSG> schema; - - @Override - public byte[] serializeToSend(MSG send) { - final LinkedBuffer buffer = LinkedBuffer.allocate(512); - return ProtostuffIOUtil.toByteArray(send, schema, buffer); - } - - @Override - public MSG deserializeReceived(byte[] bytes) throws Exception { - MSG msg = schema.newMessage(); - ProtobufIOUtil.mergeFrom(bytes, msg, schema); - return msg; - } - - } - - public static class ProtostuffJsonSerDe<MSG extends com.dyuproject.protostuff.Message<MSG>> implements - CustomSerDe<MSG> { - private Schema<MSG> schema; - - @Override - public byte[] serializeToSend(MSG send) { - final LinkedBuffer buffer = LinkedBuffer.allocate(512); - return JsonIOUtil.toByteArray(send, schema, false, buffer); - } - - @Override - public MSG deserializeReceived(byte[] bytes) throws Exception { - MSG msg = schema.newMessage(); - JsonIOUtil.mergeFrom(bytes, msg, schema, false); - return msg; - } - - } } http://git-wip-us.apache.org/repos/asf/drill/blob/83d460cf/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java index 306db14..8ad880a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java @@ -284,7 +284,9 @@ public class UserServer extends BasicServer<RpcType, UserServer.UserClientConnec @Override public void close() throws IOException { try { - authenticator.close(); + if (authenticator != null) { + authenticator.close(); + } } catch (Exception e) { logger.warn("Failure closing authenticator.", e); }
