3 Replies Latest reply on Feb 7, 2019 2:42 AM by mkopecky

    WF15 JAX-RS @BeanParam NPE

    umphy

      Hi all,

       

      Using the latest Wildfly 15.0.1, I am trying the JAX-RS annotation @BeanParam but am getting NPE. The I have attached the stacktrace to this post. Below are the code snippets:

       

      @RequestScoped
      public class TestFilter {
          @FormParam("date_fr")
          private String dateFr;
          ...
      }
      
      @ApplicationScoped
      @Path("/test")
      public class TestRes {
          @POST
          @Path("/search")
          @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
          public Response search(@BeanParam TestFilter filter) throws IOException {
              if (filter.getDateFr().length() > 0) { // NPE here: filter.getDateFr() is null
      
              }
          }
      }

       

      When debugging in eclipse, there is clearly a value set in the field:

       

      But when viewing the expression, I get null:

       

      I have tried to use @FormParam instead of @BeanParam and that works fine without NPE.

       

      Can someone help to explain what is going on with the @BeanParam?

       

      Thanks.