LDAP-66 NullPointerException when getting PagedResultsRequestControl response
This commit is contained in:
@@ -116,6 +116,9 @@ public class PagedResultsRequestControl extends
|
||||
|
||||
LdapContext ldapContext = (LdapContext) ctx;
|
||||
Control[] responseControls = ldapContext.getResponseControls();
|
||||
if (responseControls == null) {
|
||||
responseControls = new Control[0];
|
||||
}
|
||||
|
||||
// Go through response controls and get info, regardless of class
|
||||
for (int i = 0; i < responseControls.length; i++) {
|
||||
|
||||
@@ -137,6 +137,23 @@ public class PagedResultsRequestControlTest extends TestCase {
|
||||
assertEquals(0, tested.getResultSize());
|
||||
}
|
||||
|
||||
public void testPostProcess_NoResponseControls() throws Exception {
|
||||
ldapContextControl.expectAndDefaultReturn(ldapContextMock
|
||||
.getResponseControls(), null);
|
||||
|
||||
PagedResultsRequestControl tested = new PagedResultsRequestControl(20);
|
||||
|
||||
replay();
|
||||
|
||||
tested.postProcess(ldapContextMock);
|
||||
|
||||
verify();
|
||||
|
||||
assertNull(tested.getCookie());
|
||||
assertEquals(20, tested.getPageSize());
|
||||
assertEquals(0, tested.getResultSize());
|
||||
}
|
||||
|
||||
public void testBerDecoding() throws Exception {
|
||||
byte[] value = new byte[1];
|
||||
value[0] = 8;
|
||||
|
||||
Reference in New Issue
Block a user