Fix for LDAP-37: NullPointerException when performing PagedResultsControl search.
This commit is contained in:
@@ -67,6 +67,9 @@ public abstract class AbstractRequestControlDirContextProcessor implements
|
||||
}
|
||||
|
||||
Control[] requestControls = ldapContext.getRequestControls();
|
||||
if (requestControls == null) {
|
||||
requestControls = new Control[0];
|
||||
}
|
||||
Control newControl = createRequestControl();
|
||||
|
||||
Control[] newControls = new Control[requestControls.length + 1];
|
||||
|
||||
@@ -134,6 +134,20 @@ public class AbstractRequestControlDirContextProcessorTest extends TestCase {
|
||||
verify();
|
||||
}
|
||||
|
||||
public void testPreProcess_NullControls() throws NamingException {
|
||||
ldapContextControl.setDefaultMatcher(MockControl.ARRAY_MATCHER);
|
||||
ldapContextControl.expectAndDefaultReturn(ldapContextMock
|
||||
.getRequestControls(), null);
|
||||
ldapContextMock
|
||||
.setRequestControls(new Control[] { requestControlMock });
|
||||
|
||||
replay();
|
||||
|
||||
tested.preProcess(ldapContextMock);
|
||||
|
||||
verify();
|
||||
}
|
||||
|
||||
public void testPreProcess_NotLdapContext() throws Exception {
|
||||
try {
|
||||
tested.preProcess(dirContextMock);
|
||||
|
||||
Reference in New Issue
Block a user