From 57a6140a1990ecd8e0dad51985eba78d33ea0fa7 Mon Sep 17 00:00:00 2001
From: vharseko <vharseko@openam.org.ru>
Date: Fri, 21 Jun 2019 07:47:08 +0000
Subject: [PATCH] FIX https://github.com/OpenIdentityPlatform/OpenDJ/issues/65 thanks @winklerd

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
index c3a9cc9..7943416 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
@@ -39,6 +39,7 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.IOException;
+import java.io.StringReader;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -924,7 +925,6 @@
     hmEditors.put(attrName.toLowerCase(), components);
 
     final Schema schema = getInfo().getServerDescriptor().getSchema();
-    boolean isBinary = isBinary(attrName);
     for (ByteString v : values)
     {
       gbc.fill = GridBagConstraints.HORIZONTAL;
@@ -981,17 +981,17 @@
         components.add(new EditorComponent(ocCellPanel));
         break;
       }
-      else if (isPassword(attrName) || isConfirmPassword(attrName))
+      else if (isConfirmPassword(attrName) || isPassword(attrName))
       {
         JPasswordField pf = Utilities.createPasswordField();
         if (!"".equals(v))
         {
-          pf.setText(getPasswordStringValue(attrName, v));
+          pf.setText(getPasswordStringValue(getAttributeForConfirmPasswordKey(attrName), v));
         }
         panel.add(pf, gbc);
         components.add(new EditorComponent(pf));
       }
-      else if (!isBinary)
+      else if (!isBinary(attrName))
       {
         if (isSingleValue(attrName))
         {
@@ -1215,7 +1215,7 @@
     }
 
     final String ldif = getLDIF();
-    try (LDIFEntryReader reader = new LDIFEntryReader(ldif)
+    try (LDIFEntryReader reader = new LDIFEntryReader(new StringReader(ldif))
         .setSchemaValidationPolicy(checkSchema() ? defaultPolicy():ignoreAll()))
     {
       final Entry entry = reader.readEntry();
@@ -1286,6 +1286,11 @@
     return key.startsWith(CONFIRM_PASSWORD);
   }
 
+	private String getAttributeForConfirmPasswordKey(String key)
+	{
+		return key.startsWith(CONFIRM_PASSWORD) ? key.substring(CONFIRM_PASSWORD.length()) : key;
+	}  
+
   /**
    * Returns the LDIF representation of the displayed entry.
    * @return the LDIF representation of the displayed entry.

--
Gitblit v1.10.0