Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BACKLOG-16810: Return empty query result on incompatible criteria #33

Merged
merged 3 commits into from
Feb 18, 2022

Conversation

gflores-jahia
Copy link
Contributor

@gflores-jahia gflores-jahia commented Feb 18, 2022

JIRA

https://jira.jahia.org/browse/BACKLOG-16810

Description

From this PR, we needed a way to prevent NPE exceptions when a searchCriteria doesn't map to LDAP properties. However, returning an empty Properties object causes the query to return all results. So we need a way to prevent NPE result but also return an empty result.

Proposed fix is that if a searchCriteria doesn't map to LDAP properties, we then instead create a valid query that returns an empty result (i.e. limit result size to 0). This avoids returning null that can cause null pointer exceptions, and returns a valid query that returns an empty result as before.

@jahia-sonarqube
Copy link

SonarQube Quality Gate

Quality Gate failed

Failed condition 2 New Code Smells (is greater than 0)
Failed condition 14 Added Technical Debt (is greater than 0)

See analysis details on SonarQube

@gflores-jahia gflores-jahia merged commit 877aa6e into master Feb 18, 2022
@gflores-jahia gflores-jahia deleted the BACKLOG-16810 branch February 18, 2022 18:51
gflores-jahia added a commit that referenced this pull request Feb 18, 2022
* Revert "QA-13649 Break the loop, return empty properties set to prevent NPE (#30) (#31)"

This reverts commit d4b76cf.

* BACKLOG-16810: Return empty query result on incompatible criteria

* Fix npe check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants