From 2321a6bdaffb554cde13ebccd62f5fd22bbb97c1 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 06 Jul 2015 15:57:45 +0000
Subject: [PATCH] Thank god we moved to Java 7. There, the Selector, Socket and ServerSocket are correctly implementing Closeable.

---
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java |  103 ++-------------------------------------------------
 1 files changed, 4 insertions(+), 99 deletions(-)

diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
index ba818ad..46b2e3d 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
@@ -43,8 +43,8 @@
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import javax.naming.ldap.InitialLdapContext;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -4110,113 +4110,18 @@
   }
 
   /**
-   * Closes the provided {@link Selector}'s ignoring any errors which occurred.
-   * <p>
-   * With java 7 we will be able to use {@link StaticUtils#close(Closeable...)}
-   * </p>
-   *
-   * @param selectors
-   *          The selectors to be closed, which may be <code>null</code>.
-   */
-  public static void close(Selector... selectors)
-  {
-    if (selectors == null)
-    {
-      return;
-    }
-    for (Selector selector : selectors)
-    {
-      if (selector != null)
-      {
-        try
-        {
-          selector.close();
-        }
-        catch (IOException ignored)
-        {
-          // Ignore.
-        }
-      }
-    }
-  }
-
-  /**
-   * Closes the provided {@link Socket}s ignoring any errors which occurred.
-   * <p>
-   * With java 7 we will be able to use {@link StaticUtils#close(Closeable...)}
-   * </p>
-   *
-   * @param sockets
-   *          The sockets to be closed, which may be <code>null</code>.
-   */
-  public static void close(Socket... sockets)
-  {
-    if (sockets == null)
-    {
-      return;
-    }
-    for (Socket socket : sockets)
-    {
-      if (socket != null)
-      {
-        try
-        {
-          socket.close();
-        }
-        catch (IOException ignored)
-        {
-          // Ignore.
-        }
-      }
-    }
-  }
-
-  /**
-   * Closes the provided {@link ServerSocket}s ignoring any errors which
-   * occurred.
-   * <p>
-   * With java 7 we will be able to use {@link StaticUtils#close(Closeable...)}
-   * </p>
-   *
-   * @param sockets
-   *          The sockets to be closed, which may be <code>null</code>.
-   */
-  public static void close(ServerSocket... sockets)
-  {
-    if (sockets == null)
-    {
-      return;
-    }
-    for (ServerSocket socket : sockets)
-    {
-      if (socket != null)
-      {
-        try
-        {
-          socket.close();
-        }
-        catch (IOException ignored)
-        {
-          // Ignore.
-        }
-      }
-    }
-  }
-
-  /**
-   * Closes the provided {@link InitialLdapContext}s ignoring any errors which
-   * occurred.
+   * Closes the provided {@link InitialContext}s ignoring any errors which occurred.
    *
    * @param ctxs
    *          The contexts to be closed, which may be <code>null</code>.
    */
-  public static void close(InitialLdapContext... ctxs)
+  public static void close(InitialContext... ctxs)
   {
     if (ctxs == null)
     {
       return;
     }
-    for (InitialLdapContext ctx : ctxs)
+    for (InitialContext ctx : ctxs)
     {
       if (ctx != null)
       {

--
Gitblit v1.10.0