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

Only the root method of an overridden method in an inheritance hierarchy may be annotated with parameter constraints

    Details

      Description

      If my resource is EJB with JAX-RS annotations on it's interface then I get ConstraintDeclarationException.

      If I specify @ValidateRequest on Impl then there is no validation at all.

      This might be related to https://hibernate.atlassian.net/browse/HV-448

      @Stateless
      public class UserResourceImpl implements UserResource {
      @Override
      public User register(@Nonnull String email, @Nonnull String password) throws EmailAleadyRegisteredException
      {}
      }

      @RolesAllowed(Roles.USER)
      @Path("/user")
      public interface UserResource {
      @ValidateRequest
      @Consumes(

      {MediaType.TEXT_PLAIN}

      )
      @PermitAll
      @POST
      @Path("/")
      User register(@NotNull @FormParam("email") String email, @NotNull @FormParam("password") String password) throws EmailAleadyRegisteredException;
      }

      Call to such method results in:

      javax.validation.ConstraintDeclarationException: Only the root method of an overridden method in an inheritance hierarchy may be annotated with parameter constraints, but there are parameter constraints defined at all of the following overridden methods: [MethodMetaData [method=public abstract example.server.rest.domain.User example.server.rest.UserResource.register(java.lang.String,java.lang.String) throws example.server.business.EmailAleadyRegisteredException, parameterMetaData=[ParameterMetaData [type=class java.lang.String], [index=0], name=arg0], constraints=[NotNull], isCascading=false], ParameterMetaData [type=class java.lang.String], [index=1], name=arg1], constraints=[NotNull], isCascading=false]], constraints=[], isCascading=false, hasParameterConstraints=true], MethodMetaData [method=public example.server.rest.domain.User example.server.rest.UserResource$$$view306.register(java.lang.String,java.lang.String) throws example.server.business.EmailAleadyRegisteredException, parameterMetaData=[ParameterMetaData [type=class java.lang.String], [index=0], name=arg0], constraints=[NotNull], isCascading=false], ParameterMetaData [type=class java.lang.String], [index=1], name=arg1], constraints=[NotNull], isCascading=false]], constraints=[], isCascading=false, hasParameterConstraints=true]]

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            ron_sigal Ron Sigal added a comment -
            Show
            ron_sigal Ron Sigal added a comment - Submitted pull request https://github.com/resteasy/Resteasy/pull/548 .
            Hide
            ron_sigal Ron Sigal added a comment -

            Pull request applied.

            Show
            ron_sigal Ron Sigal added a comment - Pull request applied.
            Hide
            jira-bugzilla-migration RH Bugzilla Integration added a comment -

            Kabir Khan <kkhan@redhat.com> changed the Status of bug 1029842 from ASSIGNED to MODIFIED

            Show
            jira-bugzilla-migration RH Bugzilla Integration added a comment - Kabir Khan <kkhan@redhat.com> changed the Status of bug 1029842 from ASSIGNED to MODIFIED
            Hide
            jira-bugzilla-migration RH Bugzilla Integration added a comment -

            Paul Gier <pgier@redhat.com> changed the Status of bug 1029842 from MODIFIED to ON_QA

            Show
            jira-bugzilla-migration RH Bugzilla Integration added a comment - Paul Gier <pgier@redhat.com> changed the Status of bug 1029842 from MODIFIED to ON_QA
            Hide
            jira-bugzilla-migration RH Bugzilla Integration added a comment -

            Katerina Novotna <kanovotn@redhat.com> changed the Status of bug 1029842 from ON_QA to ASSIGNED

            Show
            jira-bugzilla-migration RH Bugzilla Integration added a comment - Katerina Novotna <kanovotn@redhat.com> changed the Status of bug 1029842 from ON_QA to ASSIGNED

              People

              • Assignee:
                ron_sigal Ron Sigal
                Reporter:
                blabno Bernard Labno
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development