From 94ae08701bbd7585a0b7e5a92d1975965a503c03 Mon Sep 17 00:00:00 2001
From: Dennis Kao <ulysseskao@gmail.com>
Date: Wed, 15 Jan 2014 11:28:52 +0800
Subject: [PATCH] Merge branch 'origin/2.1.x'

---
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java |   47 +++++++++++++++++------------------------------
 1 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java
index 84c14af..1596ef6 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java
@@ -34,8 +34,7 @@
  * @source $URL$
  * @since 2.0
  */
-public class NIOUtilities
-{
+public class NIOUtilities {
     /**
      * {@code true} if a warning has already been logged.
      */
@@ -47,8 +46,7 @@
      * @todo This constructor will become private when {@code NIOBufferUtils}
      * will have been removed.
      */
-    protected NIOUtilities()
-    {
+    protected NIOUtilities() {
     }
 
     /**
@@ -61,30 +59,23 @@
      * @return true if the operation was successful, false otherwise.
      * @see java.nio.MappedByteBuffer
      */
-    public static boolean clean(final ByteBuffer buffer)
-    {
-        if (buffer == null || !buffer.isDirect())
-        {
+    public static boolean clean(final ByteBuffer buffer) {
+        if (buffer == null || !buffer.isDirect()) {
             return false;
         }
-        Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction()
-        {
-            public Object run()
-            {
+        Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
                 Boolean success = Boolean.FALSE;
-                try
-                {
+                try {
                     Method getCleanerMethod = buffer.getClass().getMethod("cleaner", (Class[]) null);
                     getCleanerMethod.setAccessible(true);
                     Object cleaner = getCleanerMethod.invoke(buffer, (Object[]) null);
                     Method clean = cleaner.getClass().getMethod("clean", (Class[]) null);
                     clean.invoke(cleaner, (Object[]) null);
                     success = Boolean.TRUE;
-                } catch (Exception e)
-                {
+                } catch (Exception e) {
                     // This really is a show stopper on windows
-                    if (isLoggable())
-                    {
+                    if (isLoggable()) {
                         log(e, buffer);
                     }
                 }
@@ -98,15 +89,12 @@
     /**
      * Check if a warning message should be logged.
      */
-    private static synchronized boolean isLoggable()
-    {
-        try
-        {
+    private static synchronized boolean isLoggable() {
+        try {
             return !warned && (
-                    System.getProperty("org.geotools.io.debugBuffer", "false").equalsIgnoreCase("true") ||
-                            System.getProperty("os.name").indexOf("Windows") >= 0);
-        } catch (SecurityException exception)
-        {
+                System.getProperty("org.geotools.io.debugBuffer", "false").equalsIgnoreCase("true") ||
+                    System.getProperty("os.name").indexOf("Windows") >= 0);
+        } catch (SecurityException exception) {
             // The utilities may be running in an Applet, in which case we
             // can't read properties. Assumes we are not in debugging mode.
             return false;
@@ -116,12 +104,11 @@
     /**
      * Log a warning message.
      */
-    private static synchronized void log(final Exception e, final ByteBuffer buffer)
-    {
+    private static synchronized void log(final Exception e, final ByteBuffer buffer) {
         warned = true;
         String message = "Error attempting to close a mapped byte buffer : " + buffer.getClass().getName()
-                + "\n JVM : " + System.getProperty("java.version")
-                + ' ' + System.getProperty("java.vendor");
+            + "\n JVM : " + System.getProperty("java.version")
+            + ' ' + System.getProperty("java.vendor");
         Logger.getLogger("org.geotools.io").log(Level.SEVERE, message, e);
     }
 }

--
Gitblit v0.0.0-SNAPSHOT