public void run() {
connect();
LDAPSearchResults result = LDAPSearch();
while (result.hasMoreElements() && connection.isConnected()) {
byte[] arr = result.getResponseControls()[0].getValue();
LDAPEntry entry = (LDAPEntry) result.nextElement();
LDAPAttributeSet attrSet = entry.getAttributeSet();
Enumeration attrs = attrSet.getAttributes();
if (entry.getDN().contains("break")) {
String message = "\n[Thread id: " + threadId + "] " + getDate() + " [BREAK]";
if(!ldifFormat)
write(message);
System.exit(0);
} else if (entry.getDN().contains("stop")) {
try {
connection.disconnect();
String message = "\n[Thread id: " + threadId + "] " + getDate() + "[STOP]";
if(!ldifFormat)
write(message);
System.exit(0);
} catch (LDAPException ex) {
System.out.println("[Thread id: " + threadId + "]run :" + ex.getLDAPErrorMessage());
}
}
String message = "[Thread id: " + threadId + "] " + getDate() + " [" + controlName(arr[4]) + "]";
if(!ldifFormat)
write("\n" + message);
else
write("\n");
String dn = "dn: " + entry.getDN();
write(dn);
while (attrs.hasMoreElements()) {
LDAPAttribute attr = (LDAPAttribute) attrs.nextElement();
String name = attr.getName();
Enumeration values = attr.getStringValues();