Buggy code:
@ RequiresAuthentication @ Api ( value = "AlertConditions" , description = "Manage<seq2seq4repair_space>stream<seq2seq4repair_space>alert<seq2seq4repair_space>conditions" ) @ Path ( "//streams//{streamId}//alerts//conditions" ) public class StreamAlertConditionResource extends RestResource { private static final Logger LOG = LoggerFactory . getLogger ( StreamAlertConditionResource . class ) ; private final StreamService streamService ; private final AlertService alertService ; @ Inject public StreamAlertConditionResource ( StreamService streamService , AlertService alertService ) { } @ POST @ Timed @ ApiOperation ( "Create<seq2seq4repair_space>an<seq2seq4repair_space>alert<seq2seq4repair_space>condition" ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiResponses ( { @ ApiResponse ( code = 404 , message = "Stream<seq2seq4repair_space>not<seq2seq4repair_space>found." ) , @ ApiResponse ( code = 400 , message = "Invalid<seq2seq4repair_space>ObjectId." ) } ) public Response create ( @ ApiParam ( name = "streamId" , value = "The<seq2seq4repair_space>stream<seq2seq4repair_space>id<seq2seq4repair_space>this<seq2seq4repair_space>new<seq2seq4repair_space>alert<seq2seq4repair_space>condition<seq2seq4repair_space>belongs<seq2seq4repair_space>to." , required = true ) @ PathParam ( "streamId" ) String streamid , @ ApiParam ( name = "JSON<seq2seq4repair_space>body" , required = true ) @ Valid @ NotNull CreateConditionRequest ccr ) throws NotFoundException , ValidationException { checkPermission ( STREAMS_EDIT , streamid ) ; final Stream stream = streamService . load ( streamid ) ; final AlertCondition alertCondition ; try { alertCondition = alertService . fromRequest ( ccr , stream , getCurrentUser ( ) . getName ( ) ) ; } catch ( AbstractAlertCondition e ) { StreamAlertConditionResource . LOG . error ( "Invalid<seq2seq4repair_space>alarm<seq2seq4repair_space>condition<seq2seq4repair_space>type." , e ) ; throw new javax . ws . rs . BadRequestException ( e ) ; } streamService . addAlertCondition ( stream , alertCondition ) ; final Map < String , String > result = ImmutableMap . of ( "alert_condition_id" , alertCondition . getId ( ) ) ; <START_BUG> final URI alertConditionUri = UriBuilder . fromResource ( StreamAlertConditionResource . class ) . path ( "{conditionId}" ) . build ( alertCondition . getId ( ) ) ; <END_BUG> return Response . created ( alertConditionUri ) . entity ( result ) . build ( ) ; } @ PUT @ Timed @ Path ( "{conditionId}" ) @ ApiOperation ( "Modify<seq2seq4repair_space>an<seq2seq4repair_space>alert<seq2seq4repair_space>condition" ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiResponses ( { @ ApiResponse ( code = 404 , message = "Stream<seq2seq4repair_space>not<seq2seq4repair_space>found." ) , @ ApiResponse ( code = 400 , message = "Invalid<seq2seq4repair_space>ObjectId." ) } ) public void update ( @ ApiParam ( name = "streamId" , value = "The<seq2seq4repair_space>stream<seq2seq4repair_space>id<seq2seq4repair_space>the<seq2seq4repair_space>alert<seq2seq4repair_space>condition<seq2seq4repair_space>belongs<seq2seq4repair_space>to." , required = true ) @ PathParam ( "streamId" ) String streamid , @ ApiParam ( name = "conditionId" , value = "The<seq2seq4repair_space>alert<seq2seq4repair_space>condition<seq2seq4repair_space>id." , required = true ) @ PathParam ( "conditionId" ) String conditionid , @ ApiParam ( name = "JSON<seq2seq4repair_space>body" , required = true ) @ Valid @ NotNull CreateConditionRequest ccr ) throws NotFoundException , ValidationException { } @ GET @ Timed @ ApiOperation ( "Get<seq2seq4repair_space>all<seq2seq4repair_space>alert<seq2seq4repair_space>conditions<seq2seq4repair_space>of<seq2seq4repair_space>this<seq2seq4repair_space>stream" ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiResponses ( { @ ApiResponse ( code = 404 , message = "Stream<seq2seq4repair_space>not<seq2seq4repair_space>found." ) , @ ApiResponse ( code = 400 , message = "Invalid<seq2seq4repair_space>ObjectId." ) } ) public Map < String , Object > list ( @ ApiParam ( name = "streamId" , value = "The<seq2seq4repair_space>stream<seq2seq4repair_space>id<seq2seq4repair_space>this<seq2seq4repair_space>new<seq2seq4repair_space>alert<seq2seq4repair_space>condition<seq2seq4repair_space>belongs<seq2seq4repair_space>to." , required = true ) @ PathParam ( "streamId" ) String streamid ) throws NotFoundException { } @ DELETE @ Timed @ Path ( "{conditionId}" ) @ ApiOperation ( "Delete<seq2seq4repair_space>an<seq2seq4repair_space>alert<seq2seq4repair_space>condition" ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiResponses ( { @ ApiResponse ( code = 404 , message = "Stream<seq2seq4repair_space>not<seq2seq4repair_space>found." ) , @ ApiResponse ( code = 400 , message = "Invalid<seq2seq4repair_space>ObjectId." ) } ) public void delete ( @ ApiParam ( name = "streamId" , value = "The<seq2seq4repair_space>stream<seq2seq4repair_space>id<seq2seq4repair_space>this<seq2seq4repair_space>new<seq2seq4repair_space>alert<seq2seq4repair_space>condition<seq2seq4repair_space>belongs<seq2seq4repair_space>to." , required = true ) @ PathParam ( "streamId" ) String streamid , @ ApiParam ( name = "conditionId" , value = "The<seq2seq4repair_space>stream<seq2seq4repair_space>id<seq2seq4repair_space>this<seq2seq4repair_space>new<seq2seq4repair_space>alert<seq2seq4repair_space>condition<seq2seq4repair_space>belongs<seq2seq4repair_space>to." , required = true ) @ PathParam ( "conditionId" ) String conditionId ) throws NotFoundException { } No newline ; at end ; of file ; }

Fix:
final URI alertConditionUri = UriBuilder . fromResource ( StreamAlertConditionResource . class ) . path ( "{conditionId}" ) . build ( stream . getId ( ) , alertCondition . getId ( ) ) ;