Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-13547

Smallrye OpenAPI throws java.lang.NullPointerException when processing JAX-RS resources which define methods acception a SortedSet type parameter

XMLWordPrintable

    • Hide

      A reproducer [1] was isolated which has three methods to demonstrate the failure: the first and the second ones (namely formAsListOfString and formAsSetOfString) take a List and a Set and are working fine, while the last one - formAsSortedSetOfString -, taking a SortedSet, fails.
      The methods are using @FormParam because it was the first case that I spotted but I've seen failures when using the same data type with @QueryParam and @MatrixParam as well.

      The reproducer should fail by default. For a successful deploy the formAsSortedSetOfString method should be commented.

      [1]
      https://github.com/fabiobrz/microprofile-openapi-example/tree/sorted-set-repro

      Show
      A reproducer [1] was isolated which has three methods to demonstrate the failure: the first and the second ones (namely formAsListOfString and formAsSetOfString ) take a List and a Set and are working fine, while the last one - formAsSortedSetOfString -, taking a SortedSet , fails. The methods are using @FormParam because it was the first case that I spotted but I've seen failures when using the same data type with @QueryParam and @MatrixParam as well. The reproducer should fail by default. For a successful deploy the formAsSortedSetOfString method should be commented. [1] https://github.com/fabiobrz/microprofile-openapi-example/tree/sorted-set-repro

      Deployment of WAR containing JAX-RS resource classes which define methods accepting parameters of type SortedSet will fail with a NPE.
      SortedSet is allowed by JAX-RS spec: https://docs.oracle.com/javaee/7/api/javax/ws/rs/FormParam.html

      The following stack trace represents the output of a deployment failure when an attempt to deploy a WAR with such a resource:

      Caused by: java.lang.NullPointerException
      	at io.smallrye.openapi.runtime.scanner.ParameterProcessor.setSchemaProperties(ParameterProcessor.java:637)
      	at io.smallrye.openapi.runtime.scanner.ParameterProcessor.getFormBodyContent(ParameterProcessor.java:605)
      	at io.smallrye.openapi.runtime.scanner.ParameterProcessor.process(ParameterProcessor.java:404)
      	at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.processJaxRsMethod(OpenApiAnnotationScanner.java:577)
      	at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.lambda$processJaxRsResourceClass$0(OpenApiAnnotationScanner.java:422)
      ...
      

      The failure was initially noticed while testing RESTEasy against EAP XP 1.0.0 CR1 and CR2.

              pferraro@redhat.com Paul Ferraro
              pferraro@redhat.com Paul Ferraro
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: