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

Validation of @Path parameters binding ignores @PathParam fields

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.0.Beta2
    • 4.2.0.Beta1
    • webservices
    • None
    • Hide

      STEP: Create Dynamic Web Project with JAX-RS support
      STEP: Create JAX-RS resource with @PathParam field and with method using filed as parameter in @Path:

      @Path("/")
      public class CarResource {
      	@PathParam("type")
      	private String type;
      	
      	@GET
      	@Path("{type}/{id}")
      	public Object getCar(@PathParam("id") int id) {
      		return null;
      	}
      }
      

      ASSERT: There is no warning
      FAIL: There is a warning:

      The @Path template parameter 'type' is not bound to any parameter annotated with @PathParam of the 'getCar(int id)' method.
      
      Show
      STEP: Create Dynamic Web Project with JAX-RS support STEP: Create JAX-RS resource with @PathParam field and with method using filed as parameter in @Path: @Path( "/" ) public class CarResource { @PathParam( "type" ) private String type; @GET @Path( "{type}/{id}" ) public Object getCar(@PathParam( "id" ) int id) { return null ; } } ASSERT: There is no warning FAIL: There is a warning: The @Path template parameter 'type' is not bound to any parameter annotated with @PathParam of the 'getCar( int id)' method.

      Validation of @Path parameters ignores @PathParam fields so if you have @PathParam field used as parameter in @Path, you get warning:

      The @Path template parameter '<parameter name>' is not bound to any parameter annotated with  @PathParam of the '<method name>' method.

            xcoulon@redhat.com Xavier Coulon
            rrabara Radoslav RĂ¡bara (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: