From 7934d276c1dfdc3224c391c23f574d244c5b0a10 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 29 Nov 2012 23:42:35 +0000
Subject: [PATCH] Minor code cleanup.

---
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java
index d892bf3..847ad6d 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/StaticUtils.java
@@ -30,6 +30,8 @@
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_HEX_DECODE_INVALID_CHARACTER;
 import static org.forgerock.opendj.ldap.CoreMessages.ERR_HEX_DECODE_INVALID_LENGTH;
 
+import java.io.Closeable;
+import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
@@ -1144,6 +1146,24 @@
     }
 
     /**
+     * Closes the provided resources ignoring any errors which occurred.
+     *
+     * @param resources
+     *            The resources to be closed, which may be {@code null}.
+     */
+    public static void closeSilently(Closeable... resources) {
+        for (Closeable r : resources) {
+            try {
+                if (r != null) {
+                    r.close();
+                }
+            } catch (IOException ignored) {
+                // Ignore.
+            }
+        }
+    }
+
+    /**
      * Attempts to compress the data in the provided source array into the given
      * destination array. If the compressed data will fit into the destination
      * array, then this method will return the number of bytes of compressed

--
Gitblit v1.10.0