Program: 104984
Project: 104984
Buggy source:
private void monitorEndpointActivity(Endpoint endpoint){
  String endpointId=endpoint.getID();
  long lastActivity=0;
  long mostRecentChannelCreated=0;
  List<RtpChannel> rtpChannels=endpoint.getChannels(null);
  for (  RtpChannel channel : rtpChannels) {
    long channelLastActivity=channel.getLastTransportActivityTime();
    if (channelLastActivity > lastActivity) {
      lastActivity=channelLastActivity;
    }
    long creationTimestamp=channel.getCreationTimestamp();
    if (creationTimestamp > mostRecentChannelCreated) {
      mostRecentChannelCreated=creationTimestamp;
    }
  }
  SctpConnection sctpConnection=endpoint.getSctpConnection();
  if (sctpConnection != null) {
    long lastSctpActivity=sctpConnection.getLastTransportActivityTime();
    if (lastSctpActivity > lastActivity) {
      lastActivity=lastSctpActivity;
    }
    long creationTimestamp=sctpConnection.getCreationTimestamp();
    if (creationTimestamp > mostRecentChannelCreated) {
      mostRecentChannelCreated=creationTimestamp;
    }
  }
  if (lastActivity == 0) {
    if (System.currentTimeMillis() - mostRecentChannelCreated > firstTransferTimeout) {
      logger.debug(endpointId + "String_Node_Str" + "String_Node_Str");
      lastActivity=mostRecentChannelCreated;
    }
 else {
      logger.debug(endpointId + "String_Node_Str");
      return;
    }
  }
  long noActivityForMs=System.currentTimeMillis() - lastActivity;
  boolean inactive=noActivityForMs > maxInactivityLimit;
  if (inactive && !inactiveEndpoints.contains(endpoint)) {
    logger.debug(endpointId + "String_Node_Str");
    inactiveEndpoints.add(endpoint);
    sendEndpointConnectionStatus(endpoint,false,null);
  }
 else   if (!inactive && inactiveEndpoints.contains(endpoint)) {
    logger.debug(endpointId + "String_Node_Str");
    inactiveEndpoints.remove(endpoint);
    sendEndpointConnectionStatus(endpoint,true,null);
  }
  if (inactive && logger.isDebugEnabled()) {
    logger.debug(String.format("String_Node_Str",endpointId,(((double)noActivityForMs) / 1000d)));
  }
}

Fixed version (ground truth):
private void monitorEndpointActivity(Endpoint endpoint){
  String endpointId=endpoint.getID();
  long lastActivity=0;
  long mostRecentChannelCreated=0;
  List<RtpChannel> rtpChannels=endpoint.getChannels(null);
  for (  RtpChannel channel : rtpChannels) {
    long channelLastActivity=channel.getLastTransportActivityTime();
    if (channelLastActivity > lastActivity) {
      lastActivity=channelLastActivity;
    }
    long creationTimestamp=channel.getCreationTimestamp();
    if (creationTimestamp > mostRecentChannelCreated) {
      mostRecentChannelCreated=creationTimestamp;
    }
  }
  SctpConnection sctpConnection=endpoint.getSctpConnection();
  if (sctpConnection != null) {
    long lastSctpActivity=sctpConnection.getLastTransportActivityTime();
    if (lastSctpActivity > lastActivity) {
      lastActivity=lastSctpActivity;
    }
    long creationTimestamp=sctpConnection.getCreationTimestamp();
    if (creationTimestamp > mostRecentChannelCreated) {
      mostRecentChannelCreated=creationTimestamp;
    }
  }
  if (lastActivity == 0) {
    if (System.currentTimeMillis() - mostRecentChannelCreated > firstTransferTimeout) {
      if (logger.isDebugEnabled())       logger.debug(endpointId + "String_Node_Str" + "String_Node_Str");
      lastActivity=mostRecentChannelCreated;
    }
 else {
      if (logger.isDebugEnabled())       logger.debug(endpointId + "String_Node_Str");
      return;
    }
  }
  long noActivityForMs=System.currentTimeMillis() - lastActivity;
  boolean inactive=noActivityForMs > maxInactivityLimit;
  if (inactive && !inactiveEndpoints.contains(endpoint)) {
    logger.debug(endpointId + "String_Node_Str");
    inactiveEndpoints.add(endpoint);
    sendEndpointConnectionStatus(endpoint,false,null);
  }
 else   if (!inactive && inactiveEndpoints.contains(endpoint)) {
    logger.debug(endpointId + "String_Node_Str");
    inactiveEndpoints.remove(endpoint);
    sendEndpointConnectionStatus(endpoint,true,null);
  }
  if (inactive && logger.isDebugEnabled()) {
    logger.debug(String.format("String_Node_Str",endpointId,(((double)noActivityForMs) / 1000d)));
  }
}