From 28f3940f00f117d1691e54f207a592f11a6a6d30 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 07 May 2013 14:51:22 +0000
Subject: [PATCH] Installer.java, InstallerHelper.java: Used StaticUtils.close() and StaticUtils.sleep() methods.
---
opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java b/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java
index 1cb2556..87861f1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java
@@ -64,6 +64,9 @@
import java.util.StringTokenizer;
import java.util.TimeZone;
+import javax.naming.NamingException;
+import javax.naming.ldap.InitialLdapContext;
+
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.opends.messages.MessageDescriptor;
@@ -4669,6 +4672,10 @@
*/
public static void close(Selector... selectors)
{
+ if (selectors == null)
+ {
+ return;
+ }
for (Selector selector : selectors)
{
if (selector != null)
@@ -4696,6 +4703,10 @@
*/
public static void close(Socket... sockets)
{
+ if (sockets == null)
+ {
+ return;
+ }
for (Socket socket : sockets)
{
if (socket != null)
@@ -4713,6 +4724,34 @@
}
/**
+ * Closes the provided {@link InitialLdapContext}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)
+ {
+ if (ctxs == null)
+ {
+ return;
+ }
+ for (InitialLdapContext ctx : ctxs)
+ {
+ if (ctx != null)
+ {
+ try
+ {
+ ctx.close();
+ }
+ catch (NamingException ignored)
+ {
+ }
+ }
+ }
+ }
+
+ /**
* Calls {@link Thread#sleep(long)}, surrounding it with the mandatory
* <code>try</code> / <code>catch(InterruptedException)</code> block.
*
--
Gitblit v1.10.0