sr.addResponse( convertSearchResultToDsml( searchResult, searchParameter ) );
}
}
// Creating and adding a search result done at the end of the results
SearchResultDoneCodec srd = new SearchResultDoneCodec();
LdapResultCodec ldapResult = new LdapResultCodec();
if ( !monitor.errorsReported() )
{
ldapResult.setResultCode( ResultCodeEnum.SUCCESS );
}
else
{
// Getting the exception
Throwable t = monitor.getException();
// Setting the result code
ldapResult.setResultCode( ResultCodeEnum.getBestEstimate( t, MessageTypeEnum.SEARCH_REQUEST ) );
// Setting the error message if there's one
if ( t.getMessage() != null )
{
ldapResult.setErrorMessage( t.getMessage() );
}
}
srd.setLdapResult( ldapResult );
sr.addResponse( new SearchResultDoneDsml( srd ) );
}