Skip to content

NPE with QueryDSL configuration - SpringBoot < 2.3.2 #864

Closed
@Marx2

Description

@Marx2

When trying to open swagger-ui, bug happens.
Field with the name "denyList" is read as a null here:
Field field = FieldUtils.getDeclaredField(instance.getClass(),fieldName,true);
I have no "denyList" configured anywhere, so it seems like something static in springdoc
As there's no null check, NPE is thrown.

java.lang.NullPointerException: null
	at org.springdoc.data.rest.customisers.QuerydslPredicateOperationCustomizer.getFieldValues(QuerydslPredicateOperationCustomizer.java:158) ~[springdoc-openapi-data-rest-1.4.6.jar:1.4.6]
	at org.springdoc.data.rest.customisers.QuerydslPredicateOperationCustomizer.customize(QuerydslPredicateOperationCustomizer.java:110) ~[springdoc-openapi-data-rest-1.4.6.jar:1.4.6]
	at org.springdoc.api.AbstractOpenApiResource.lambda$null$19(AbstractOpenApiResource.java:641) ~[springdoc-openapi-common-1.4.6.jar:1.4.6]

To Reproduce
Steps to reproduce the behavior:

  • Spring Boot 2.2.4
  • What modules and versions of springdoc-openapi are you using?
    springdoc-openapi-data-rest
    springdoc-openapi-ui
    springdoc-openapi-security
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    currently error is shown: "Fetch error undefined /v3/api-docs"

Expected behavior

  • add null check (denyList field is not mandatory), skip errors, generate configuration

Additional context
I suppose bug was introduce in #814

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions