Enhanced the test to deal with binary identity attributes.
This commit is contained in:
parent
b1966cac5f
commit
228ffd5164
@ -123,7 +123,24 @@ public class SampleApp
|
||||
while (enumeration.hasMore())
|
||||
{
|
||||
System.out.print(" Attribute Name: " + attr.getID());
|
||||
System.out.println(" :: Attribute Value: " + (String) enumeration.next());
|
||||
Object attrValue = enumeration.next();
|
||||
if (attrValue instanceof byte[])
|
||||
{
|
||||
// The attribute value is binary data
|
||||
StringBuffer buf = new StringBuffer();
|
||||
char[] hex = "0123456789ABCDEF".toCharArray();
|
||||
for (int i = 0; i < ((byte[]) attrValue).length; i++)
|
||||
{
|
||||
buf.append(hex[(((byte[]) attrValue)[i] >> 4) & 0xF]);
|
||||
buf.append(hex[((byte[]) attrValue)[i] & 0xF]);
|
||||
}
|
||||
System.out.println(" :: Attribute Value: " + buf.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
// The attribute value is contained in a string
|
||||
System.out.println(" :: Attribute Value: " + (String) attrValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user