Skip to content
Snippets Groups Projects
Commit 84bc0537 authored by Felix Sidokhine's avatar Felix Sidokhine
Browse files

Added early returns to avoid exceptions

parent 5bea5247
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ public class UserProfileService {
}
List<List<Field>> results = queryResponse.getAll().stream().map(EntityResponse::getValue).collect(Collectors.toList());
if(results.size() > 0) profiles = new UserProfile[results.size()];
else return null;
for(int i=0;i< profiles.length; i++){
profiles[i] = profileFromResponse(results.get(i));
}
......
......@@ -31,6 +31,7 @@ public class UserProfileService {
SearchOperation search = new SearchOperation(connectionFactory);
SearchResponse res = search.execute(buildRequest(queryString,field));
if (res.getEntries().size() > 0) profiles = new UserProfile[res.getEntries().size()];
else return null;
Iterator<LdapEntry> iterator = res.getEntries().iterator();
int i = 0;
while(iterator.hasNext()){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment