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

ArrayIndexOutOfBoundsException at ResteasyViolationException.convertArrayToString

XMLWordPrintable

    • Undefined

      I have a field annotated like this: 

        @NotEmpty
        public String[] specializations;

      When I do a POST request to: 

        @POST
        public Response post(@Valid Doctor body) {...}

      with an empty array I get this:

        }}{{java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

      The cause is this line of code:  

      https://github.com/resteasy/Resteasy/blob/87cd2f8413bf0914284faf4cbcd36dbbc838fdca/resteasy-core-spi/src/main/java/org/jboss/resteasy/api/validation/ResteasyViolationException.java#L363

       It assumes that the array is never empty.

            rsigal@redhat.com Ronald Sigal
            rubenlop88 Rubén López (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: