From 2a4afbea87de9adf3af4f4d4660f56902c5efa49 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 19 Oct 2009 19:38:09 +0000
Subject: [PATCH] In some cases it appears that interrupting the thread that is executing a search does not throw a NamingInterruptedException but a CommunicationException generated by an InterruptedIOException.  The following modifications fix this.

---
 opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java |   16 +++++++++++++++-
 opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeRefresher.java |    6 +++---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeRefresher.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeRefresher.java
index 219edd4..1dbbb2c 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeRefresher.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeRefresher.java
@@ -500,14 +500,14 @@
         }
         throwAbandonIfNeeded(null);
       }
-      catch(InterruptedNamingException x) {
+      catch (InterruptedNamingException x) {
         throwAbandonIfNeeded(x);
       }
-      catch(NamingException x) {
+      catch (NamingException x) {
         lastException = x;
         lastExceptionArg = referral[i];
       }
-      catch(DirectoryException de) {
+      catch (DirectoryException de) {
         lastException = de;
         lastExceptionArg = referral[i];
       }
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
index 3464d05..ff8ec76 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
@@ -532,7 +532,7 @@
       }
       catch (Throwable t)
       {
-        if (!(t instanceof InterruptedNamingException))
+        if (!isInterruptedException(t))
         {
           EntryReadErrorEvent ev = new EntryReadErrorEvent(this, dn, t);
           entryPane.entryReadError(ev);
@@ -1477,4 +1477,18 @@
       return menu;
     }
   }
+
+  private boolean isInterruptedException(Throwable t)
+  {
+    boolean isInterruptedException = false;
+    isInterruptedException = t instanceof java.io.InterruptedIOException ||
+    t instanceof InterruptedNamingException;
+    while ((t != null) && !isInterruptedException)
+    {
+      t = t.getCause();
+      isInterruptedException = t instanceof java.io.InterruptedIOException ||
+      t instanceof InterruptedNamingException;
+    }
+    return isInterruptedException;
+  }
 }

--
Gitblit v1.10.0