Buggy code:
public class RoomManager { private final Logger log = LoggerFactory . getLogger ( RoomManager . class ) ; private RoomEventHandler roomEventHandler ; private KurentoClientProvider kcProvider ; private final ConcurrentMap < String , Room > rooms = new ConcurrentHashMap < String , Room > ( ) ; public RoomManager ( UserNotificationService notificationService , KurentoClientProvider kcProvider ) { } public RoomManager ( RoomEventHandler roomEventHandler , KurentoClientProvider kcProvider ) { } public void joinRoom ( String userName , String roomName , ParticipantRequest request ) { } public void leaveRoom ( ParticipantRequest request ) { } public void publishMedia ( ParticipantRequest request , String sdpOffer , boolean doLoopback , MediaElement ... mediaElements ) { log . debug ( "Request<seq2seq4repair_space>[PUBLISH_MEDIA]<seq2seq4repair_space>sdpOffer={}<seq2seq4repair_space>dooLoopback={}<seq2seq4repair_space>mediaElements={}<seq2seq4repair_space>({})" , sdpOffer , doLoopback , mediaElements , request ) ; try { Participant participant = getParticipant ( request ) ; if ( participant == null ) throw new RoomException ( Code . USER_NOT_FOUND_ERROR_CODE , ( ( "No<seq2seq4repair_space>participant<seq2seq4repair_space>with<seq2seq4repair_space>id<seq2seq4repair_space>'" + ( request . getParticipantId ( ) ) ) + "'<seq2seq4repair_space>was<seq2seq4repair_space>found" ) ) ; String name = participant . getName ( ) ; Room room = participant . getRoom ( ) ; participant . createPublishingEndpoint ( ) ; for ( MediaElement elem : mediaElements ) participant . getPublisher ( ) . apply ( elem ) ; <START_BUG> String sdpAnswer = participant . publishToRoom ( OFFER , sdpOffer , doLoopback , null ) ; <END_BUG> if ( sdpAnswer != null ) roomEventHandler . onPublishMedia ( request , name , sdpAnswer , room . getParticipantIds ( ) , null ) ; else throw new RoomException ( Code . SDP_ERROR_CODE , ( "Error<seq2seq4repair_space>generating<seq2seq4repair_space>SDP<seq2seq4repair_space>answer<seq2seq4repair_space>for<seq2seq4repair_space>publishing<seq2seq4repair_space>user<seq2seq4repair_space>" + name ) ) ; room . newPublisher ( participant ) ; } catch ( RoomException e ) { log . warn ( "Error<seq2seq4repair_space>publishing<seq2seq4repair_space>media" , e ) ; roomEventHandler . onPublishMedia ( request , null , null , null , e ) ; } } public void unpublishMedia ( ParticipantRequest request ) { } public void subscribe ( String remoteName , String sdpOffer , ParticipantRequest request ) { } public void unsubscribe ( String remoteName , ParticipantRequest request ) { } public void sendMessage ( String message , String userName , String roomName , ParticipantRequest request ) { } public void onIceCandidate ( String endpointName , String candidate , int sdpMLineIndex , String sdpMid , ParticipantRequest request ) { } @ PreDestroy public void close ( ) { } public void evictParticipant ( String participantId ) throws AdminException { } public Set < String > getRooms ( ) { } public Set < UserParticipant > getParticipants ( String roomName ) throws AdminException { } public Set < UserParticipant > getPublishers ( String roomName ) throws AdminException { } public Set < UserParticipant > getSubscribers ( String roomName ) throws AdminException { } public Set < UserParticipant > getPeerPublishers ( String participantId ) throws AdminException { } public Set < UserParticipant > getPeerSubscribers ( String participantId ) throws AdminException { } public boolean createRoom ( String roomName ) throws AdminException { } public MediaPipeline getPipeline ( String participantId ) throws AdminException { } public void closeRoom ( String roomName ) throws AdminException { } public void addMediaElement ( String participantId , MediaElement element ) throws AdminException { } public void removeMediaElement ( String participantId , MediaElement element ) throws AdminException { } private Room getRoom ( String roomName , ParticipantRequest request , boolean getOrCreate ) { } private Participant getParticipant ( ParticipantRequest request ) { } private Participant getParticipant ( String pid ) { } }

Fix:
String sdpAnswer = participant . publishToRoom ( OFFER , sdpOffer , doLoopback , null , null ) ;