Buggy code:
@ Response checkPermission ( @ PathParam ( "username" ) String username , @ PathParam ( "calendarId" ) String calendarId , @ PathParam ( "type" ) String type ) throws Exception { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//event//{username}//{eventFeedName}//" ) public Response event ( @ PathParam ( "username" ) String username , @ PathParam ( "eventFeedName" ) String eventFeedName ) throws Exception { } @ SuppressWarnings ( "unchecked" ) @ GET @ RolesAllowed ( "users" ) @ Path ( "//feed//{username}//{feedname}//{filename}//" ) public Response feed ( @ PathParam ( "username" ) String username , @ PathParam ( "feedname" ) String feedname , @ PathParam ( "filename" ) String filename , @ Context UriInfo uri ) throws Exception { } private String makeFeed ( String author , List < CalendarEvent > events , FeedData feedData , UriInfo uri ) throws Exception { } @ GET @ Path ( "//subscribe//{username}//{calendarId}//{type}" ) public Response publicProcess ( @ PathParam ( "username" ) String username , @ PathParam ( "calendarId" ) String calendarId , @ PathParam ( "type" ) String type ) throws Exception { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//{username}//{calendarId}//{type}" ) public Response privateProcess ( @ PathParam ( "username" ) String username , @ PathParam ( "calendarId" ) String calendarId , @ PathParam ( "type" ) String type ) throws Exception { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//events//personal//{type}//{calids}//{from}//{to}//{limit}" ) @ Produces ( MediaType . APPLICATION_JSON ) public Response getEvents ( @ PathParam ( "type" ) String type , @ PathParam ( "calids" ) String calids , @ PathParam ( "from" ) long from , @ PathParam ( "to" ) long to , @ PathParam ( "limit" ) long limit ) { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//getissues//{currentdatetime}//{type}//{limit}" ) public Response upcomingEvent ( @ PathParam ( "currentdatetime" ) String currentdatetime , @ PathParam ( "type" ) String type , @ PathParam ( "limit" ) int limit ) throws Exception { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//updatestatus//{taskid}//{statusid}" ) public Response updateStatus ( @ PathParam ( "taskid" ) String taskid , @ QueryParam ( "statusid" ) int statusId ) throws Exception { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//getcalendars" ) public Response getCalendars ( ) throws Exception { } private SingleEvent makeSingleEvent ( CalendarSetting calSetting , CalendarEvent cEvent ) { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//getevent//{eventid}" ) public Response getEvent ( @ PathParam ( "eventid" ) String eventid ) throws Exception { } @ GET @ RolesAllowed ( "users" ) @ Path ( "//geteventbyid//{eventid}" ) public Response getEventById ( @ PathParam ( "eventid" ) String eventid ) throws Exception { } @ GET @ RolesAllowed ( "users" ) @ Path ( "getoccurrence//{eventid}//{recurid}" ) public Response getOccurrenceEvent ( @ PathParam ( "eventid" ) String eventId , @ PathParam ( "recurid" ) String recurId ) throws Exception { } @ GET @ Path ( "//invitation//{calendarId}//{calType}//{eventId}//{inviter}//{invitee}//{eXoId}//{answer}" ) public Response processInvitationReply ( @ PathParam ( "calendarId" ) String calendarId , @ PathParam ( "calType" ) String calType , @ PathParam ( "eventId" ) String eventId , @ PathParam ( "inviter" ) String inviter , @ PathParam ( "invitee" ) String invitee , @ PathParam ( "eXoId" ) String eXoId , @ PathParam ( "answer" ) String answer , @ Context HttpHeaders headers , @ QueryParam ( "lang" ) String language ) throws Exception { try { if ( ( getCalendarService ( ) ) instanceof Response ) { return ( ( Response ) ( getCalendarService ( ) ) ) ; } ExoContainer container = ExoContainerContext . getCurrentContainer ( ) ; String userId = ( eXoId . equals ( "null" ) ) ? null : eXoId ; int ans = Integer . parseInt ( answer ) ; Locale locale = Locale . ENGLISH ; List < Locale > acceptableLanguages = headers . getAcceptableLanguages ( ) ; if ( ! ( acceptableLanguages . isEmpty ( ) ) ) { locale = acceptableLanguages . get ( 0 ) ; } if ( ( language != null ) && ( ! ( language . isEmpty ( ) ) ) ) { locale = LocaleContextInfo . getLocale ( language ) ; } else if ( userId != null ) { OrganizationService organizationService = ( ( OrganizationService ) ( container . getComponentInstanceOfType ( OrganizationService . class ) ) ) ; UserProfile profile = organizationService . getUserProfileHandler ( ) . findUserProfileByName ( userId ) ; language = ( profile == null ) ? null : profile . getAttribute ( "user.language" ) ; if ( ( language != null ) && ( ! ( language . isEmpty ( ) ) ) ) { locale = LocaleContextInfo . getLocale ( language ) ; } } ResourceBundleService resourceBundleService = ( ( ResourceBundleService ) ( container . getComponentInstanceOfType ( ResourceBundleService . class ) ) ) ; ResourceBundle resource = resourceBundleService . getResourceBundle ( "locale.rest.calendar.CalendarRest" , locale ) ; CalendarWebservice . calendarService . confirmInvitation ( inviter , invitee , userId , Integer . parseInt ( calType ) , calendarId , eventId , ans ) ; String title = null ; String message = null ; String messageKey = "" ; String defaultMessage = "" ; switch ( ans ) { case Utils . ACCEPT : messageKey = "rest.invitation.answer.accept" ; defaultMessage = "You<seq2seq4repair_space>have<seq2seq4repair_space>accepted<seq2seq4repair_space>invitation<seq2seq4repair_space>from<seq2seq4repair_space>{0}" ; break ; case Utils . DENY : messageKey = "rest.invitation.answer.deny" ; defaultMessage = "You<seq2seq4repair_space>have<seq2seq4repair_space>refused<seq2seq4repair_space>invitation<seq2seq4repair_space>from<seq2seq4repair_space>{0}" ; break ; case Utils . NOTSURE : messageKey = "rest.invitation.answer.notsure" ; defaultMessage = "You<seq2seq4repair_space>have<seq2seq4repair_space>answered<seq2seq4repair_space>invitation<seq2seq4repair_space>from<seq2seq4repair_space>{0}:<seq2seq4repair_space>Not<seq2seq4repair_space>sure!" ; break ; } try { title = resource . getString ( "rest.invitation.answer.title" ) ; } catch ( Exception ex ) { title = "Invitation<seq2seq4repair_space>Answer" ; } try { message = resource . getString ( messageKey ) ; } catch ( Exception ex ) { message = defaultMessage ; } message = message . replace ( "{0}" , inviter ) ; StringBuffer response = new StringBuffer ( ) ; response . append ( "<html><head><title>" ) ; response . append ( title ) ; response . append ( "<//title><//head>" ) ; response . append ( "<body>" ) ; response . append ( message ) ; response . append ( "<//body><//html>" ) ; <START_BUG> return Response . ok ( response . toString ( ) , TEXT_HTML ) . cacheControl ( CalendarWebservice . cc ) . build ( ) ; <END_BUG>

Fix:
return Response . ok ( response . toString ( ) , TEXT_HTML ) . header ( CONTENT_TYPE , ( ( MediaType . TEXT_HTML ) + ";<seq2seq4repair_space>charset=UTF-8" ) ) . cacheControl ( CalendarWebservice . cc ) . build ( ) ;