Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2974

ClientConfiguration.toString(null, type, annotations) causes NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Minor Minor
    • None
    • None
    • jaxrs
    • None
    • Hide
      1. Define interface with endpoint that has @PathParams with types for which a custom ParamConverter is registered that maps null values to some string (for example "null")
      2. Create a proxy client for the interface
      3. Call endpoint method with the @PathParam annotated parameter value set to null
      4. Observe if ParamConverter maps the argument and request is sent
      Show
      Define interface with endpoint that has @PathParams with types for which a custom ParamConverter is registered that maps null values to some string (for example "null") Create a proxy client for the interface Call endpoint method with the @PathParam annotated parameter value set to null Observe if ParamConverter maps the argument and request is sent
    • Undefined

      Calling ProxyClient methods with NULL-Parameters (for which a valid ParamConverter exists) causes an NPE at "object.getClass()":

      public String toString(Object object, Type type, Annotation[] annotations)
      {
         return providerFactory.toString(object, object.getClass(), type, annotations);
      } 

       

      Can't we simply use the known type (passed as parameter "type") if "object == null"?

      Then the registered ParamConverters get a chance to handle the null value and convert it to some String that can be passed.

      In my experiments (using the debugger) "type == object.getClass()" was always true, except when object is null (type is still correct).

      Server-side this apparently works fine, already.

              pberan@redhat.com Petr Beran
              lyind Jonas Zeiger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: