Buggy code:
@ Resource @ Route ( "//edit" ) public Content edit ( String user , String token , String room , String messageId , String message ) throws IOException { } @ Resource @ Route ( "//toggleFavorite" ) public Content toggleFavorite ( String user , String token , String targetUser ) { } @ Resource @ Route ( "//getRoom" ) public Content getRoom ( String user , String token , String targetUser , String isAdmin , String withDetail , String type ) { } @ Resource @ Route ( "//saveTeamRoom" ) public Content saveTeamRoom ( String user , String token , String teamName , String room , String users ) { if ( ! ( tokenService . hasUserWithToken ( user , token ) ) ) { return Response . notFound ( "Petit<seq2seq4repair_space>malin<seq2seq4repair_space>!" ) ; } JSONObject jsonObject = new JSONObject ( ) ; try { try { teamName = URLDecoder . decode ( teamName , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { ChatServer . LOG . info ( ( "Cannot<seq2seq4repair_space>decode<seq2seq4repair_space>message:<seq2seq4repair_space>" + teamName ) ) ; } if ( ( ( room == null ) || ( "" . equals ( room ) ) ) || ( "---" . equals ( room ) ) ) { room = chatService . getTeamRoom ( teamName , user ) ; userService . addTeamRoom ( user , room ) ; } else { String creator = chatService . getTeamCreator ( room ) ; if ( ! ( user . equals ( creator ) ) ) { return Response . notFound ( "Petit<seq2seq4repair_space>malin<seq2seq4repair_space>!" ) ; } if ( ( room . startsWith ( TEAM_PREFIX ) ) && ( ( room . length ( ) ) > ( ( TEAM_PREFIX . length ( ) ) + 1 ) ) ) { room = room . substring ( TEAM_PREFIX . length ( ) ) ; } chatService . setRoomName ( room , teamName ) ; } if ( ( users != null ) && ( ! ( "" . equals ( users ) ) ) ) { String [ ] ausers = users . split ( "," ) ; List < String > usersNew = Arrays . asList ( ausers ) ; List < String > usersToAdd = new ArrayList < String > ( usersNew ) ; List < String > usersToRemove = new ArrayList < String > ( ) ; List < String > usersExisting = userService . getUsersFilterBy ( null , room , TYPE_ROOM_TEAM ) ; for ( String userExist : usersExisting ) { if ( ! ( usersNew . contains ( userExist ) ) ) { usersToRemove . add ( userExist ) ; } else if ( usersNew . contains ( userExist ) ) { usersToAdd . remove ( userExist ) ; } } if ( ( usersToRemove . size ( ) ) > 0 ) { userService . removeTeamUsers ( room , usersToRemove ) ; StringBuilder sbUsers = new StringBuilder ( ) ; boolean first = true ; for ( String usert : usersToRemove ) { if ( ! first ) sbUsers . append ( ";<seq2seq4repair_space>" ) ; sbUsers . append ( userService . getUserFullName ( usert ) ) ; first = false ; notificationService . setNotificationsAsRead ( usert , "chat" , "room" , room ) ; } String removeTeamUserOptions = ( ( ( ( "{\"type\":\"type-remove-team-user\",\"users\":\"" + sbUsers ) + "\",<seq2seq4repair_space>" ) + "\"fullname\":\"" ) + ( userService . getUserFullName ( user ) ) ) + "\"}" ; this . send ( user , token , ( ( ChatService . TEAM_PREFIX ) + room ) , EMPTY , room , "true" , removeTeamUserOptions ) ; } if ( ( usersToAdd . size ( ) ) > 0 ) { userService . addTeamUsers ( room , usersToAdd ) ; StringBuilder sbUsers = new StringBuilder ( ) ; boolean first = true ; for ( String usert : usersToAdd ) { if ( ! first ) sbUsers . append ( ";<seq2seq4repair_space>" ) ; sbUsers . append ( userService . getUserFullName ( usert ) ) ; first = false ; } String addTeamUserOptions = ( ( ( ( "{\"type\":\"type-add-team-user\",\"users\":\"" + sbUsers ) + "\",<seq2seq4repair_space>" ) + "\"fullname\":\"" ) + ( userService . getUserFullName ( user ) ) ) + "\"}" ; this . send ( user , token , ( ( ChatService . TEAM_PREFIX ) + room ) , EMPTY , room , "true" , addTeamUserOptions ) ; } } <START_BUG> jsonObject . put ( "name" , StringEscapeUtils . escapeHtml4 ( teamName ) ) ; <END_BUG> jsonObject . put ( "room" , room ) ; } catch ( Exception e ) { ChatServer . LOG . warning ( e . getMessage ( ) ) ; return Response . notFound ( "No<seq2seq4repair_space>Room<seq2seq4repair_space>yet" ) ; } return Response . ok ( jsonObject . toString ( ) ) . withMimeType ( "application//json;<seq2seq4repair_space>charset=UTF-8" ) . withHeader ( "Cache-Control" , "no-cache" ) ; } @ Resource @ Route ( "//updateUnreadMessages" ) public Content updateUnreadMessages ( String room , String user , String token ) { } @ Resource @ Route ( "//notification" ) public Content notification ( String user , String token , String event , String withDetails ) throws IOException { } @ Resource @ Route ( "//getStatus" ) public Content getStatus ( String user , String token , String targetUser ) { } @ Resource @ Route ( "//setStatus" ) public Content setStatus ( String user , String token , String status ) { } @ Resource @ Route ( "//getCreator" ) public Content getCreator ( String user , String token , String room ) { } @ Resource @ Route ( "//users" ) public Content getUsers ( String user , String token , String room , String filter ) { } @ Resource @ Route ( "//statistics" ) public Content getStatistics ( ) { } public void sendMailWithAuth ( String senderFullname , List < String > toList , String htmlBody , String subject ) throws Exception { } }

Fix:
jsonObject . put ( "name" , teamName ) ;