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

QueryDSL support throw IllegalStateException with a null Predicate [DATALDAP-65] #85

Closed
spring-projects-issues opened this issue Mar 27, 2018 · 3 comments
Assignees
Labels
in: repository type: bug

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Mar 27, 2018

Vianney DUBUS opened DATALDAP-65 and commented

Using the QueryDSL build in support from spring-data-ldap, I got an IllegalStateException when the Predicate was null (no specified filtering set on the REST part).

This problem doesn't occur in the case of the spring-data-jpa web support, in this case, no filtering occur.

In the case of a Predicate null, no filtering should be done on the LDAP side


Affects: 1.0.10 (Ingalls SR10), 2.0.5 (Kay SR5)

Attachments:

Backported to: 2.0.6 (Kay SR6), 1.0.11 (Ingalls SR11)

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Mar 27, 2018

Vianney DUBUS commented

As a temporary solution to avoid this problem:

@GetMapping
@ResponseBody
public Collection<AgentBean> findAll(@QuerydslPredicate(root = Person.class) Predicate predicate) {
	if (null == predicate || BooleanBuilder.class.isInstance(predicate) && !((BooleanBuilder) predicate).hasValue()) {
		predicate = QPerson.person.login.isNotNull();
	}
	return personService.findAll(predicate);
}

This make sure that the predicate isn't null when passed to the LDAP repository

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Mar 27, 2018

Mark Paluch commented

robwinch – Is this something Spring LDAP should fix or do we need to check on our side whether LdapQuery is empty?

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Mar 27, 2018

Vianney DUBUS commented

I suppose that the support for QueryDSL is on spring-data-ldap side, isn't it?

For that I was able to find, it seems that the problem is in the following method: org.springframework.data.ldap.repository.support.QuerydslLdapQuery#buildQuery
The LdapQuery isn't correctly set in the case where no where predicate is available, as it don't set a filter which seems to be mandatory on spring-ldap side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository type: bug
Projects
None yet
Development

No branches or pull requests

2 participants