nus-yam/ex-repair huggingface dataset:
Program: 145929
Project: 145929
Buggy source:
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) & (rules.canExecuteOnTestProjectRule(explorer) & ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}

Fixed version (ground truth):
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) && (rules.canExecuteOnTestProjectRule(explorer) & ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}
Program: 145930
Project: 145930
Buggy source:
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) & (rules.canExecuteOnTestProjectRule(explorer) & ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}

Fixed version (ground truth):
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) && (rules.canExecuteOnTestProjectRule(explorer) & ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}
Program: 145932
Project: 145932
Buggy source:
public double modularity(){
  double q=0.;
  double m2=(double)g.getTotal_weight();
  for (int i=0; i < size; i++) {
    if (tot.get(i) > 0)     q+=(double)in.get(i) / m2 - ((double)tot.get(i) / m2) * ((double)tot.get(i) / m2);
  }
  return q;
}

Fixed version (ground truth):
public double modularity(){
  double q=0.;
  double m2=(double)g.getTotal_weight();
  for (int i=0; i < size; i++) {
    if (tot.get(i) > 0) {
      double tmp=(double)in.get(i) / m2 - ((double)tot.get(i) / m2) * ((double)tot.get(i) / m2);
      if (tmp > 1) {
        System.out.println("String_Node_Str");
      }
      q+=tmp;
      if (q > 1) {
        System.out.println("String_Node_Str");
      }
    }
  }
  return q;
}
Program: 145933
Project: 145933
Buggy source:
public void neigh_comm(int node){
  for (int i=0; i < neigh_last; i++) {
    ;
    neigh_weight.set(neigh_pos.get(i),-1.0);
  }
  neigh_last=0;
  Pair<Integer,Integer> p=g.neighbors(node);
  long deg=g.nb_neighbors(node);
  neigh_pos.set(0,n2c.get(node));
  neigh_weight.set(neigh_pos.get(0),0.0);
  neigh_last=1;
  for (int i=0; i < deg; i++) {
    int neigh=g.getLinks().getList().get(p.getElement0() + i);
    ;
    int neigh_comm=n2c.get(neigh);
    double neigh_w=(g.getWeights().size() == 0) ? 1. : g.getWeights().getList().get(p.getElement1() + i);
    ;
    if (neigh != node) {
      if (neigh_weight.get(neigh_comm) == -1) {
        neigh_weight.set(neigh_comm,0.0);
        neigh_pos.set(neigh_last++,neigh_comm);
      }
      neigh_weight.set(neigh_comm,neigh_weight.get(neigh_comm) + neigh_w);
    }
  }
  if (g.isContainRemote()) {
    AbstractMap.SimpleEntry<Vector<Integer>,Vector<Float>> p1=g.remote_neighbors(node);
    deg=g.nb_remote_neighbors(node);
    for (int i=0; i < deg; i++) {
      int neigh=p1.getKey().getList().get(i);
      int neigh_comm=n2c.get(neigh);
      double neigh_w=(g.getWeights().size() == 0) ? 1.0 : p1.getValue().getList().get(i);
      if (neigh != node) {
        if (neigh_weight.get(neigh_comm) == -1) {
          neigh_weight.set(neigh_comm,0.0);
          neigh_pos.set(neigh_last++,neigh_comm);
        }
        neigh_weight.set(neigh_comm,neigh_weight.get(neigh_comm) + neigh_w);
      }
    }
  }
}

Fixed version (ground truth):
public void neigh_comm(int node){
  for (int i=0; i < neigh_last; i++) {
    ;
    neigh_weight.set(neigh_pos.get(i),-1.0);
  }
  neigh_last=0;
  Pair<Integer,Integer> p=g.neighbors(node);
  long deg=g.nb_neighbors(node);
  neigh_pos.set(0,n2c.get(node));
  neigh_weight.set(neigh_pos.get(0),0.0);
  neigh_last=1;
  for (int i=0; i < deg; i++) {
    int neigh=g.getLinks().getList().get(p.getElement0() + i);
    ;
    int neigh_comm=n2c.get(neigh);
    double neigh_w=(g.getWeights().size() == 0) ? 1. : g.getWeights().getList().get(p.getElement1() + i);
    ;
    if (neigh != node) {
      if (neigh_weight.get(neigh_comm) == -1) {
        neigh_weight.set(neigh_comm,0.0);
        neigh_pos.set(neigh_last++,neigh_comm);
      }
      neigh_weight.set(neigh_comm,neigh_weight.get(neigh_comm) + neigh_w);
    }
  }
  if (g.isContainRemote() && g.getRemoteEdges().containsKey(node)) {
    AbstractMap.SimpleEntry<Vector<Integer>,Vector<Float>> p1=g.remote_neighbors(node);
    deg=g.nb_remote_neighbors(node);
    for (int i=0; i < deg; i++) {
      int neigh=p1.getKey().getList().get(i);
      int neigh_comm=n2c.get(neigh);
      double neigh_w=(g.getWeights().size() == 0) ? 1.0 : p1.getValue().getList().get(i);
      if (neigh != node) {
        if (neigh_weight.get(neigh_comm) == -1) {
          neigh_weight.set(neigh_comm,0.0);
          neigh_pos.set(neigh_last++,neigh_comm);
        }
        neigh_weight.set(neigh_comm,neigh_weight.get(neigh_comm) + neigh_w);
      }
    }
  }
}
Program: 145934
Project: 145934
Buggy source:
public void display_partition(){
  ArrayList<Integer> renumber=new ArrayList<Integer>(size);
  Util.initArrayList(renumber,-1);
  for (int node=0; node < size; node++) {
    renumber.set(n2c.get(node),renumber.get(n2c.get(node)) + 1);
  }
  int fin=0;
  for (int i=0; i < size; i++)   if (renumber.get(i) != -1) {
    renumber.set(i,fin++);
  }
  for (int i=0; i < size; i++) {
    System.out.println("String_Node_Str" + i + "String_Node_Str"+ renumber.get(n2c.get(i)));
  }
}

Fixed version (ground truth):
public void display_partition(){
  ArrayList<Integer> renumber=new ArrayList<Integer>(size);
  Util.initArrayList(renumber,size,-1);
  for (int node=0; node < size; node++) {
    renumber.set(n2c.get(node),renumber.get(n2c.get(node)) + 1);
  }
  int fin=0;
  for (int i=0; i < size; i++)   if (renumber.get(i) != -1) {
    renumber.set(i,fin++);
  }
  for (int i=0; i < size; i++) {
    System.out.println("String_Node_Str" + i + "String_Node_Str"+ renumber.get(n2c.get(i)));
  }
}
Program: 145935
Project: 145935
Buggy source:
public Community(Graph g,int nb_pass,double min_modularity){
  this.g=g;
  size=g.getNb_nodes();
  neigh_weight=new ArrayList<Double>(size);
  Util.initArrayList((ArrayList<Double>)neigh_weight,-1.0);
  neigh_pos=new ArrayList<Integer>(size);
  Util.initArrayList((ArrayList<Integer>)neigh_pos,-1);
  neigh_last=0;
  n2c=new ArrayList<Integer>(size);
  in=new ArrayList<Double>(size);
  tot=new ArrayList<Double>(size);
  for (int i=0; i < size; i++) {
    n2c.add(i,i);
    tot.add(i,g.weighted_degree(i));
    in.add(i,g.nb_selfloops(i));
  }
  this.nb_pass=nb_pass;
  this.min_modularity=min_modularity;
}

Fixed version (ground truth):
public Community(Graph g,int nb_pass,double min_modularity){
  this.g=g;
  size=g.getNb_nodes();
  neigh_weight=new ArrayList<Double>(size);
  Util.initArrayList((ArrayList<Double>)neigh_weight,size,-1.0);
  neigh_pos=new ArrayList<Integer>(size);
  Util.initArrayList((ArrayList<Integer>)neigh_pos,size,-1);
  neigh_last=0;
  n2c=new ArrayList<Integer>(size);
  in=new ArrayList<Double>(size);
  tot=new ArrayList<Double>(size);
  for (int i=0; i < size; i++) {
    n2c.add(i);
    tot.add(g.weighted_degree(i) + g.weighted_degree_wremote(i));
    in.add(g.nb_selfloops(i));
  }
  this.nb_pass=nb_pass;
  this.min_modularity=min_modularity;
}
Program: 145936
Project: 145936
Buggy source:
@Override public void onCardMoving(int position,float progress){
  for (int i=0; i < cards.size(); i++) {
    if (data.isEmpty()) {
      cards.get(i).updateProgress(progress);
    }
 else {
      if (i != 0 && i != position)       cards.get(i).updateProgress(progress);
    }
  }
}

Fixed version (ground truth):
@Override public void onCardMoving(int position,float progress){
  for (int i=0; i < cards.size(); i++) {
    if (i != cards.size() - 1 && i != position) {
      if (data.isEmpty()) {
        cards.get(i).updateProgress(progress);
      }
 else {
        if (i != 0)         cards.get(i).updateProgress(progress);
      }
    }
  }
}
Program: 145937
Project: 145937
Buggy source:
/** 
 * Scans given file for tabs, very useful when loading YAML configuration. Any configuration loaded using the API in this class is automatically scanned. Please note that this only works for files within the HubBasics plugin folder.
 * @param file Path of file
 */
public void scan(String file){
  Scanner scanner=null;
  int lineNumber=0;
  String line;
  try {
    scanner=new Scanner(new File(HubBasics.getInstance().getDataFolder(),file));
    while (scanner.hasNextLine()) {
      line=scanner.nextLine();
      lineNumber++;
      if (line.indexOf("String_Node_Str") != -1) {
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str");
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str" + file+ "String_Node_Str"+ lineNumber+ "String_Node_Str");
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str");
        throw new IllegalArgumentException("String_Node_Str" + file + "String_Node_Str"+ line+ "String_Node_Str");
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    if (scanner != null)     scanner.close();
  }
}

Fixed version (ground truth):
/** 
 * Scans given file for tabs, very useful when loading YAML configuration. Any configuration loaded using the API in this class is automatically scanned. Please note that this only works for files within the HubBasics plugin folder.
 * @param filePath Path of file
 */
public void scan(String filePath){
  File file=new File(HubBasics.getInstance().getDataFolder(),filePath);
  if (!file.exists())   return;
  Scanner scanner=null;
  int lineNumber=0;
  String line;
  try {
    scanner=new Scanner(file);
    while (scanner.hasNextLine()) {
      line=scanner.nextLine();
      lineNumber++;
      if (line.indexOf("String_Node_Str") != -1) {
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str");
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str" + filePath+ "String_Node_Str"+ lineNumber+ "String_Node_Str");
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str");
        throw new IllegalArgumentException("String_Node_Str" + filePath + "String_Node_Str"+ line+ "String_Node_Str");
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    if (scanner != null)     scanner.close();
  }
}
Program: 145938
Project: 145938
Buggy source:
public ModuleManager(){
  moduleMap.put(ModuleEnum.DOUBLE_JUMP,new DoubleJump());
  moduleMap.put(ModuleEnum.JUMP_PADS,new JumpPads());
  moduleMap.put(ModuleEnum.ANTI_VOID,new AntiVoid());
  moduleMap.put(ModuleEnum.FIXED_WEATHER,new FixedWeather());
  moduleMap.put(ModuleEnum.KEEP_FOOD,new KeepFood());
  moduleMap.put(ModuleEnum.KEEP_HEALTH,new KeepHealth());
  moduleMap.put(ModuleEnum.CONNECTION_MESSAGES,new ConnectionMessages());
  moduleMap.put(ModuleEnum.ADVANCED_MOTD,new AdvancedMOTD());
  moduleMap.put(ModuleEnum.COMMAND_OVERRIDE,new CommandOverride());
  moduleMap.put(ModuleEnum.HOLOGRAMS,new CustomHolograms());
  moduleMap.put(ModuleEnum.AUTOMATED_BROADCASTS,new AutomatedBroadcast());
  registerListeners();
  onEnable();
}

Fixed version (ground truth):
public ModuleManager(){
  moduleMap.put(ModuleEnum.DOUBLE_JUMP,new DoubleJump());
  moduleMap.put(ModuleEnum.JUMP_PADS,new JumpPads());
  moduleMap.put(ModuleEnum.ANTI_VOID,new AntiVoid());
  moduleMap.put(ModuleEnum.FIXED_WEATHER,new FixedWeather());
  moduleMap.put(ModuleEnum.KEEP_FOOD,new KeepFood());
  moduleMap.put(ModuleEnum.KEEP_HEALTH,new KeepHealth());
  moduleMap.put(ModuleEnum.CONNECTION_MESSAGES,new ConnectionMessages());
  moduleMap.put(ModuleEnum.ADVANCED_MOTD,new AdvancedMOTD());
  moduleMap.put(ModuleEnum.COMMAND_OVERRIDE,new CommandOverride());
  moduleMap.put(ModuleEnum.HOLOGRAMS,new CustomHolograms());
  moduleMap.put(ModuleEnum.AUTOMATED_BROADCASTS,new AutomatedBroadcast());
  if (HubBasics.getInstance().getServerVersion().contains("String_Node_Str") || HubBasics.getInstance().getServerVersion().contains("String_Node_Str"))   moduleMap.put(ModuleEnum.BOSSBAR_MESSAGES,new BossBarMessages());
  registerListeners();
  onEnable();
}
Program: 145939
Project: 145939
Buggy source:
@EventHandler public void onPlayerPing(ServerListPingEvent event){
  event.setMotd(this.motds.get(this.current));
}

Fixed version (ground truth):
@EventHandler public void onPlayerPing(ServerListPingEvent event){
  if (!enabled)   return;
  event.setMotd(this.motds.get(this.current));
}
Program: 145940
Project: 145940
Buggy source:
@Override public void onEnable(){
  List<String> rawMotds=pl.getPluginConfiguration().getStringList(ConfigurationKey.ADVANCED_MOTD_MOTDS);
  rawMotds.stream().forEach(s -> this.motds.add(ChatColor.translateAlternateColorCodes('&',s)));
  int switchRate=pl.getPluginConfiguration().getInt(ConfigurationKey.ADVANCED_MOTD_SWITCHRATE) * 20;
  if (this.motds.size() > 1)   Bukkit.getScheduler().scheduleSyncRepeatingTask(pl,() -> {
    if (this.current + 1 == motds.size()) {
      this.current=0;
    }
 else {
      this.current++;
    }
  }
,switchRate,switchRate);
}

Fixed version (ground truth):
@Override public void onEnable(){
  this.enabled=getBoolean(ConfigurationKey.ADVANCED_MOTD_ENABLED);
  if (!enabled)   return;
  List<String> rawMotds=pl.getPluginConfiguration().getStringList(ConfigurationKey.ADVANCED_MOTD_MOTDS);
  rawMotds.stream().forEach(s -> this.motds.add(ChatColor.translateAlternateColorCodes('&',s)));
  int switchRate=pl.getPluginConfiguration().getInt(ConfigurationKey.ADVANCED_MOTD_SWITCHRATE) * 20;
  if (this.motds.size() > 1)   Bukkit.getScheduler().scheduleSyncRepeatingTask(pl,() -> {
    if (this.current + 1 == motds.size()) {
      this.current=0;
    }
 else {
      this.current++;
    }
  }
,switchRate,switchRate);
}
Program: 145941
Project: 145941
Buggy source:
@Override public void onEnable(){
  this.enable=getBoolean(ConfigurationKey.AUTOMATED_BROADCASTS_ENABLED);
  this.random=getBoolean(ConfigurationKey.AUTOMATED_BROADCASTS_RANDOM);
  this.timing=getConfig().getInt(ConfigurationKey.AUTOMATED_BROADCASTS_TIMING) * 20L;
  this.messages=getConfig().getStringList(ConfigurationKey.AUTOMATED_BROADCASTS_MESSAGES).stream().map(s -> ChatColor.translateAlternateColorCodes('&',s)).collect(Collectors.toList());
  if (!enable)   return;
  if (timing <= 0) {
    Bukkit.getConsoleSender().sendMessage("String_Node_Str");
    return;
  }
  Bukkit.getScheduler().scheduleSyncRepeatingTask(pl,new Runnable(){
    Random rand=new Random();
    int index=0;
    @Override public void run(){
      if (random) {
        Bukkit.broadcastMessage(messages.get(rand.nextInt(messages.size())));
      }
 else {
        Bukkit.broadcastMessage(messages.get(index));
        index++;
        if (index >= messages.size()) {
          index=0;
        }
      }
    }
  }
,timing,timing);
}

Fixed version (ground truth):
@Override public void onEnable(){
  this.enable=getBoolean(ConfigurationKey.AUTOMATED_BROADCASTS_ENABLED);
  this.random=getBoolean(ConfigurationKey.AUTOMATED_BROADCASTS_RANDOM);
  this.timing=getConfig().getInt(ConfigurationKey.AUTOMATED_BROADCASTS_TIMING) * 20L;
  this.messages=getConfig().getStringList(ConfigurationKey.AUTOMATED_BROADCASTS_MESSAGES).stream().map(s -> ChatColor.translateAlternateColorCodes('&',s)).collect(Collectors.toList());
  if (!enable)   return;
  if (timing <= 0) {
    Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  Bukkit.getScheduler().scheduleSyncRepeatingTask(pl,new Runnable(){
    Random rand=new Random();
    int index=0;
    @Override public void run(){
      if (random) {
        Bukkit.broadcastMessage(messages.get(rand.nextInt(messages.size())));
      }
 else {
        Bukkit.broadcastMessage(messages.get(index));
        index++;
        if (index >= messages.size()) {
          index=0;
        }
      }
    }
  }
,timing,timing);
}
Program: 145942
Project: 145942
Buggy source:
/** 
 * Formats the given message (can return null if message equals to "null")
 * @param message       The message
 * @param commandSender (Optional) CommandSender
 * @return The formatted message
 */
public static String format(String message,CommandSender commandSender){
  if (message.equalsIgnoreCase("String_Node_Str")) {
    return null;
  }
  message=org.bukkit.ChatColor.translateAlternateColorCodes('&',message);
  if (commandSender != null) {
    message=message.replaceAll("String_Node_Str",commandSender.getName());
    message=message.replaceAll("String_Node_Str",commandSender.getName());
  }
  return message;
}

Fixed version (ground truth):
/** 
 * Formats the given message (can return null if message equals to "null")
 * @param message       The message
 * @param commandSender (Optional) CommandSender
 * @return The formatted message
 */
public static String format(String message,CommandSender commandSender){
  if (message == null || message.equalsIgnoreCase("String_Node_Str"))   return null;
  message=org.bukkit.ChatColor.translateAlternateColorCodes('&',message);
  if (commandSender != null) {
    message=message.replaceAll("String_Node_Str",commandSender.getName());
    message=message.replaceAll("String_Node_Str",commandSender.getName());
  }
  return message;
}
Program: 145943
Project: 145943
Buggy source:
public static void notifyUpdate(){
  Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.YELLOW + "String_Node_Str");
  Bukkit.getServer().getConsoleSender().sendMessage("String_Node_Str");
  Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.YELLOW + "String_Node_Str");
  Bukkit.getServer().getConsoleSender().sendMessage("String_Node_Str");
  Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.YELLOW + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Easy-to-notice update notification
 */
public static void notifyUpdate(){
  Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "String_Node_Str");
  Bukkit.getConsoleSender().sendMessage("String_Node_Str");
  Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "String_Node_Str");
  Bukkit.getConsoleSender().sendMessage("String_Node_Str");
  Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "String_Node_Str");
}
Program: 145944
Project: 145944
Buggy source:
@Override public void removeDeletedMessages(){
  final EventList<StoredMessage> eventList=getMessageEventList();
  eventList.getReadWriteLock().writeLock().lock();
  try {
    final int count=countDeletedMessages(eventList);
    if (count == 0) {
      return;
    }
    final List<StoredMessage> retainedMessages=new ArrayList<>(eventList.size() - count);
    for (    StoredMessage msg : eventList) {
      if (msg.getReferenceCount() > 0) {
        retainedMessages.add(msg);
      }
 else {
        database.delete(msg);
      }
    }
    eventList.clear();
    messagesById.clear();
    addMessages(retainedMessages);
  }
  finally {
    eventList.getReadWriteLock().writeLock().unlock();
  }
}

Fixed version (ground truth):
@Override public void removeDeletedMessages(){
  final EventList<StoredMessage> eventList=getWritableMessageEventList();
  eventList.getReadWriteLock().writeLock().lock();
  try {
    final int count=countDeletedMessages(eventList);
    if (count == 0) {
      return;
    }
    final List<StoredMessage> retainedMessages=new ArrayList<>(eventList.size() - count);
    for (    StoredMessage msg : eventList) {
      if (msg.getReferenceCount() > 0) {
        retainedMessages.add(msg);
      }
 else {
        database.delete(msg);
      }
    }
    eventList.clear();
    messagesById.clear();
    addMessages(retainedMessages);
  }
  finally {
    eventList.getReadWriteLock().writeLock().unlock();
  }
}
Program: 145945
Project: 145945
Buggy source:
public void addMessage(StoredMessage message){
  try {
    writeLockMessageEventList().add(message);
    messagesById.put(message.getMessageId(),message);
  }
  finally {
    writeUnlockMessageEventList();
    database.commit();
  }
  getPropertyChangeSupport().firePropertyChange("String_Node_Str",null,null);
}

Fixed version (ground truth):
public void addMessage(StoredMessage message){
  try {
    writeLockMessageEventList().add(message);
    messagesById.put(message.getMessageId(),message);
    database.store(messagesById);
  }
  finally {
    writeUnlockMessageEventList();
    database.commit();
  }
  getPropertyChangeSupport().firePropertyChange("String_Node_Str",null,null);
}
Program: 145946
Project: 145946
Buggy source:
private EventList<StoredMessage> writeLockMessageEventList(){
  activate(ActivationPurpose.WRITE);
  final EventList<StoredMessage> eventList=getMessageEventList();
  eventList.getReadWriteLock().writeLock().lock();
  return eventList;
}

Fixed version (ground truth):
private EventList<StoredMessage> writeLockMessageEventList(){
  activate(ActivationPurpose.WRITE);
  final EventList<StoredMessage> eventList=getWritableMessageEventList();
  eventList.getReadWriteLock().writeLock().lock();
  return eventList;
}
Program: 145947
Project: 145947
Buggy source:
@SuppressWarnings("String_Node_Str") public EventList<StoredMessage> getMessageEventList(){
  activate(ActivationPurpose.READ);
synchronized (allMessages) {
    if (messageEventList == null) {
      messageEventList=new BasicEventList<>(allMessages);
    }
    return messageEventList;
  }
}

Fixed version (ground truth):
public EventList<StoredMessage> getMessageEventList(){
synchronized (allMessages) {
    if (readOnlyEventList == null) {
      readOnlyEventList=GlazedLists.readOnlyList(getWritableMessageEventList());
    }
    return readOnlyEventList;
  }
}
Program: 145948
Project: 145948
Buggy source:
public void addMessages(Collection<StoredMessage> messages){
  try {
    writeLockMessageEventList().addAll(messages);
    for (    StoredMessage sm : messages) {
      messagesById.put(sm.getMessageId(),sm);
    }
  }
  finally {
    writeUnlockMessageEventList();
  }
  getPropertyChangeSupport().firePropertyChange("String_Node_Str",null,null);
}

Fixed version (ground truth):
public void addMessages(Collection<StoredMessage> messages){
  try {
    writeLockMessageEventList().addAll(messages);
    for (    StoredMessage sm : messages) {
      messagesById.put(sm.getMessageId(),sm);
    }
    database.store(messagesById);
  }
  finally {
    writeUnlockMessageEventList();
  }
  getPropertyChangeSupport().firePropertyChange("String_Node_Str",null,null);
}
Program: 145949
Project: 145949
Buggy source:
private void writeUnlockMessageEventList(){
  getMessageEventList().getReadWriteLock().writeLock().unlock();
}

Fixed version (ground truth):
private void writeUnlockMessageEventList(){
  database.store(allMessages);
  getWritableMessageEventList().getReadWriteLock().writeLock().unlock();
}
Program: 145950
Project: 145950
Buggy source:
@Override public void appendMessage(StoredMessage message,long messageUID){
  activate(ActivationPurpose.WRITE);
  final EventList<StoredMessage> eventList=storageFolder.getMessageEventList();
  eventList.getReadWriteLock().writeLock().lock();
  try {
    storageFolder.addMessage(message);
    uidMap.add(messageUID);
    account.getMailAccount().addMessage(message);
    database.commit();
  }
  finally {
    eventList.getReadWriteLock().writeLock().unlock();
  }
}

Fixed version (ground truth):
@Override public void appendMessage(StoredMessage message,long messageUID){
  activate(ActivationPurpose.WRITE);
  final EventList<StoredMessage> eventList=storageFolder.getMessageEventList();
  eventList.getReadWriteLock().writeLock().lock();
  try {
    storageFolder.addMessage(message);
    uidMap.add(messageUID);
    database.commit();
  }
  finally {
    eventList.getReadWriteLock().writeLock().unlock();
    account.getMailAccount().addMessage(message);
  }
}
Program: 145951
Project: 145951
Buggy source:
private void storeNewMessage(ExecutorService executor,IMAPMessage message) throws MessagingException, IOException {
  final long messageUID=remoteFolder.getUID(message);
  final StoredMessage storedMessage=imapMessageFactory.createFromJavamailMessage(account,message);
  executor.submit(new StoreMessageTask(storedMessage,messageUID,localFolder,messageSearchIndex,javamailUtils,nymsAgent));
}

Fixed version (ground truth):
private void storeNewMessage(ExecutorService executor,IMAPMessage message) throws MessagingException, IOException {
  final long messageUID=remoteFolder.getUID(message);
  StoredMessage storedMessage=account.getMessageForMimeMessage(message);
  final boolean alreadyStored=(storedMessage != null);
  if (storedMessage == null) {
    storedMessage=imapMessageFactory.createFromJavamailMessage(account,message);
  }
  executor.submit(new StoreMessageTask(storedMessage,messageUID,localFolder,messageSearchIndex,javamailUtils,nymsAgent,alreadyStored));
}
Program: 145952
Project: 145952
Buggy source:
private static String getTextBodyFromBodyPart(MimeBodyPart part) throws MessagingException {
  final String type=part.getContentType();
  try {
    final Object content=part.getContent();
    if (content instanceof String) {
      if (type != null && type.contains("String_Node_Str")) {
        return (String)content;
      }
    }
 else     if (content instanceof MimeMultipart) {
      return getTextBodyFromMimeMultipart((MimeMultipart)content);
    }
  }
 catch (  IOException e) {
    logger.warning("String_Node_Str" + e);
  }
  return null;
}

Fixed version (ground truth):
private static String getTextBodyFromBodyPart(MimeBodyPart part) throws MessagingException {
  final String type=lowercaseUnlessNull(part.getContentType());
  final String disposition=lowercaseUnlessNull(part.getDisposition());
  try {
    final Object content=part.getContent();
    if (content instanceof String) {
      if (includeStringForTypeAndDisposition(type,disposition)) {
        return (String)content;
      }
 else {
        return null;
      }
    }
 else     if (content instanceof MimeMultipart) {
      return getTextBodyFromMimeMultipart((MimeMultipart)content);
    }
  }
 catch (  IOException e) {
    logger.warning("String_Node_Str" + e);
  }
  return null;
}
Program: 145953
Project: 145953
Buggy source:
public void displayIdentity(PublicIdentity publicIdentity,PrivateIdentity privateIdentity){
  final Image oldImage=keyImageLabel.getImage();
  if (oldImage != defaultImage) {
    oldImage.dispose();
  }
  final PublicKeyRenderer textRenderer=new PublicKeyRenderer(publicIdentity);
  final String text=textRenderer.renderPublicIdentity();
  keyInformationLabel.setText(text);
  final byte[] imageData=publicIdentity.getImageData();
  if (imageData == null || imageData.length == 0) {
    keyImageLabel.setImage(defaultImage);
  }
 else {
    keyImageLabel.setImage(ImageCache.getInstance().createAvatarImage(imageData));
  }
  this.publicIdentity=publicIdentity;
  this.privateIdentity=privateIdentity;
}

Fixed version (ground truth):
public void displayIdentity(PublicIdentity publicIdentity,PrivateIdentity privateIdentity){
  final Image oldImage=keyImageLabel.getImage();
  if (oldImage != defaultImage) {
    oldImage.dispose();
  }
  final PublicKeyRenderer textRenderer=new PublicKeyRenderer(publicIdentity);
  final String text=textRenderer.renderPublicIdentity();
  keyInformationLabel.setText(text);
  final byte[] imageData=publicIdentity.getImageData();
  if (imageData == null || imageData.length == 0) {
    keyImageLabel.setImage(defaultImage);
  }
 else {
    keyImageLabel.setImage(ImageCache.getInstance().createAvatarImage(imageData));
  }
  this.publicIdentity=publicIdentity;
  this.privateIdentity=privateIdentity;
  layout(true,true);
}
Program: 145955
Project: 145955
Buggy source:
protected void attemptAttack(){
  if (currentTarget == null)   return;
  double dx=currentTarget.posX - this.posX, dy=currentTarget.posY - this.posY, dz=currentTarget.posZ - this.posZ;
  if (!isSearching())   this.setSentryHeading(dx,dy,dz,1.0F);
  if (++tickSinceLastAttack > 5) {
    tickSinceLastAttack=0;
    if (!canEntityBeSeen(currentTarget)) {
      if (!rotationSet)       rotationYawSearch=rotationYawHead;
      rotationSet=true;
    }
 else {
      rotationSet=false;
      this.playSound("String_Node_Str",0.5F,1.0F);
      worldObj.spawnEntityInWorld(new EntityBullet(worldObj,this,currentTarget,5).setEntitySelector(selector));
    }
    if (currentTarget.getDistanceSqToEntity(this) > 400) {
      this.currentTarget=null;
      return;
    }
  }
  if (currentTarget.isDead || currentTarget.isEntityInvulnerable() || rand.nextFloat() <= 0.01)   this.currentTarget=null;
}

Fixed version (ground truth):
protected void attemptAttack(){
  if (currentTarget == null)   return;
  double dx=currentTarget.posX - this.posX, dy=currentTarget.posY - this.posY, dz=currentTarget.posZ - this.posZ;
  if (!isSearching())   this.setSentryHeading(dx,dy,dz,1.0F);
  if (++tickSinceLastAttack > 5) {
    tickSinceLastAttack=0;
    if (!canEntityBeSeen(currentTarget)) {
      if (!rotationSet)       rotationYawSearch=rotationYawHead;
      rotationSet=true;
    }
 else {
      rotationSet=false;
      this.playSound("String_Node_Str",0.5F,1.0F);
      worldObj.spawnEntityInWorld(new EntityBullet(worldObj,this,currentTarget,5,YOFFSET,currentTarget.height * 0.7F).setEntitySelector(selector));
    }
    if (currentTarget.getDistanceSqToEntity(this) > 400) {
      this.currentTarget=null;
      return;
    }
  }
  if (currentTarget.isDead || currentTarget.isEntityInvulnerable() || rand.nextFloat() <= 0.01)   this.currentTarget=null;
}
Program: 145956
Project: 145956
Buggy source:
public void sync(){
  if (worldObj.isRemote) {
    int entityid=dataWatcher.getWatchableObjectInt(15);
    Entity e=worldObj.getEntityByID(entityid);
    currentTarget=e;
    this.isActivated=dataWatcher.getWatchableObjectByte(16) > 0;
  }
 else {
    if (currentTarget != null)     dataWatcher.updateObject(15,currentTarget.getEntityId());
    dataWatcher.updateObject(16,Byte.valueOf((byte)(isActivated ? 0x1 : 0x0)));
  }
}

Fixed version (ground truth):
public void sync(){
  if (worldObj.isRemote) {
    int entityid=dataWatcher.getWatchableObjectInt(15);
    Entity e=entityid == 0 ? null : worldObj.getEntityByID(entityid);
    currentTarget=e;
    this.isActivated=dataWatcher.getWatchableObjectByte(16) == 1;
  }
 else {
    dataWatcher.updateObject(15,currentTarget == null ? 0 : currentTarget.getEntityId());
    dataWatcher.updateObject(16,Byte.valueOf((byte)(isActivated ? 1 : 0)));
  }
}
Program: 145957
Project: 145957
Buggy source:
/** 
 * 自定义的寻路函数，在最初的4秒无视玩家
 */
@Override protected Entity findPlayerToAttack(){
  AxisAlignedBB boundingBox=AxisAlignedBB.getBoundingBox(posX - 8.0,posY - 8.0,posZ - 8.0,posX + 8.0,posY + 8.0,posZ + 8.0);
  List<EntityLiving> list=worldObj.getEntitiesWithinAABBExcludingEntity(this,boundingBox,selector);
  EntityLiving entity=null;
  double distance=10000.0F;
  for (  EntityLiving s : list) {
    double dx=s.posX - posX, dy=s.posY - posY, dz=s.posZ - posZ;
    double d=Math.sqrt(dx * dx + dy * dy + dz * dz);
    if (d < distance) {
      entity=s;
      distance=d;
    }
  }
  if (entity == null)   return null;
  return entity;
}

Fixed version (ground truth):
/** 
 * 自定义的寻路函数，在最初的4秒无视玩家
 */
@Override protected Entity findPlayerToAttack(){
  AxisAlignedBB boundingBox=AxisAlignedBB.getBoundingBox(posX - 8.0,posY - 8.0,posZ - 8.0,posX + 8.0,posY + 8.0,posZ + 8.0);
  List<Entity> list=worldObj.getEntitiesWithinAABBExcludingEntity(this,boundingBox,selector);
  Entity entity=null;
  double distance=10000.0F;
  for (  Entity s : list) {
    double dx=s.posX - posX, dy=s.posY - posY, dz=s.posZ - posZ;
    double d=Math.sqrt(dx * dx + dy * dy + dz * dz);
    if (d < distance) {
      entity=s;
      distance=d;
    }
  }
  if (entity == null)   return null;
  return entity;
}
Program: 145958
Project: 145958
Buggy source:
@Override public void onKeyDown(int keyCode,boolean isEnd){
  if (isEnd)   return;
  EntityPlayer player=Minecraft.getMinecraft().thePlayer;
  if (player == null)   return;
  CBCMod.netHandler.sendToServer(new MsgKeyUsing(true));
}

Fixed version (ground truth):
@Override public void onKeyDown(int keyCode,boolean isEnd){
  if (isEnd)   return;
  EntityPlayer player=Minecraft.getMinecraft().thePlayer;
  if (player == null)   return;
  EntityPlayer thePlayer=Minecraft.getMinecraft().thePlayer;
  Motion3D begin=new Motion3D(thePlayer,true);
  MovingObjectPosition mop=thePlayer.worldObj.rayTraceBlocks(begin.getPosVec(thePlayer.worldObj),begin.move(8.0).getPosVec(thePlayer.worldObj));
  if (mop == null || mop.sideHit == -1)   return;
  Block block=thePlayer.worldObj.getBlock(mop.blockX,mop.blockY,mop.blockZ);
  UsingUtils.useBlock(new BlockPos(mop.blockX,mop.blockY,mop.blockZ,block),thePlayer.worldObj,thePlayer);
  CBCMod.netHandler.sendToServer(new MsgKeyUsing(true));
}
Program: 145959
Project: 145959
Buggy source:
@Override public void onKeyUp(int keyCode,boolean isEnd){
  if (isEnd)   return;
  EntityPlayer player=Minecraft.getMinecraft().thePlayer;
  if (player == null)   return;
  CBCMod.netHandler.sendToServer(new MsgKeyUsing(false));
  ItemStack armorStack=player.inventory.armorInventory[3];
  System.out.println("String_Node_Str");
  if (armorStack == null)   return;
  System.out.println("String_Node_Str");
  ClientProxy.cth.flag=!ClientProxy.cth.flag;
}

Fixed version (ground truth):
@Override public void onKeyUp(int keyCode,boolean isEnd){
  if (isEnd)   return;
  EntityPlayer player=Minecraft.getMinecraft().thePlayer;
  if (player == null)   return;
  UsingUtils.stopUsingBlock(player.worldObj,player);
  CBCMod.netHandler.sendToServer(new MsgKeyUsing(false));
  ItemStack armorStack=player.inventory.armorInventory[3];
  if (armorStack == null)   return;
  ClientProxy.cth.flag=!ClientProxy.cth.flag;
}
Program: 145960
Project: 145960
Buggy source:
/** 
 * 被Container所调用，开始合成进程。
 */
public void startCrafting(int slot){
  ICrafterRecipe r=getRecipeBySlot(slot);
  if (r == null)   return;
  System.out.print("String_Node_Str" + r.getOutputForDisplay().getDisplayName() + "String_Node_Str"+ worldObj.isRemote);
  if (r.doCrafting(inventory,true) != null) {
    System.out.println("String_Node_Str");
    resetCraftingState();
    iconType=CrafterIconType.CRAFTING;
    this.isCrafting=true;
    this.currentRecipe=r;
    this.heatRequired=r.getHeatConsumed();
  }
 else {
    System.out.println("String_Node_Str");
    iconType=CrafterIconType.NOMATERIAL;
    heatRequired=0;
  }
  lastActionTime=worldObj.getWorldTime();
}

Fixed version (ground truth):
/** 
 * 被Container所调用，开始合成进程。
 */
public void startCrafting(int slot){
  ICrafterRecipe r=getRecipeBySlot(slot);
  if (r == null)   return;
  if (r.doCrafting(inventory,true) != null) {
    resetCraftingState();
    iconType=CrafterIconType.CRAFTING;
    this.isCrafting=true;
    this.currentRecipe=r;
    this.heatRequired=r.getHeatConsumed();
  }
 else {
    iconType=CrafterIconType.NOMATERIAL;
    heatRequired=0;
  }
  lastActionTime=worldObj.getWorldTime();
}
Program: 145961
Project: 145961
Buggy source:
/** 
 * @param tier
 * @param store
 */
public TileGeneratorLava(){
  super(1,20);
}

Fixed version (ground truth):
/** 
 * @param tier
 * @param store
 */
public TileGeneratorLava(){
  super(1,20);
  lavaCell=IC2Items.getItem("String_Node_Str");
  System.out.println("String_Node_Str" + lavaCell);
}
Program: 145962
Project: 145962
Buggy source:
private void tryBurn(){
  int energyReq=maxStorage - bucketCnt;
  if (energyReq >= 1 && slots[0] != null) {
    if (slots[0].getItem() == Items.lava_bucket) {
      this.setInventorySlotContents(0,new ItemStack(Items.bucket,1,0));
      bucketCnt+=1;
    }
  }
}

Fixed version (ground truth):
private void tryBurn(){
  int energyReq=maxStorage - bucketCnt;
  if (energyReq >= 1 && slots[0] != null) {
    Item item=slots[0].getItem();
    if (item == Items.lava_bucket || (lavaCell != null && lavaCell.getItem() == item && lavaCell.getItemDamage() == slots[0].getItemDamage())) {
      if (item == Items.lava_bucket) {
        this.setInventorySlotContents(0,new ItemStack(Items.lava_bucket));
      }
 else {
        slots[0].stackSize--;
        if (slots[0].stackSize == 0)         slots[0]=null;
      }
      bucketCnt+=1;
    }
  }
}
Program: 145963
Project: 145963
Buggy source:
public Bullet_9mm(){
  super();
  setCreativeTab(CBCMod.cct);
  setIAndU("String_Node_Str");
  setMaxStackSize(64);
  System.out.println("String_Node_Str" + this.getMaxDamage());
}

Fixed version (ground truth):
public Bullet_9mm(){
  super();
  setCreativeTab(CBCMod.cct);
  setIAndU("String_Node_Str");
  setMaxStackSize(64);
}
Program: 145964
Project: 145964
Buggy source:
@Override public boolean onItemUse(ItemStack item_stack,EntityPlayer player,World world,int x,int y,int z,int side,float x_off,float y_off,float z_off){
  if (!world.isRemote) {
    if (side == 0 || side == 1)     return false;
    int direction=Direction.facingToDirection[side];
    EntitySpray entity=new EntitySpray(world,x,y,z,direction,tId,player);
    if (entity.onValidSurface()) {
      System.err.println("String_Node_Str");
      world.spawnEntityInWorld(entity);
      world.playSoundAtEntity(player,"String_Node_Str",0.7f,1);
      item_stack.damageItem(1,player);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onItemUse(ItemStack item_stack,EntityPlayer player,World world,int x,int y,int z,int side,float x_off,float y_off,float z_off){
  if (!world.isRemote) {
    if (side == 0 || side == 1)     return false;
    int direction=Direction.facingToDirection[side];
    EntitySpray entity=new EntitySpray(world,x,y,z,direction,tId,player);
    if (entity.onValidSurface()) {
      world.spawnEntityInWorld(entity);
      world.playSoundAtEntity(player,"String_Node_Str",0.7f,1);
      item_stack.damageItem(1,player);
    }
  }
  return true;
}
Program: 145965
Project: 145965
Buggy source:
@Override public void onBlockUse(World world,EntityPlayer player,int bx,int by,int bz){
  TileEntity te=world.getTileEntity(bx,by,bz);
  if (te == null)   return;
  TileArmorCharger te2=(TileArmorCharger)te;
  String path=te2.currentEnergy > 0 ? "String_Node_Str" : "String_Node_Str";
  world.playSoundAtEntity(player,path,0.5F,1.0F);
  UsingUtils.setBlockInUse(player,bx,by,bz);
  if (te2.currentEnergy > 0)   te2.startUsing(player);
}

Fixed version (ground truth):
@Override public void onBlockUse(World world,EntityPlayer player,int bx,int by,int bz){
  TileEntity te=world.getTileEntity(bx,by,bz);
  System.out.println("String_Node_Str" + world.isRemote);
  if (te == null)   return;
  TileArmorCharger te2=(TileArmorCharger)te;
  String path=te2.currentEnergy > 0 ? "String_Node_Str" : "String_Node_Str";
  world.playSoundAtEntity(player,path,0.5F,1.0F);
  UsingUtils.setBlockInUse(player,bx,by,bz);
  if (te2.currentEnergy > 0)   te2.startUsing(player);
}
Program: 145967
Project: 145967
Buggy source:
private static void drawArmorTip(EntityPlayer player,TextureManager renderEngine,int k,int l){
  int tx=k - 26, tx2=k - 10;
  for (int i=0, xOffset=-10; i < 4; i++) {
    ItemStack is=player.inventory.armorInventory[i];
    ArmorHEV hev;
    if (is != null && is.getItem() instanceof ArmorHEV) {
      hev=(ArmorHEV)is.getItem();
      int energy=hev.getManager(is).discharge(is,Integer.MAX_VALUE,0,true,true);
      int heightToDraw=energy * 16 / is.getMaxDamage();
      int height=l - 65 - i * 16;
      if (is.getItemSpriteNumber() == 0) {
        renderEngine.bindTexture(renderEngine.getResourceLocation(0));
      }
 else {
        renderEngine.bindTexture(renderEngine.getResourceLocation(1));
      }
      GL11.glColor4f(1.0F,1.0F,1.0F,0.9F);
      HudUtils.drawTexturedModelRectFromIcon(tx + xOffset,height,hev.getIcon(is,0),16,16);
      renderEngine.bindTexture(ClientProps.HEV_HUD_PATH);
      GL11.glColor4f(1.0F,1.0F,1.0F,0.5F);
      HudUtils.drawTexturedModalRect(tx2 + xOffset,height + 16 - heightToDraw,286,64,8,16,34,64);
      GL11.glColor4f(1.0F,0.5F,0.0F,0.75F);
      HudUtils.drawTexturedModalRect(tx2 + xOffset,height + 16 - heightToDraw,350,128 - 4 * heightToDraw,8,heightToDraw,34,heightToDraw * 4);
    }
  }
}

Fixed version (ground truth):
private static void drawArmorTip(EntityPlayer player,TextureManager renderEngine,int k,int l){
  int tx=k - 26, tx2=k - 10;
  for (int i=0, xOffset=-10; i < 4; i++) {
    ItemStack is=player.inventory.armorInventory[i];
    ArmorHEV hev;
    if (is != null && is.getItem() instanceof ArmorHEV) {
      hev=(ArmorHEV)is.getItem();
      int energy=ArmorHEV.getItemCharge(is);
      int heightToDraw=energy * 16 / hev.getMaxDamage(is);
      System.out.println(hev + "String_Node_Str" + energy+ "String_Node_Str"+ ArmorHEV.getItemCharge(is));
      int height=l - 65 - i * 16;
      if (is.getItemSpriteNumber() == 0) {
        renderEngine.bindTexture(renderEngine.getResourceLocation(0));
      }
 else {
        renderEngine.bindTexture(renderEngine.getResourceLocation(1));
      }
      GL11.glColor4f(1.0F,1.0F,1.0F,0.9F);
      HudUtils.drawTexturedModelRectFromIcon(tx + xOffset,height,hev.getIcon(is,0),16,16);
      renderEngine.bindTexture(ClientProps.HEV_HUD_PATH);
      GL11.glColor4f(1.0F,1.0F,1.0F,0.5F);
      HudUtils.drawTexturedModalRect(tx2 + xOffset,height + 16 - heightToDraw,286,64,8,16,34,64);
      GL11.glColor4f(1.0F,0.5F,0.0F,0.75F);
      HudUtils.drawTexturedModalRect(tx2 + xOffset,height + 16 - heightToDraw,350,128 - 4 * heightToDraw,8,heightToDraw,34,heightToDraw * 4);
    }
  }
}
Program: 145968
Project: 145968
Buggy source:
@Override protected void addElements(Set<cn.liutils.api.client.gui.part.LIGuiPart> set){
}

Fixed version (ground truth):
@Override protected void addElements(Set<LIGuiPart> set){
  set.add(new LIGuiPart("String_Node_Str",80,28,64,10).setTip(new TipEnergy()));
}
Program: 145969
Project: 145969
Buggy source:
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  mc.renderEngine.bindTexture(ClientProps.GUI_ARMORCHARGER_PATH);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  this.drawTexturedModalRect(x,y,0,0,xSize,ySize);
  HudUtils.setTextureResolution(256,256);
  this.drawElements(i,j);
  int length=te.currentEnergy * 64 / TileArmorCharger.ENERGY_MAX;
  this.drawTexturedModalRect(x + 80,y + 28,176,0,length,10);
  if (te.isCharging) {
    int height=(int)(te.getWorldObj().getWorldTime() % 43);
    this.drawTexturedModalRect(x + 29,y + 21,176,56,43,height);
  }
}

Fixed version (ground truth):
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  mc.renderEngine.bindTexture(ClientProps.GUI_ARMORCHARGER_PATH);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  this.drawTexturedModalRect(x,y,0,0,xSize,ySize);
  HudUtils.setTextureResolution(256,256);
  this.drawElements(i,j);
  int length=te.currentEnergy * 64 / TileArmorCharger.ENERGY_MAX;
  this.drawTexturedModalRect(x + 80,y + 28,176,0,length,10);
  if (te.isUsing) {
    System.out.println("String_Node_Str");
    int height=(int)(te.getWorldObj().getWorldTime() % 43);
    this.drawTexturedModalRect(x + 29,y + 21,176,56,43,height);
  }
}
Program: 145970
Project: 145970
Buggy source:
@Override protected void onImpact(MovingObjectPosition par1){
  if (par1.typeOfHit == MovingObjectType.BLOCK) {
    System.out.println("String_Node_Str" + worldObj.isRemote);
    lastBounceTime=ticksExisted;
  }
  if (worldObj.isRemote)   return;
  Block block=this.worldObj.getBlock(par1.blockX,par1.blockY,par1.blockZ);
  double collideStrengh=1.0;
  if (par1.typeOfHit == MovingObjectType.BLOCK) {
    if (!block.isCollidable())     return;
switch (par1.sideHit) {
case 0:
case 1:
      collideStrengh=Math.abs(motionY) * 0.3;
    this.motionY=0.01 * -motionY;
  this.motionX=0.8 * motionX;
this.motionZ=0.8 * motionZ;
break;
case 2:
case 3:
this.motionZ=0.6 * -motionZ;
collideStrengh=Math.abs(motionZ);
break;
case 4:
case 5:
this.motionX=0.6 * -motionX;
collideStrengh=Math.abs(motionX);
break;
default :
break;
}
}
if (collideStrengh > 1.0) collideStrengh=1.0;
if (lastBounceTime == 0 || ticksExisted - lastBounceTime > 20) {
this.playSound("String_Node_Str",(float)(5F * collideStrengh),1.0F);
}
}

Fixed version (ground truth):
@Override protected void onImpact(MovingObjectPosition par1){
  if (par1.typeOfHit == MovingObjectType.BLOCK) {
    lastBounceTime=ticksExisted;
  }
  if (worldObj.isRemote)   return;
  Block block=this.worldObj.getBlock(par1.blockX,par1.blockY,par1.blockZ);
  double collideStrengh=1.0;
  if (par1.typeOfHit == MovingObjectType.BLOCK) {
    if (!block.isCollidable())     return;
switch (par1.sideHit) {
case 0:
case 1:
      collideStrengh=Math.abs(motionY) * 0.3;
    this.motionY=0.01 * -motionY;
  this.motionX=0.8 * motionX;
this.motionZ=0.8 * motionZ;
break;
case 2:
case 3:
this.motionZ=0.6 * -motionZ;
collideStrengh=Math.abs(motionZ);
break;
case 4:
case 5:
this.motionX=0.6 * -motionX;
collideStrengh=Math.abs(motionX);
break;
default :
break;
}
}
if (collideStrengh > 1.0) collideStrengh=1.0;
if (lastBounceTime == 0 || ticksExisted - lastBounceTime > 20) {
this.playSound("String_Node_Str",(float)(5F * collideStrengh),1.0F);
}
}
Program: 145971
Project: 145971
Buggy source:
@Override public void onUpdate(){
  if (motion == null)   motion=new Motion3D(this,true);
  onGround=false;
  MovingObjectPosition trace=this.worldObj.rayTraceBlocks(motion.getPosVec(this.worldObj),motion.move(100.0F).getPosVec(this.worldObj));
  Vec3 end=(trace == null) ? motion.getPosVec(this.worldObj) : trace.hitVec;
  double dx=end.xCoord - this.posX;
  double dy=end.yCoord - this.posY;
  double dz=end.zCoord - this.posZ;
  distanceToRender=Math.sqrt(dx * dx + dy * dy + dz * dz);
  System.out.println(worldObj.isRemote + "String_Node_Str" + this.rotationYaw);
  if (distanceToRender < 3)   distanceToRender=50;
  if (this.ticksExisted > 2)   this.setDead();
}

Fixed version (ground truth):
@Override public void onUpdate(){
  if (motion == null)   motion=new Motion3D(this,true);
  onGround=false;
  MovingObjectPosition trace=this.worldObj.rayTraceBlocks(motion.getPosVec(this.worldObj),motion.move(100.0F).getPosVec(this.worldObj));
  Vec3 end=(trace == null) ? motion.getPosVec(this.worldObj) : trace.hitVec;
  double dx=end.xCoord - this.posX;
  double dy=end.yCoord - this.posY;
  double dz=end.zCoord - this.posZ;
  distanceToRender=Math.sqrt(dx * dx + dy * dy + dz * dz);
  if (distanceToRender < 3)   distanceToRender=50;
  if (this.ticksExisted > 2)   this.setDead();
}