Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-19600

(7.3.z) Smallrye OpenAPI throws java.lang.NullPointerException when processing JAX-RS resources which define methods accepting a SortedSet type parameter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.3.3.CR1, 7.3.3.GA
    • EAP-XP-1.0.0.GA-CR1, EAP-XP-1.0.0.GA-CR2
    • MP OpenAPI
    • None
    • +
    • 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(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
              fburzigo Fabio Burzigotti
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: