Merge pull request #1653 from jeking3/consume-0.12.0

THRIFT-4689: Consume the 0.12.0 release branch changes into master
diff --git a/build/docker/ubuntu-bionic/Dockerfile b/build/docker/ubuntu-bionic/Dockerfile
index a8c1417..4f53ca4 100644
--- a/build/docker/ubuntu-bionic/Dockerfile
+++ b/build/docker/ubuntu-bionic/Dockerfile
@@ -113,10 +113,10 @@
     mv libevent-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
     mv libevent-master/C/* /usr/include/dmd/druntime/import/C/ && \
     rm -rf libevent-master && \
-    curl -sSL https://github.com/jeking3/openssl/archive/tls_method.tar.gz| tar xz && \
-    mv openssl-tls_method/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
-    mv openssl-tls_method/C/* /usr/include/dmd/druntime/import/C/ && \
-    rm -rf openssl-tls_method
+    git clone -b 'v2.0.0+1.1.0h' https://github.com/D-Programming-Deimos/openssl.git deimos-openssl-1.1.0h && \
+    mv deimos-openssl-1.1.0h/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
+    mv deimos-openssl-1.1.0h/C/* /usr/include/dmd/druntime/import/C/ && \
+    rm -rf deimos-openssl-1.1.0h
 
 RUN apt-get install -y --no-install-recommends \
       `# Dart dependencies` \
diff --git a/lib/java/src/org/apache/thrift/TUnion.java b/lib/java/src/org/apache/thrift/TUnion.java
index 13f9c67..1ef11df 100644
--- a/lib/java/src/org/apache/thrift/TUnion.java
+++ b/lib/java/src/org/apache/thrift/TUnion.java
@@ -79,7 +79,7 @@
   }
 
   private static Map deepCopyMap(Map<Object, Object> map) {
-    Map copy = new HashMap();
+    Map copy = new HashMap(map.size());
     for (Map.Entry<Object, Object> entry : map.entrySet()) {
       copy.put(deepCopyObject(entry.getKey()), deepCopyObject(entry.getValue()));
     }
@@ -87,7 +87,7 @@
   }
 
   private static Set deepCopySet(Set set) {
-    Set copy = new HashSet();
+    Set copy = new HashSet(set.size());
     for (Object o : set) {
       copy.add(deepCopyObject(o));
     }
diff --git a/lib/java/src/org/apache/thrift/server/AbstractNonblockingServer.java b/lib/java/src/org/apache/thrift/server/AbstractNonblockingServer.java
index 5c62b99..8c206e4 100644
--- a/lib/java/src/org/apache/thrift/server/AbstractNonblockingServer.java
+++ b/lib/java/src/org/apache/thrift/server/AbstractNonblockingServer.java
@@ -435,17 +435,23 @@
      * has come in.
      */
     public void changeSelectInterests() {
-      if (state_ == FrameBufferState.AWAITING_REGISTER_WRITE) {
+      switch (state_) {
+      case AWAITING_REGISTER_WRITE:
         // set the OP_WRITE interest
         selectionKey_.interestOps(SelectionKey.OP_WRITE);
         state_ = FrameBufferState.WRITING;
-      } else if (state_ == FrameBufferState.AWAITING_REGISTER_READ) {
+        break;
+      case AWAITING_REGISTER_READ:
         prepareRead();
-      } else if (state_ == FrameBufferState.AWAITING_CLOSE) {
+        break;
+      case AWAITING_CLOSE:
         close();
         selectionKey_.cancel();
-      } else {
-        LOGGER.error("changeSelectInterest was called, but state is invalid (" + state_ + ")");
+        break;
+      default:
+        LOGGER.error(
+            "changeSelectInterest was called, but state is invalid ({})",
+            state_);
       }
     }