Hi.
I am currently using your plugin to browse an LDAP
directory
containing objects of class person.
This class handle the attribute userPassword which is
an octet string. Unfortunately, when using the LDIF editor,
this attribute is not displayed correctly.
For example, it will be displayed userPassword: [B@152cbc8
instead to see the password in a readable value (if set
as such)
The problem is that when you click on ok, the value
that is displayed is taken as the new value, an
consequently,
the password is changed and so, it is not possible to
connect
to the LDAP directory using this user anymore.
I make the following change in class Ldif.java and now,
it works fine, at least the way I want. So, you may
want to include it in a next release.
Regards.
/**
* generate LDIF for one ldap entry, without the dn
entry.
*
* @param ctx the Ldap entry to generate the LDIF for
* @return the LDIF text
* @throws NamingException
*/
public static String generateLdif(DirContext ctx)
throws NamingException {
StringBuffer ret = new StringBuffer();
Attributes attrs = ctx.getAttributes("");
for (NamingEnumeration ne = attrs.getIDs();
ne.hasMore();) {
String attName = (String) ne.next();
Attribute att = attrs.get(attName);
for (int i = 0; i < att.size(); i++) {
ret.append(attName);
ret.append(": ");
--> if (att.get(i) instanceof String)
--> {
--> ret.append(att.get(i).toString());
--> }
--> else
--> {
--> ret.append(new
String((byte[])att.get(i)));
--> }
ret.append("\n");
}
}
return ret.toString();
}