Here is my code
LDAPAttributeSet attributeSet = new LDAPAttributeSet();
String rolesName;
String uniquemem[] = rolesName.split(",");
if (uniquemem.length == 1)
attributeSet.add(new LDAPAttribute("uniqueMember",
new String[] { "cn="+uniquemem[0]}));
if (uniquemem.length == 2)
attributeSet.add(new LDAPAttribute("uniqueMember",
new String[] {
"cn=" +uniquemem[0],
"cn=" + uniquemem[1]
}));
if (uniquemem.length == 3)
attributeSet.add(new LDAPAttribute("uniqueMember",
new String[] {
"cn=" + uniquemem[0]
,
"cn=" + uniquemem[1]
,
"cn=" + uniquemem[2]
}));
I have tried by using List<String> and StringBuffer in forloop to add/append content dynamically but it is accepting only String[].
Please help me solve this issue
I have tried this
StringBuffer sb=new StringBuffer()
for(int i=0;i<uniquemem.length;i++)
{
sb.append("cn=" + uniquemem[i]);
}
attributeSet.add(new LDAPAttribute("uniqueMember",sb.toString()));
attributeSetis not defined...if (uniquemem.length == 2)after"cn=" +uniquemem[0]