nus-yam/ex-repair huggingface dataset:
Program: 86344
Project: 86344
Buggy source:
@Override public final void onDisable(){
  try {
    this.playerManager.onDisable();
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  instance=null;
}

Fixed version (ground truth):
@Override public final void onDisable(){
  try {
    if (this.playerManager != null)     this.playerManager.onDisable();
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  instance=null;
}
Program: 86345
Project: 86345
Buggy source:
@Override public ModelManager getNewModelManager(CDatabase database){
  return new MongoModelManager((CMongoDatabase)database);
}

Fixed version (ground truth):
@Override public ModelManager getNewModelManager(Core core){
  return new MongoModelManager((CMongoDatabase)core.getCDatabase());
}
Program: 86346
Project: 86346
Buggy source:
@Override public CPermissionsManager getNewPermissionsManager(Core core,CDatabase database,CPlayerManager playerManager){
  return new CMongoPermissionsManager((CMongoDatabase)database,playerManager);
}

Fixed version (ground truth):
@Override public CPermissionsManager getNewPermissionsManager(Core core,CPlayerManager playerManager){
  return new CMongoPermissionsManager((CMongoDatabase)Core.getInstance().getCDatabase(),playerManager);
}
Program: 86347
Project: 86347
Buggy source:
@Override public CPlayerManager getNewPlayerManager(Core core) throws DatabaseConnectException {
  FileConfiguration config=core.getDatabaseConfiguration().getConfig();
  CMongoDatabase mongoDatabase=new CMongoDatabase(config.getString("String_Node_Str","String_Node_Str"),config.getInt("String_Node_Str",28017),config.getString("String_Node_Str","String_Node_Str"),config.getString("String_Node_Str",null),config.getString("String_Node_Str",null),config.getString("String_Node_Str"));
  return new CMongoPlayerManager(mongoDatabase);
}

Fixed version (ground truth):
@Override public CPlayerManager getNewPlayerManager(Core core){
  return new CMongoPlayerManager((CMongoDatabase)Core.getInstance().getCDatabase());
}
Program: 86348
Project: 86348
Buggy source:
ModelManager getNewModelManager(CDatabase database);

Fixed version (ground truth):
ModelManager getNewModelManager(Core core);
Program: 86349
Project: 86349
Buggy source:
CPermissionsManager getNewPermissionsManager(Core core,CDatabase database,CPlayerManager playerManager);

Fixed version (ground truth):
CPermissionsManager getNewPermissionsManager(Core core,CPlayerManager playerManager);
Program: 86350
Project: 86350
Buggy source:
CPlayerManager getNewPlayerManager(Core core) throws DatabaseConnectException ;

Fixed version (ground truth):
CPlayerManager getNewPlayerManager(Core core);
Program: 86351
Project: 86351
Buggy source:
public final void logMessage(String message){
  getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&',message));
}

Fixed version (ground truth):
public final void logMessage(String message){
  getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + getMeta().name() + "String_Node_Str"+ message));
}
Program: 86352
Project: 86352
Buggy source:
@Override public final void onEnable(){
  try {
    if (!Core.getInstance().isEnabled()) {
      onFailureToEnable();
      return;
    }
    meta=getClass().getAnnotation(ModuleMeta.class);
    saveDefaultConfig();
    this.formatsFile=new YAMLConfigurationFile(this,"String_Node_Str");
    this.formatsFile.saveDefaultConfig();
    onModuleEnable();
  }
 catch (  Exception e) {
    e.printStackTrace();
    onFailureToEnable();
    getServer().getPluginManager().disablePlugin(this);
  }
  logMessage("String_Node_Str" + meta.name() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public final void onEnable(){
  try {
    if (!Core.getInstance().isEnabled()) {
      onFailureToEnable();
      return;
    }
    Core.getInstance().onModulePreEnable(this);
    meta=getClass().getAnnotation(ModuleMeta.class);
    saveDefaultConfig();
    this.formatsFile=new YAMLConfigurationFile(this,"String_Node_Str");
    this.formatsFile.saveDefaultConfig();
    this.commandMap=new ModuleCommandMap(this);
    onModuleEnable();
  }
 catch (  Exception e) {
    e.printStackTrace();
    onFailureToEnable();
    getServer().getPluginManager().disablePlugin(this);
  }
  logMessage("String_Node_Str" + meta.name() + "String_Node_Str");
}
Program: 86353
Project: 86353
Buggy source:
@Override public final void onDisable(){
  try {
    onModuleDisable();
  }
 catch (  Exception e) {
    onFailureToDisable();
    e.printStackTrace();
  }
  logMessage("String_Node_Str" + meta.name() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public final void onDisable(){
  try {
    onModuleDisable();
    Core.getInstance().onModulePreDisable(this);
  }
 catch (  Exception e) {
    onFailureToDisable();
    e.printStackTrace();
  }
  logMessage("String_Node_Str" + meta.name() + "String_Node_Str");
}
Program: 86354
Project: 86354
Buggy source:
public final String getFormatRaw(String key,String[]... formatters){
  FileConfiguration config=formatsFile.getConfig();
  if (!config.contains(key))   return null;
  String unFormattedString=config.getString(key);
  for (  String[] formatter : formatters) {
    if (formatter.length < 2)     continue;
    unFormattedString=unFormattedString.replace(formatter[0],formatter[1]);
  }
  return unFormattedString;
}

Fixed version (ground truth):
public final String getFormatRaw(String key,String[]... formatters){
  FileConfiguration config=formatsFile.getConfig();
  if (!config.contains(key))   return null;
  String unFormattedString=ChatColor.translateAlternateColorCodes('&',config.getString(key));
  for (  String[] formatter : formatters) {
    if (formatter.length < 2)     continue;
    unFormattedString=unFormattedString.replace(formatter[0],formatter[1]);
  }
  return unFormattedString;
}
Program: 86355
Project: 86355
Buggy source:
/** 
 * Main constructor with sub-commands.
 * @param name The name of the command.
 * @param subCommands The sub-commands you wish to register.
 */
protected ModuleCommand(final String name,ModuleCommand... subCommands){
  this.name=name;
  for (  ModuleCommand subCommand : subCommands) {
    this.subCommands.put(subCommand.getName(),subCommand);
  }
  final Map<String,ModuleCommand> subCommandsLV=this.subCommands;
  this.subCommands.put("String_Node_Str",new ModuleCommand("String_Node_Str"){
    @Override public void handleCommandUnspecific(    CommandSender sender,    String[] args){
      StringBuilder builder=new StringBuilder();
      for (      Map.Entry<String,ModuleCommand> stringModuleCommandEntry : subCommandsLV.entrySet()) {
        builder.append(stringModuleCommandEntry.getKey()).append("String_Node_Str");
      }
      String s=builder.toString();
      sender.sendMessage(ChatColor.AQUA + "String_Node_Str" + ChatColor.DARK_AQUA+ name+ ChatColor.YELLOW+ "String_Node_Str"+ s.substring(0,s.length() - 2)+ "String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Main constructor with sub-commands.
 * @param name The name of the command.
 * @param subCommands The sub-commands you wish to register.
 */
protected ModuleCommand(final String name,ModuleCommand... subCommands){
  this.name=name;
  for (  ModuleCommand subCommand : subCommands) {
    this.subCommands.put(subCommand.getName(),subCommand);
    subCommand.setSuperCommand(this);
  }
  final Map<String,ModuleCommand> subCommandsLV=this.subCommands;
  final ModuleCommand superHelpCommand=this;
  this.subCommands.put("String_Node_Str",new ModuleCommand("String_Node_Str"){
    @Override public void handleCommandUnspecific(    CommandSender sender,    String[] args){
      StringBuilder builder=new StringBuilder();
      for (      Map.Entry<String,ModuleCommand> stringModuleCommandEntry : subCommandsLV.entrySet()) {
        builder.append(stringModuleCommandEntry.getKey()).append("String_Node_Str");
      }
      String s=builder.toString();
      sender.sendMessage(ChatColor.AQUA + "String_Node_Str" + ChatColor.DARK_AQUA+ superHelpCommand.getFormattedName()+ ChatColor.YELLOW+ "String_Node_Str"+ s.substring(0,s.length() - 1)+ "String_Node_Str");
    }
  }
);
}
Program: 86356
Project: 86356
Buggy source:
@SuppressWarnings("String_Node_Str") protected List<String> handleTabComplete(CommandSender sender,Command command,String alias,String[] args){
  List<String> ss=new ArrayList<>();
  String arg=args[args.length - 1];
  for (  Player player : Bukkit.getOnlinePlayers()) {
    String name1=player.getName();
    if (name1.startsWith(arg))     ss.add(name1);
  }
  return ss;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected List<String> handleTabComplete(CommandSender sender,Command command,String alias,String[] args){
  List<String> ss=new ArrayList<>();
  String arg=args.length > 0 ? args[args.length - 1] : "String_Node_Str";
  for (  Player player : Bukkit.getOnlinePlayers()) {
    String name1=player.getName();
    if (name1.startsWith(arg))     ss.add(name1);
  }
  return ss;
}
Program: 86357
Project: 86357
Buggy source:
@Override public final List<String> onTabComplete(CommandSender sender,Command command,String alias,String[] args){
  if (args.length > 1) {
    ModuleCommand possibleHigherLevelSubCommand;
    if ((possibleHigherLevelSubCommand=getSubCommandFor(args[0])) != null)     return possibleHigherLevelSubCommand.onTabComplete(sender,command,alias,Arrays.copyOfRange(args,1,args.length - 1));
  }
 else   if (args.length == 1) {
    List<ModuleCommand> subCommandsForPartial=getSubCommandsForPartial(args[0]);
    if (subCommandsForPartial.size() != 0) {
      List<String> strings=new ArrayList<>();
      for (      ModuleCommand moduleCommand : subCommandsForPartial) {
        strings.add(moduleCommand.getName());
      }
      return strings;
    }
  }
  return handleTabComplete(sender,command,alias,args);
}

Fixed version (ground truth):
@Override public final List<String> onTabComplete(CommandSender sender,Command command,String alias,String[] args){
  if (args.length > 1) {
    ModuleCommand possibleHigherLevelSubCommand;
    if ((possibleHigherLevelSubCommand=getSubCommandFor(args[0])) != null)     return possibleHigherLevelSubCommand.onTabComplete(sender,command,alias,Arrays.copyOfRange(args,1,args.length));
  }
 else   if (args.length == 1) {
    List<ModuleCommand> subCommandsForPartial=getSubCommandsForPartial(args[0]);
    if (subCommandsForPartial.size() != 0) {
      List<String> strings=new ArrayList<>();
      for (      ModuleCommand moduleCommand : subCommandsForPartial) {
        strings.add(moduleCommand.getName());
      }
      return strings;
    }
  }
  return handleTabComplete(sender,command,alias,args);
}
Program: 86358
Project: 86358
Buggy source:
/** 
 * This method <b>should</b> be overridden by any sub-classes as the functionality it provides is limited. The goal of this method should always be conveying an error message to a user in a friendly manner. The   {@link net.cogzmc.core.modular.command.CommandException} can be extended by your {@link net.cogzmc.core.modular.ModularPlugin} to provide extended functionality.The  {@code args} are the same args that would be passed to your handlers. Meaning, if this is a sub-command they will be cut to fit that sub-command, and if this is a root level command they will be all of the arguments.
 * @param ex The exception used to hold the error message and any other details about the failure. If there was an exception during the handling of the command this will be an {@link net.cogzmc.core.modular.command.UnhandledCommandExceptionException}.
 * @param args The arguments passed to the command.
 * @param sender The sender of the command, cannot be directly cast to {@link net.cogzmc.core.player.CPlayer}.
 */
@SuppressWarnings("String_Node_Str") protected void handleCommandException(CommandException ex,String[] args,CommandSender sender){
  if (ex instanceof FriendlyException)   sender.sendMessage(((FriendlyException)ex).getFriendlyMessage(this));
 else   sender.sendMessage(ChatColor.RED + ex.getClass().getSimpleName() + "String_Node_Str"+ ex.getMessage()+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This method <b>should</b> be overridden by any sub-classes as the functionality it provides is limited. The goal of this method should always be conveying an error message to a user in a friendly manner. The   {@link net.cogzmc.core.modular.command.CommandException} can be extended by your {@link net.cogzmc.core.modular.ModularPlugin} to provide extended functionality.The  {@code args} are the same args that would be passed to your handlers. Meaning, if this is a sub-command they will be cut to fit that sub-command, and if this is a root level command they will be all of the arguments.
 * @param ex The exception used to hold the error message and any other details about the failure. If there was an exception during the handling of the command this will be an {@link net.cogzmc.core.modular.command.UnhandledCommandExceptionException}.
 * @param args The arguments passed to the command.
 * @param sender The sender of the command, cannot be directly cast to {@link net.cogzmc.core.player.CPlayer}.
 */
@SuppressWarnings("String_Node_Str") protected void handleCommandException(CommandException ex,String[] args,CommandSender sender){
  if (ex instanceof FriendlyException)   sender.sendMessage(((FriendlyException)ex).getFriendlyMessage(this));
 else   sender.sendMessage(ChatColor.RED + ex.getClass().getSimpleName() + "String_Node_Str"+ ex.getMessage()+ "String_Node_Str");
  if (ex instanceof UnhandledCommandExceptionException)   ((UnhandledCommandExceptionException)ex).getCausingException().printStackTrace();
}
Program: 86359
Project: 86359
Buggy source:
/** 
 * Registers a command for handling.
 * @param command The command to register.
 */
public void registerCommand(ModuleCommand command){
  if (topLevelCommands.containsKey(command.getName()))   return;
  PluginCommand command1=getCommand(command.getName(),module);
  command1.setExecutor(command);
  command1.setTabCompleter(command);
  CommandMeta annotation=command.getClass().getAnnotation(CommandMeta.class);
  if (annotation != null) {
    command1.setAliases(Arrays.asList(annotation.aliases()));
    command1.setDescription(annotation.description());
    command1.setUsage(annotation.usage());
  }
  getCommandMap().register(module.getDescription().getName(),command1);
  this.topLevelCommands.put(command.getName(),command);
}

Fixed version (ground truth):
/** 
 * Registers a command for handling.
 * @param command The command to register.
 */
public void registerCommand(ModuleCommand command){
  if (topLevelCommands.containsKey(command.getName()))   return;
  PluginCommand command1=getCommand(command.getName(),module);
  command1.setExecutor(command);
  command1.setTabCompleter(command);
  CommandMeta annotation=command.getClass().getAnnotation(CommandMeta.class);
  if (annotation != null) {
    command1.setAliases(Arrays.asList(annotation.aliases()));
    command1.setDescription(annotation.description());
    command1.setUsage(annotation.usage());
  }
  getCommandMap().register(module.getDescription().getName(),command1);
  Core.logInfo("String_Node_Str" + command.toString());
  this.topLevelCommands.put(command.getName(),command);
}
Program: 86360
Project: 86360
Buggy source:
@Override public synchronized NetworkServer getServer(String name){
  for (  NetworkServer server : this.servers) {
    if (server.getName().equals(name))     return server;
  }
  return null;
}

Fixed version (ground truth):
@Override @Synchronized public NetworkServer getServer(String name){
  for (  NetworkServer server : this.servers) {
    if (server.getName().equals(name))     return server;
  }
  return null;
}
Program: 86361
Project: 86361
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public synchronized void updateHeartbeat(){
  long time=new Date().getTime();
  Iterator<NetworkServer> iterator=servers.iterator();
  while (iterator.hasNext())   if (time - iterator.next().getLastPing().getTime() > 10000)   iterator.remove();
  JSONObject object=new JSONObject();
  JSONArray uuids=new JSONArray();
  for (  CPlayer onlinePlayer : Core.getOnlinePlayers()) {
    uuids.add(onlinePlayer.getUniqueIdentifier().toString());
  }
  object.put(HEARTBEAT_PLAYERS_KEY,uuids);
  MessageRequest messageRequest;
  try {
    messageRequest=new MessageRequest(Collections.EMPTY_LIST,NETWORK_MANAGER_CHANNEL,object.toJSONString());
  }
 catch (  UnsupportedEncodingException e) {
    return;
  }
  boolean completedHeartbeat=false;
  int attempts=0;
  while (attempts < HEARTBEAT_ATTEMPTS_MAX) {
    attempts++;
    try {
      connect.request(messageRequest);
    }
 catch (    RequestException e) {
      e.printStackTrace();
      continue;
    }
    completedHeartbeat=true;
    break;
  }
  updateThisServer();
  if (!completedHeartbeat)   throw new RuntimeException("String_Node_Str");
  resetHeartbeat(4L,TimeUnit.SECONDS);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override @Synchronized public void updateHeartbeat(){
  long time=new Date().getTime();
  Iterator<NetworkServer> iterator=servers.iterator();
  while (iterator.hasNext())   if (time - iterator.next().getLastPing().getTime() > 10000)   iterator.remove();
  JSONObject object=new JSONObject();
  JSONArray uuids=new JSONArray();
  for (  CPlayer onlinePlayer : Core.getOnlinePlayers()) {
    uuids.add(onlinePlayer.getUniqueIdentifier().toString());
  }
  object.put(HEARTBEAT_PLAYERS_KEY,uuids);
  MessageRequest messageRequest;
  try {
    messageRequest=new MessageRequest(Collections.EMPTY_LIST,NETWORK_MANAGER_CHANNEL,object.toJSONString());
  }
 catch (  UnsupportedEncodingException e) {
    return;
  }
  boolean completedHeartbeat=false;
  int attempts=0;
  while (attempts < HEARTBEAT_ATTEMPTS_MAX) {
    attempts++;
    try {
      connect.request(messageRequest);
    }
 catch (    RequestException e) {
      e.printStackTrace();
      continue;
    }
    completedHeartbeat=true;
    break;
  }
  updateThisServer();
  if (!completedHeartbeat)   throw new RuntimeException("String_Node_Str");
  resetHeartbeat(4L,TimeUnit.SECONDS);
}
Program: 86362
Project: 86362
Buggy source:
@EventListener public synchronized void onMessage(MessageEvent event){
  if (event.getChannel().equals(NETWORK_MANAGER_CHANNEL)) {
    handleHeartbeatMessageEvent(event);
    return;
  }
  if (event.getChannel().equals(NET_COMMAND_CHANNEL)) {
    handleNetCommandMessageEvent(event);
  }
}

Fixed version (ground truth):
@EventListener @Synchronized public void onMessage(MessageEvent event){
  if (event.getChannel().equals(NETWORK_MANAGER_CHANNEL)) {
    handleHeartbeatMessageEvent(event);
    return;
  }
  if (event.getChannel().equals(NET_COMMAND_CHANNEL)) {
    handleNetCommandMessageEvent(event);
  }
}
Program: 86363
Project: 86363
Buggy source:
@Override public synchronized List<NetworkServer> getServersMatchingRegex(String regex){
  return getServersMatchingRegex(Pattern.compile(regex));
}

Fixed version (ground truth):
@Override @Synchronized public List<NetworkServer> getServersMatchingRegex(String regex){
  return getServersMatchingRegex(Pattern.compile(regex));
}
Program: 86364
Project: 86364
Buggy source:
@Override public final void onPlayerJoin(CPlayer cPlayer,InetAddress address) throws CPlayerJoinException {
  Player player=cPlayer.getBukkitPlayer();
  for (  HubItem item : this.hubItems) {
    if (!item.shouldAdd(player))     continue;
    ItemStack itemStack=item.getItemStack();
    if (item.getMeta().slot() == -1) {
      player.getInventory().addItem(itemStack);
      player.updateInventory();
      continue;
    }
    player.getInventory().setItem(item.getMeta().slot(),itemStack);
    player.updateInventory();
  }
}

Fixed version (ground truth):
@Override public final void onPlayerJoin(CPlayer cPlayer,InetAddress address) throws CPlayerJoinException {
  Player player=cPlayer.getBukkitPlayer();
  for (  HubItem item : this.hubItems) {
    if (!item.shouldAdd(player))     continue;
    ItemStack itemStack=item.getItemStacks().get(0);
    if (item.getMeta().slot() == -1) {
      player.getInventory().addItem(itemStack);
      player.updateInventory();
      continue;
    }
    player.getInventory().setItem(item.getMeta().slot(),itemStack);
    player.updateInventory();
  }
}
Program: 86365
Project: 86365
Buggy source:
String getName();

Fixed version (ground truth):
/** 
 * @return
 */
String getName();
Program: 86366
Project: 86366
Buggy source:
DBObject getDBObject(){
  BasicDBObjectBuilder builder=new BasicDBObjectBuilder();
  builder.add(MongoKey.GROUPS_NAME_KEY.toString(),name);
  if (objectId != null)   builder.add(MongoKey.ID_KEY.toString(),objectId);
  combineObjectBuilders(builder,getObjectForPermissible(this));
  BasicDBList parentList=new BasicDBList();
  for (  CGroup parent : parents) {
    CMongoGroup parent1=(CMongoGroup)parent;
    parentList.add(parent1.getObjectId());
  }
  builder.add(MongoKey.GROUPS_PARENTS_KEY.toString(),parentList);
  builder.add(MongoKey.GROUPS_PRIORITY_KEY.toString(),priority);
  return builder.get();
}

Fixed version (ground truth):
DBObject getDBObject(){
  BasicDBObjectBuilder builder=new BasicDBObjectBuilder();
  builder.add(MongoKey.GROUPS_NAME_KEY.toString(),name);
  if (objectId != null)   builder.add(MongoKey.ID_KEY.toString(),objectId);
  combineObjectBuilders(builder,getObjectForPermissible(this));
  BasicDBList parentList=new BasicDBList();
  for (  CGroup parent : parents) {
    CMongoGroup parent1=(CMongoGroup)parent;
    parentList.add(parent1.getObjectId());
  }
  builder.add(MongoKey.GROUPS_PARENTS_KEY.toString(),parentList);
  builder.add(MongoKey.GROUPS_PRIORITY_KEY.toString(),priority);
  builder.add(MongoKey.GROUPS_CHAT_SUFFIX_KEY.toString(),chatSuffix);
  return builder.get();
}
Program: 86367
Project: 86367
Buggy source:
@Override public CGroup createNewGroup(String name){
  if (getGroup(name) != null)   throw new IllegalStateException("String_Node_Str");
  @SuppressWarnings("String_Node_Str") CMongoGroup group=new CMongoGroup(name,Collections.EMPTY_MAP,Collections.EMPTY_LIST,ChatColor.WHITE,ChatColor.WHITE,name,name);
  saveGroup(group);
  if (this.getDefaultGroup() == null)   setDefaultGroup(group);
  reloadPermissions();
  return group;
}

Fixed version (ground truth):
@Override public CGroup createNewGroup(String name){
  if (getGroup(name) != null)   throw new IllegalStateException("String_Node_Str");
  @SuppressWarnings("String_Node_Str") CMongoGroup group=new CMongoGroup(name,Collections.EMPTY_MAP,Collections.EMPTY_LIST,ChatColor.WHITE,ChatColor.WHITE,name,"String_Node_Str");
  saveGroup(group);
  if (this.getDefaultGroup() == null)   setDefaultGroup(group);
  reloadPermissions();
  return group;
}
Program: 86369
Project: 86369
Buggy source:
public static BasicDBObjectBuilder getObjectForPermissible(CPermissible permissible){
  BasicDBObjectBuilder builder=new BasicDBObjectBuilder();
  if (permissible.getTablistColor() != null)   builder.add(MongoKey.GROUPS_TABLIST_COLOR_KEY.toString(),permissible.getTablistColor().name());
  if (permissible.getChatColor() != null)   builder.add(MongoKey.GROUPS_CHAT_COLOR_KEY.toString(),permissible.getChatColor().name());
  if (permissible.getChatPrefix() != null)   builder.add(MongoKey.GROUPS_CHAT_PREFIX_KEY.toString(),permissible.getChatPrefix());
  if (permissible.getDeclaredPermissions().size() > 0)   builder.add(MongoKey.GROUPS_PERMISSIONS_KEY.toString(),getDBObjectFor(permissible.getDeclaredPermissions()));
  return builder;
}

Fixed version (ground truth):
public static BasicDBObjectBuilder getObjectForPermissible(CPermissible permissible){
  BasicDBObjectBuilder builder=new BasicDBObjectBuilder();
  if (permissible.getTablistColor() != null)   builder.add(MongoKey.GROUPS_TABLIST_COLOR_KEY.toString(),permissible.getTablistColor().name());
  if (permissible.getChatColor() != null)   builder.add(MongoKey.GROUPS_CHAT_COLOR_KEY.toString(),permissible.getChatColor().name());
  if (permissible.getChatPrefix() != null)   builder.add(MongoKey.GROUPS_CHAT_PREFIX_KEY.toString(),permissible.getChatPrefix());
  if (permissible.getChatSuffix() != null)   builder.add(MongoKey.GROUPS_CHAT_SUFFIX_KEY.toString(),permissible.getChatSuffix());
  if (permissible.getDeclaredPermissions().size() > 0)   builder.add(MongoKey.GROUPS_PERMISSIONS_KEY.toString(),getDBObjectFor(permissible.getDeclaredPermissions()));
  return builder;
}
Program: 86371
Project: 86371
Buggy source:
@Override public IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder xml){
  xml.append("String_Node_Str" + ROOM_ATTR_NAME + "String_Node_Str"+ serverInfo.getRoomURL()+ "String_Node_Str");
  xml.append("String_Node_Str" + MACHINE_UID_ATTR_NAME + "String_Node_Str"+ machineUID+ "String_Node_Str");
  if (this.conferenceProperties.isEmpty()) {
    xml.append("String_Node_Str");
  }
 else {
    xml.append("String_Node_Str");
    for (    ConferencePropertyPacketExtension cppe : conferenceProperties) {
      xml.append(cppe.toXML());
    }
  }
  return xml;
}

Fixed version (ground truth):
@Override public IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder xml){
  if (serverInfo != null) {
    xml.attribute(ROOM_ATTR_NAME,serverInfo.getRoomURL());
  }
  xml.attribute(MACHINE_UID_ATTR_NAME,machineUID.toString());
  xml.rightAngleBracket();
{
    for (    ConferencePropertyPacketExtension cppe : conferenceProperties) {
      xml.element(cppe);
    }
  }
  return xml;
}
Program: 86372
Project: 86372
Buggy source:
/** 
 * Construct this <tt>ConferencePropertyPacketExtension</tt> using given property name and value
 * @param propertyName the property name
 * @param propertyValue the property value
 */
public ConferencePropertyPacketExtension(String propertyName,String propertyValue){
  super(null,ELEMENT_NAME);
  setPropertyName(propertyName);
  setPropertyValue(propertyValue);
}

Fixed version (ground truth):
/** 
 * Construct this <tt>ConferencePropertyPacketExtension</tt> using given property name and value
 * @param propertyName the property name
 * @param propertyValue the property value
 */
public ConferencePropertyPacketExtension(String propertyName,String propertyValue){
  super(ELEMENT_NAME,null);
  setPropertyName(propertyName);
  setPropertyValue(propertyValue);
}
Program: 86374
Project: 86374
Buggy source:
/** 
 * Returns this packet's first direct child extension that matches the specified <tt>type</tt>.
 * @param < T > the specific type of <tt>PacketExtension</tt> to be returned
 * @param type the <tt>Class</tt> of the extension we are looking for.
 * @return this packet's first direct child extension that matches specified<tt>type</tt> or <tt>null</tt> if no such child extension was found.
 */
public <T extends NewAbstractExtensionElement>T getFirstChildOfType(Class<T> type){
  List<? extends Element> childExtensions=getChildExtensions();
synchronized (childExtensions) {
    for (    Element extension : childExtensions) {
      if (type.isInstance(extension)) {
        @SuppressWarnings("String_Node_Str") T extensionAsType=(T)extension;
        return extensionAsType;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns this packet's first direct child extension that matches the specified <tt>type</tt>.
 * @param < T > the specific type of <tt>PacketExtension</tt> to be returned
 * @param type the <tt>Class</tt> of the extension we are looking for.
 * @return this packet's first direct child extension that matches specified<tt>type</tt> or <tt>null</tt> if no such child extension was found.
 */
public <T extends NewAbstractExtensionElement>T getFirstChildOfType(Class<T> type){
synchronized (childExtensions) {
    return getChildExtensions().stream().filter(element -> type.isInstance(element)).map(element -> (T)element).findFirst().get();
  }
}
Program: 86375
Project: 86375
Buggy source:
/** 
 * Returns this packet's direct child extensions that match the specified <tt>type</tt>.
 * @param < T > the specific <tt>PacketExtension</tt> type of child extensionsto be returned
 * @param type the <tt>Class</tt> of the extension we are looking for.
 * @return a (possibly empty) list containing all of this packet's directchild extensions that match the specified <tt>type</tt>
 */
public <T extends NewAbstractExtensionElement>List<T> getChildExtensionsOfType(Class<T> type){
  return getChildExtensions().stream().filter(element -> type.isInstance(element)).map(element -> (T)element).collect(Collectors.toList());
}

Fixed version (ground truth):
/** 
 * Returns this packet's direct child extensions that match the specified <tt>type</tt>.
 * @param < T > the specific <tt>PacketExtension</tt> type of child extensionsto be returned
 * @param type the <tt>Class</tt> of the extension we are looking for.
 * @return a (possibly empty) list containing all of this packet's directchild extensions that match the specified <tt>type</tt>
 */
public <T extends NewAbstractExtensionElement>List<T> getChildExtensionsOfType(Class<T> type){
synchronized (childExtensions) {
    return getChildExtensions().stream().filter(element -> type.isInstance(element)).map(element -> (T)element).collect(Collectors.toList());
  }
}
Program: 86379
Project: 86379
Buggy source:
/** 
 * Stop the streams of all the fake users created, and disconnect them from the MUC and the XMPP server. Also stop the <tt>HammerStats</tt> thread.
 */
public void stop(){
  for (  FakeUser user : fakeUsers) {
    user.stop();
  }
  hammerStats.stop();
}

Fixed version (ground truth):
/** 
 * Stop the streams of all the fake users created, and disconnect them from the MUC and the XMPP server. Also stop the <tt>HammerStats</tt> thread.
 */
public void stop(){
  java.util.logging.Logger l=java.util.logging.Logger.getLogger("String_Node_Str");
  java.util.logging.Level level=l.getLevel();
  l.setLevel(java.util.logging.Level.OFF);
  for (  FakeUser user : fakeUsers) {
    user.stop();
  }
  l.setLevel(level);
  hammerStats.stop();
  try {
    hammerStatsThread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 86381
Project: 86381
Buggy source:
public void run(){
  System.out.println("String_Node_Str");
  java.util.logging.Logger l=java.util.logging.Logger.getLogger("String_Node_Str");
  java.util.logging.Level level=l.getLevel();
  l.setLevel(java.util.logging.Level.OFF);
  hammer.stop();
  l.setLevel(level);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  System.out.println("String_Node_Str");
  hammer.stop();
  System.out.println("String_Node_Str");
}
Program: 86382
Project: 86382
Buggy source:
/** 
 * Stop the streams of all the fake users created, and disconnect them from the MUC and the XMPP server. Also stop the <tt>HammerStats</tt> thread.
 */
public void stop(){
  java.util.logging.Logger l=java.util.logging.Logger.getLogger("String_Node_Str");
  java.util.logging.Level level=l.getLevel();
  l.setLevel(java.util.logging.Level.OFF);
  for (  FakeUser user : fakeUsers) {
    user.stop();
  }
  l.setLevel(level);
  hammerStats.stop();
  try {
    hammerStatsThread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Stop the streams of all the fake users created, and disconnect them from the MUC and the XMPP server. Also stop the <tt>HammerStats</tt> thread.
 */
public void stop(){
  for (  FakeUser user : fakeUsers) {
    user.stop();
  }
  hammerStats.stop();
  try {
    hammerStatsThread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 86384
Project: 86384
Buggy source:
/** 
 * Get the boolean of the allStats option : if true, all the stats collected during the run will be saved in file during the run.
 * @return the boolean of the allStats option
 */
public boolean getAllStats(){
  return overallStats;
}

Fixed version (ground truth):
/** 
 * Get the boolean of the allStats option : if true, all the stats collected during the run will be saved in file during the run.
 * @return the boolean of the allStats option
 */
public boolean getAllStats(){
  return allStats;
}
Program: 86385
Project: 86385
Buggy source:
/** 
 * Get The path of a rtpdump file containing recorded Opus RTP packets that will be read for the audio stream if it was given as option to the program, or null if not.
 * @return The path of a rtpdump file containing recorded Opus RTP packetsthat will be read for the audio stream if it was given as option to the program, or null if not.
 */
public String getAudioRtpdumpFile(){
  return videoRtpdumpFile;
}

Fixed version (ground truth):
/** 
 * Get The path of a rtpdump file containing recorded Opus RTP packets that will be read for the audio stream if it was given as option to the program, or null if not.
 * @return The path of a rtpdump file containing recorded Opus RTP packetsthat will be read for the audio stream if it was given as option to the program, or null if not.
 */
public String getAudioRtpdumpFile(){
  return audioRtpdumpFile;
}
Program: 86386
Project: 86386
Buggy source:
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long millis=0;
  long timestamp=0;
  VideoFormat format;
  format=(VideoFormat)buffer.getFormat();
  if (format == null) {
    format=(VideoFormat)getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RTPPacket rtpPacket=ivfFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(0);
  buffer.setLength(data.length);
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  if (lastReadWasMarked == true) {
    rtpTimestamp=System.nanoTime();
  }
  if ((lastReadWasMarked=rtpPacket.hasMarker()) == true) {
    buffer.setFlags(buffer.getFlags() | Buffer.FLAG_RTP_MARKER);
  }
  buffer.setTimeStamp(rtpTimestamp);
  millis=rtpPacket.getRtpdumpTimestamp() - this.timeLastRead;
  if (millis > 0) {
    try {
      Thread.sleep(millis);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  this.timeLastRead=rtpPacket.getRtpdumpTimestamp();
}

Fixed version (ground truth):
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long millis=0;
  Format format;
  format=buffer.getFormat();
  if (format == null) {
    format=getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RTPPacket rtpPacket=ivfFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(0);
  buffer.setLength(data.length);
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  if (lastReadWasMarked == true) {
    rtpTimestamp=System.nanoTime();
  }
  if ((lastReadWasMarked=rtpPacket.hasMarker()) == true) {
    buffer.setFlags(buffer.getFlags() | Buffer.FLAG_RTP_MARKER);
  }
  buffer.setTimeStamp(rtpTimestamp);
  millis=rtpPacket.getRtpdumpTimestamp() - this.timeLastRead;
  if (millis > 0) {
    try {
      Thread.sleep(millis);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  this.timeLastRead=rtpPacket.getRtpdumpTimestamp();
}
Program: 86387
Project: 86387
Buggy source:
/** 
 * Connect to the XMPP server then to the MUC chatroom.
 * @throws XMPPException if the connection to the XMPP server goes wrong
 */
public void start() throws XMPPException {
  connection.connect();
  connection.loginAnonymously();
  String roomURL=serverInfo.getRoomName() + "String_Node_Str" + serverInfo.getMUCDomain();
  muc=new MultiUserChat(connection,roomURL);
  while (true) {
    try {
      muc.join(username);
    }
 catch (    XMPPException e) {
      if (e.getXMPPError().getCode() == 409) {
        username=username + '_';
        continue;
      }
 else       throw e;
    }
    break;
  }
  muc.sendMessage("String_Node_Str");
  Packet presencePacket=new Presence(Presence.Type.available);
  presencePacket.setTo(roomURL);
  presencePacket.addExtension(new Nick(username));
  connection.sendPacket(presencePacket);
}

Fixed version (ground truth):
/** 
 * Connect to the XMPP server then to the MUC chatroom.
 * @throws XMPPException if the connection to the XMPP server goes wrong
 */
public void start() throws XMPPException {
  connection.connect();
  connection.loginAnonymously();
  String roomURL=serverInfo.getRoomName() + "String_Node_Str" + serverInfo.getMUCDomain();
  muc=new MultiUserChat(connection,roomURL);
  while (true) {
    try {
      muc.join(username);
    }
 catch (    XMPPException e) {
      if (e.getXMPPError().getCode() == 409) {
        username=username + '_';
        continue;
      }
 else       throw e;
    }
    break;
  }
  muc.sendMessage("String_Node_Str");
  Packet presencePacket=new Presence(Presence.Type.available);
  presencePacket.setTo(roomURL + "String_Node_Str" + username);
  presencePacket.addExtension(new Nick(username));
  connection.sendPacket(presencePacket);
}
Program: 86389
Project: 86389
Buggy source:
/** 
 * Callback function used when a JingleIQ is received by the XMPP connector.
 * @param packet the packet received by the <tt>JingleSession</tt> 
 */
public void processPacket(Packet packet){
  JingleIQ jiq=(JingleIQ)packet;
  System.out.println("String_Node_Str");
  ackJingleIQ(jiq);
switch (jiq.getAction()) {
case SESSION_INITIATE:
    sessionInitiate=jiq;
  acceptJingleSession();
break;
default :
System.out.println("String_Node_Str");
break;
}
}

Fixed version (ground truth):
/** 
 * Callback function used when a JingleIQ is received by the XMPP connector.
 * @param packet the packet received by the <tt>JingleSession</tt> 
 */
public void processPacket(Packet packet){
  JingleIQ jiq=(JingleIQ)packet;
  System.out.println("String_Node_Str");
  ackJingleIQ(jiq);
switch (jiq.getAction()) {
case SESSION_INITIATE:
    sessionInitiate=jiq;
  acceptJingleSession();
break;
case ADDSOURCE:
break;
case REMOVESOURCE:
break;
default :
System.out.println("String_Node_Str");
break;
}
}
Program: 86391
Project: 86391
Buggy source:
/** 
 * {@inheritDoc}Overrides the super implementation to initialize a <tt>CaptureDevice</tt> without asking FMJ to initialize one for a <tt>CaptureDeviceInfo</tt>.
 */
@Override protected CaptureDevice createCaptureDevice(){
  return new DataSource(getCaptureDeviceInfo());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}Overrides the super implementation to initialize a <tt>CaptureDevice</tt> without asking FMJ to initialize one for a <tt>CaptureDeviceInfo</tt>.
 */
@Override protected CaptureDevice createCaptureDevice(){
  DataSource captureDevice=new DataSource();
  captureDevice.setLocator(getCaptureDeviceInfo().getLocator());
  try {
    captureDevice.connect();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (captureDevice instanceof AbstractPullBufferCaptureDevice) {
    ((AbstractPullBufferCaptureDevice)captureDevice).setCaptureDeviceInfo(getCaptureDeviceInfo());
  }
  return captureDevice;
}
Program: 86392
Project: 86392
Buggy source:
public IVFMediaDevice(String filename){
  super(new CaptureDeviceInfo("String_Node_Str",new MediaLocator("String_Node_Str" + filename),IVFMediaDevice.SUPPORTED_FORMATS),MediaType.VIDEO);
}

Fixed version (ground truth):
public IVFMediaDevice(String filename){
  super(new CaptureDeviceInfo(filename,new MediaLocator("String_Node_Str" + filename),IVFMediaDevice.SUPPORTED_FORMATS),MediaType.VIDEO);
}
Program: 86393
Project: 86393
Buggy source:
/** 
 * Initializes a new <tt>ImageStream</tt> instance which is to have a specific <tt>FormatControl</tt>
 * @param dataSource the <tt>DataSource</tt> which is creating the newinstance so that it becomes one of its <tt>streams</tt>
 * @param formatControl the <tt>FormatControl</tt> of the new instance whichis to specify the format in which it is to provide its media data
 */
IVFStream(DataSource dataSource,FormatControl formatControl){
  super(dataSource,formatControl);
  this.ivfFileReader=new IVFFileReader(dataSource.getCaptureDeviceInfo().getLocator().getRemainder());
  this.FRAMERATE=((VideoFormat)getFormat()).getFrameRate();
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>ImageStream</tt> instance which is to have a specific <tt>FormatControl</tt>
 * @param dataSource the <tt>DataSource</tt> which is creating the newinstance so that it becomes one of its <tt>streams</tt>
 * @param formatControl the <tt>FormatControl</tt> of the new instance whichis to specify the format in which it is to provide its media data
 */
IVFStream(DataSource dataSource,FormatControl formatControl){
  super(dataSource,formatControl);
  this.ivfFileReader=new IVFFileReader(dataSource.getLocator().getRemainder());
  this.FRAMERATE=((VideoFormat)getFormat()).getFrameRate();
}
Program: 86394
Project: 86394
Buggy source:
/** 
 * Instantiates a <tt>JingleSession</tt> with a specified <tt>username</tt> that will connect to the XMPP server contained in <tt>hostInfo</tt>.
 * @param hostInfo the XMPP server informations needed for the connection.
 * @param username the username used by this <tt>JingleSession</tt> in theconnection.
 */
public JingleSession(HostInfo hostInfo,String username){
  this.serverInfo=hostInfo;
  this.username=(username == null) ? "String_Node_Str" : username;
  ProviderManager manager=ProviderManager.getInstance();
  manager.addExtensionProvider(MediaProvider.ELEMENT_NAME,MediaProvider.NAMESPACE,new MediaProvider());
  manager.addExtensionProvider(SsrcProvider.ELEMENT_NAME,SsrcProvider.NAMESPACE,new SsrcProvider());
  manager.addIQProvider(JingleIQ.ELEMENT_NAME,JingleIQ.NAMESPACE,new JingleIQProvider());
  config=new ConnectionConfiguration(serverInfo.getXMPPHostname(),serverInfo.getPort(),serverInfo.getXMPPDomain());
  connection=new XMPPConnection(config);
  connection.addPacketListener(this,new PacketFilter(){
    public boolean accept(    Packet packet){
      return (packet instanceof JingleIQ);
    }
  }
);
  config.setDebuggerEnabled(true);
}

Fixed version (ground truth):
/** 
 * Instantiates a <tt>JingleSession</tt> with a specified <tt>username</tt> that will connect to the XMPP server contained in <tt>hostInfo</tt>.
 * @param hostInfo the XMPP server informations needed for the connection.
 * @param username the username used by this <tt>JingleSession</tt> in theconnection.
 */
public JingleSession(HostInfo hostInfo,String username){
  this.serverInfo=hostInfo;
  this.username=(username == null) ? "String_Node_Str" : username;
  ProviderManager manager=ProviderManager.getInstance();
  manager.addExtensionProvider(MediaProvider.ELEMENT_NAME,MediaProvider.NAMESPACE,new MediaProvider());
  manager.addExtensionProvider(SsrcProvider.ELEMENT_NAME,SsrcProvider.NAMESPACE,new SsrcProvider());
  manager.addIQProvider(JingleIQ.ELEMENT_NAME,JingleIQ.NAMESPACE,new JingleIQProvider());
  config=new ConnectionConfiguration(serverInfo.getXMPPHostname(),serverInfo.getPort(),serverInfo.getXMPPDomain());
  connection=new XMPPConnection(config);
  connection.addPacketListener(this,new PacketFilter(){
    public boolean accept(    Packet packet){
      return (packet instanceof JingleIQ);
    }
  }
);
}
Program: 86395
Project: 86395
Buggy source:
public byte[] getNextFrame(boolean loopFile) throws IOException {
  if ((loopFile == true) && (frameNo >= header.getNumberOfFramesInFile())) {
    stream.seek(header.getHeaderLengh());
    frameNo=0;
  }
  byte[] data;
  int frameSizeInBytes;
  frameSizeInBytes=changeEndianness(stream.readInt());
  stream.skipBytes(8);
  data=new byte[frameSizeInBytes];
  stream.read(data);
  return data;
}

Fixed version (ground truth):
public byte[] getNextFrame(boolean loopFile) throws IOException {
  if ((loopFile == true) && (frameNo >= header.getNumberOfFramesInFile())) {
    stream.seek(header.getHeaderLengh());
    frameNo=0;
  }
  byte[] data;
  int frameSizeInBytes;
  frameSizeInBytes=changeEndianness(stream.readInt());
  stream.skipBytes(8);
  data=new byte[frameSizeInBytes];
  stream.read(data);
  frameNo++;
  return data;
}
Program: 86396
Project: 86396
Buggy source:
/** 
 * Instantiates a <tt>JingleSession</tt> with a specified <tt>username</tt> that will connect to the XMPP server contained in <tt>hostInfo</tt>.
 * @param hostInfo the XMPP server informations needed for the connection.
 * @param username the username used by this <tt>JingleSession</tt> in theconnection.
 */
public JingleSession(HostInfo hostInfo,String username){
  this.serverInfo=hostInfo;
  this.username=(username == null) ? "String_Node_Str" : username;
  config=new ConnectionConfiguration(serverInfo.getXMPPHostname(),serverInfo.getPort(),serverInfo.getXMPPDomain());
  connection=new XMPPConnection(config);
  connection.addPacketListener(this,new PacketFilter(){
    public boolean accept(    Packet packet){
      return (packet instanceof JingleIQ);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Instantiates a <tt>JingleSession</tt> with a specified <tt>username</tt> that will connect to the XMPP server contained in <tt>hostInfo</tt>.
 * @param hostInfo the XMPP server informations needed for the connection.
 * @param username the username used by this <tt>JingleSession</tt> in theconnection.
 */
public JingleSession(HostInfo hostInfo,String username){
  this.serverInfo=hostInfo;
  this.username=(username == null) ? "String_Node_Str" : username;
  config=new ConnectionConfiguration(serverInfo.getXMPPHostname(),serverInfo.getPort(),serverInfo.getXMPPDomain());
  connection=new XMPPConnection(config);
  connection.addPacketListener(this,new PacketFilter(){
    public boolean accept(    Packet packet){
      return (packet instanceof JingleIQ);
    }
  }
);
  config.setDebuggerEnabled(true);
}
Program: 86398
Project: 86398
Buggy source:
public static Map<String,MediaStream> generateMediaStream(Map<String,MediaFormat> mediaFormatMap,DynamicPayloadTypeRegistry ptRegistry){
  MediaStream stream=null;
  MediaFormat format=null;
  MediaDevice device=null;
  Map<String,MediaStream> mediaStreamMap=new HashMap<String,MediaStream>();
  MediaService mediaService=LibJitsi.getMediaService();
  for (  String mediaName : mediaFormatMap.keySet()) {
    format=mediaFormatMap.get(mediaName);
    if (format == null)     continue;
    stream=mediaService.createMediaStream(null,format.getMediaType(),mediaService.createSrtpControl(SrtpControlType.DTLS_SRTP));
    device=selectMediaDevice(format.getMediaType().toString());
    if (device != null)     stream.setDevice(device);
    stream.setFormat(format);
    stream.setName(mediaName);
    stream.setRTPTranslator(mediaService.createRTPTranslator());
    if (format.getRTPPayloadType() == MediaFormat.RTP_PAYLOAD_TYPE_UNKNOWN) {
      stream.addDynamicRTPPayloadType(ptRegistry.getPayloadType(format),format);
    }
    if (format.getMediaType() == MediaType.VIDEO)     stream.addDynamicRTPPayloadType((byte)116,format);
    mediaStreamMap.put(mediaName,stream);
  }
  return mediaStreamMap;
}

Fixed version (ground truth):
public static Map<String,MediaStream> generateMediaStream(Map<String,MediaFormat> mediaFormatMap,DynamicPayloadTypeRegistry ptRegistry){
  MediaStream stream=null;
  MediaFormat format=null;
  MediaDevice device=null;
  Map<String,MediaStream> mediaStreamMap=new HashMap<String,MediaStream>();
  MediaService mediaService=LibJitsi.getMediaService();
  for (  String mediaName : mediaFormatMap.keySet()) {
    format=mediaFormatMap.get(mediaName);
    if (format == null)     continue;
    stream=mediaService.createMediaStream(null,format.getMediaType(),mediaService.createSrtpControl(SrtpControlType.DTLS_SRTP));
    device=selectMediaDevice(format.getMediaType().toString());
    if (device != null)     stream.setDevice(device);
    stream.setFormat(format);
    stream.setName(mediaName);
    stream.setRTPTranslator(mediaService.createRTPTranslator());
    stream.setDirection(MediaDirection.SENDONLY);
    if (format.getRTPPayloadType() == MediaFormat.RTP_PAYLOAD_TYPE_UNKNOWN) {
      stream.addDynamicRTPPayloadType(ptRegistry.getPayloadType(format),format);
    }
    if (format.getMediaType() == MediaType.VIDEO)     stream.addDynamicRTPPayloadType((byte)116,format);
    mediaStreamMap.put(mediaName,stream);
  }
  return mediaStreamMap;
}