Commit 8d57d891 authored by Clayton Donley's avatar Clayton Donley
Browse files

Fixed issue with with SELECT statements that retrieve only a DN. If only a DN...

Fixed issue with with SELECT statements that retrieve only a DN.  If only a DN is in the field list, then the drivers will send "1.1" as the only attribute requested as opposed to an emptry list.
parent 1f74f67f
......@@ -46,21 +46,33 @@ public class RetrieveResults {
String[] fields = select.getSearchAttributes();
fields = fields != null ? fields : new String[0];
ArrayList ar = new ArrayList();
for (int i=0, m=fields.length;i<m;i++) {
if (! fields[i].equalsIgnoreCase("dn")) {
ar.add(fields[i]);
}
String[] searchAttribs;
if (fields.length == 1 && fields[0].equalsIgnoreCase("dn")) {
searchAttribs = new String[] {"1.1"};
}
else {
ArrayList ar = new ArrayList();
for (int i=0, m=fields.length;i<m;i++) {
if (! fields[i].equalsIgnoreCase("dn")) {
ar.add(fields[i]);
}
}
searchAttribs = new String[ar.size()];
System.arraycopy(ar.toArray(),0,searchAttribs,0,ar.size());
}
String[] searchAttribs = new String[ar.size()];
System.arraycopy(ar.toArray(),0,searchAttribs,0,ar.size());
ctls.setReturningAttributes(searchAttribs.length != 0 ? searchAttribs : null);
ctls.setSearchScope(select.getSearchScope());
......
......@@ -43,7 +43,7 @@ public class Update {
mods = new ModificationItem[store.getFields().length];
fields = store.getFields();
vals = update.getVals();
String name;
for (int i=0,m=mods.length;i<m;i++) {
mods[i] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,new BasicAttribute(fields[i],vals[i]));
}
......@@ -55,7 +55,16 @@ public class Update {
seres = (SearchResult) enum.next();
buf.setLength(0);
con.modifyAttributes(buf.append(seres.getName()).append(',').append(store.getDistinguishedName()).toString(),mods);
if (seres.getName().trim().length() > 0) {
name = buf.append(seres.getName()).append(',').append(store.getDistinguishedName()).toString();
}
else {
name = store.getDistinguishedName();
}
con.modifyAttributes(name,mods);
count++;
//System.out.println("count : " + count);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment