From 9d0cd2315ad10d4afce13c8865bd2e16a68b2b71 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 04 Aug 2016 15:06:12 +0000
Subject: [PATCH] remove CustomSearchResult, replaced by SDK's Entry

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
index 8c2529f..a6919e0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
@@ -36,10 +36,9 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.Attribute;
 import org.forgerock.opendj.ldap.ByteString;
-import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
+import org.forgerock.opendj.ldap.Entry;
 import org.opends.guitools.controlpanel.task.OfflineUpdateException;
 import org.opends.guitools.controlpanel.util.Utilities;
-import org.opends.server.types.Entry;
 import org.opends.server.types.LDIFImportConfig;
 import org.opends.server.types.OpenDsException;
 import org.opends.server.util.Base64;
@@ -76,7 +75,7 @@
   private JScrollPane readOnlyScroll;
   private JTextArea editableAttributes;
   private JTextArea readOnlyAttributes;
-  private CustomSearchResult searchResult;
+  private Entry searchResult;
 
   /** Default constructor. */
   public LDIFViewEntryPanel()
@@ -151,7 +150,7 @@
   }
 
   @Override
-  public void update(CustomSearchResult sr, boolean isReadOnly, TreePath path)
+  public void update(Entry sr, boolean isReadOnly, TreePath path)
   {
     boolean sameEntry = false;
     if (searchResult != null && sr != null)
@@ -261,16 +260,13 @@
   }
 
   @Override
-  public Entry getEntry() throws OpenDsException
+  public org.opends.server.types.Entry getEntry() throws OpenDsException
   {
-    LDIFImportConfig ldifImportConfig = null;
-    try
+    String ldif = getLDIF();
+    try (LDIFImportConfig ldifImportConfig = new LDIFImportConfig(new StringReader(ldif));
+        LDIFReader reader = new LDIFReader(ldifImportConfig))
     {
-      String ldif = getLDIF();
-
-      ldifImportConfig = new LDIFImportConfig(new StringReader(ldif));
-      LDIFReader reader = new LDIFReader(ldifImportConfig);
-      Entry entry = reader.readEntry(checkSchema());
+      org.opends.server.types.Entry entry = reader.readEntry(checkSchema());
       addValuesInRDN(entry);
       return entry;
     }
@@ -279,13 +275,6 @@
       throw new OfflineUpdateException(
           ERR_CTRL_PANEL_ERROR_CHECKING_ENTRY.get(ioe), ioe);
     }
-    finally
-    {
-      if (ldifImportConfig != null)
-      {
-        ldifImportConfig.close();
-      }
-    }
   }
 
   /**

--
Gitblit v1.10.0