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

Response code 204, when javax.validation.ConstraintDefinitionException is returned

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.0.17.Final
    • 3.0.14.Final
    • None
    • None

    Description

      I have a testcase which is based on org.jboss.resteasy.test.validation.TestValidationExceptions from upstream testsuite, but modified to run under EAP7 .

      I have following resource:

      @Path("/")
      public class ValidationExceptionSubResourceWithInvalidOverride extends ValidationExceptionSuperResource {
          @POST
          public void test(@Size(max = 3) String s) {
          }
      }
      
      @Path("/")
      public class ValidationExceptionSuperResource {
          @POST
          public void test(String s) {
          }
      }
      

      The client sends:

      Response response = client.target(generateURL("/",DECL_EXCEPTION)).request().post(null);
      

      Then the server returns in the body response entity with content:

      javax.validation.ConstraintDeclarationException: HV000151: A method overriding another method must not alter the parameter constraint configuration, but method public void org.jboss.resteasy.test.validation.resource.ValidationExceptionSubResourceWithInvalidOverride.test(java.lang.String) changes the configuration of public void org.jboss.resteasy.test.validation.resource.ValidationExceptionSuperResource.test(java.lang.String).
      

      and correctly sets "validation-exception" header to true.
      But the status code of the response is 204.

      According to rfc2616 the response with 204 code 'must not' include message body, which in this case does and as Validation exception was thrown, so the http response code should be 500 as it is for other Validation exceptions (ConstraintDefinitionException for example)
      htt

      Attachments

        Issue Links

          Activity

            People

              rsigal@redhat.com Ronald Sigal
              kanovotn Katerina Odabasi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: