Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-18078

Wrong problem marker on binding annotation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.0.CR1
    • 4.2.0.Beta3
    • webservices
    • None

      Have a project where there are 2 custom NameBinding annotations, one of them being associated with a Filter or Interceptor, the other not associated with any Filter or Interceptor.

      Put both annotations on a Resource Method, the problem marker (reporting that there is not Filter or Interceptor) may appear on the wrong annotation (ie, the one that is associated with an existing Filter or Interceptor).

      For example:

      @Target({ ElementType.TYPE, ElementType.METHOD })
      @Retention(value = RetentionPolicy.RUNTIME)
      @NameBinding
      public @interface CacheControlBinding { }
      

      and

      @Target({ ElementType.TYPE, ElementType.METHOD })
      @Retention(value = RetentionPolicy.RUNTIME)
      @NameBinding
      public @interface RequestIfNoneMatchBinding {
      
      }
      

      on

      @RequestScoped
      @Path("/attendees")
      @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
      @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
      public class AttendeesResource {
      
              @GET
      	@CacheControlBinding
      	@RequestIfNoneMatchBinding
      	public Response getAllAttendees() {
      		final List<AttendeeRepresentation> attendees = attendeeService.getAllAttendees().stream()
      				.map(a -> AttendeeRepresentation.from(a)).collect(Collectors.toList());
      		return Response.ok(attendees).build();
      	}
      }
      

      with

      @Provider
      @CacheControlBinding
      public class CacheControlNoCacheDirectiveFilter implements ContainerResponseFilter {
      
      	@Override
      	public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
      			throws IOException {
      		responseContext.getHeaders().add("Cache-Control", "no-cache");
      	}
      
      }
      

      In this case, the JAX-RS validator reports a problem on the @CacheControlBindong annotation on the AttendeesResource#getAllAttendees() method, while the problem should be located on the @RequestIfNoneMatchBinding annotation instead.

            xcoulon@redhat.com Xavier Coulon
            xcoulon@redhat.com Xavier Coulon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: