nus-yam/ex-repair huggingface dataset:
Program: 135053
Project: 135053
Buggy source:
/** 
 * Empty the cache 
 * @param newFile If true the cache allocates a new file for storing the logs
 * @param keepOldFile If true the old file for the cache is not deleted
 * @throws IOException
 */
public void clear(boolean newFile,boolean keepOldFile) throws LogCacheException {
  super.clear(newFile,keepOldFile);
  wBuffer.clear(file,index);
}

Fixed version (ground truth):
/** 
 * Empty the cache 
 * @param newFile If true the cache allocates a new file for storing the logs
 * @param keepOldFile If true the old file for the cache is not deleted
 * @throws IOException
 */
public synchronized void clear(boolean newFile,boolean keepOldFile) throws LogCacheException {
  super.clear(newFile,keepOldFile);
  wBuffer.clear(file,index);
}
Program: 135054
Project: 135054
Buggy source:
/** 
 * Append a log to the end of the cache
 * @param log The log to append in the cache
 * @return The position in the cache of the added log
 */
public int add(ILogEntry log) throws LogCacheException {
  return wBuffer.addLog(log);
}

Fixed version (ground truth):
/** 
 * Append a log to the end of the cache
 * @param log The log to append in the cache
 * @return The position in the cache of the added log
 */
public synchronized int add(ILogEntry log) throws LogCacheException {
  return wBuffer.addLog(log);
}
Program: 135055
Project: 135055
Buggy source:
/** 
 * Flush the buffer on disk
 */
private void flushBuffer() throws LogCacheException {
  String logsStr=charBuffer.toString();
  long pos;
synchronized (fileOfLogs) {
    try {
      pos=fileOfLogs.length();
      fileOfLogs.seek(fileOfLogs.length());
      fileOfLogs.writeBytes(logsStr);
    }
 catch (    IOException ioe) {
      throw new LogCacheException("String_Node_Str",ioe);
    }
  }
synchronized (index) {
    for (int t=0; t < bufferIndex.size(); t++) {
      index.add(pos + bufferIndex.get(t));
    }
  }
  charBuffer.delete(0,charBuffer.length());
  bufferIndex.clear();
  writeBuffer.clear();
}

Fixed version (ground truth):
/** 
 * Flush the buffer on disk
 */
private synchronized void flushBuffer() throws LogCacheException {
  String logsStr=charBuffer.toString();
  long pos;
synchronized (fileOfLogs) {
    try {
      pos=fileOfLogs.length();
      fileOfLogs.seek(fileOfLogs.length());
      fileOfLogs.writeBytes(logsStr);
    }
 catch (    IOException ioe) {
      throw new LogCacheException("String_Node_Str",ioe);
    }
  }
synchronized (index) {
    for (int t=0; t < bufferIndex.size(); t++) {
      index.add(pos + bufferIndex.get(t));
    }
  }
  charBuffer.delete(0,charBuffer.length());
  bufferIndex.clear();
  writeBuffer.clear();
}
Program: 135056
Project: 135056
Buggy source:
/** 
 * Return the log in the given position
 * @param pos The position of the log
 * @return The LogEntryXML or null in case of error
 */
public ILogEntry getLog(int pos) throws LogCacheException {
  if (replacedLogs.containsKey(new Integer(pos))) {
    return replacedLogs.get(new Integer(pos));
  }
  if (pos >= index.size()) {
    return wBuffer.getLog(pos);
  }
 else   return super.getLog(pos);
}

Fixed version (ground truth):
/** 
 * Return the log in the given position
 * @param pos The position of the log
 * @return The LogEntryXML or null in case of error
 */
public synchronized ILogEntry getLog(int pos) throws LogCacheException {
  if (replacedLogs.containsKey(new Integer(pos))) {
    return replacedLogs.get(new Integer(pos));
  }
  if (pos >= index.size()) {
    return wBuffer.getLog(pos);
  }
 else   return super.getLog(pos);
}
Program: 135057
Project: 135057
Buggy source:
/** 
 * Empty the cache 
 * @param newFile If true the cache allocates a new file for storing the logs
 * @param keepOldFile If true the old file for the cache is not deleted
 * @throws IOException
 */
public void clear(boolean newFile,boolean keepOldFile) throws LogCacheException {
  super.clear(newFile,keepOldFile);
  wBuffer.clear(file,index);
}

Fixed version (ground truth):
/** 
 * Empty the cache 
 * @param newFile If true the cache allocates a new file for storing the logs
 * @param keepOldFile If true the old file for the cache is not deleted
 * @throws IOException
 */
public synchronized void clear(boolean newFile,boolean keepOldFile) throws LogCacheException {
  super.clear(newFile,keepOldFile);
  wBuffer.clear(file,index);
}
Program: 135058
Project: 135058
Buggy source:
/** 
 * Method unpacks the RemoteResponse data and writes it into the ResultArea Creation date: (2/25/00 12:44:55 PM)
 */
public void reportRemoteResponse(RemoteResponse response){
  getJLabel3().setText(String.valueOf(response.getSequenceNumber()));
  getmessageField().setText(response.getName());
  if (enabled) {
    processChartValues(response);
    boolean errorResponse=response.isErrorResponse();
    String resultString=processResponse(response,errorResponse | isExpand());
    if (reportLength == -1) {
      reportLength=DataFormatter.getLineCount(resultString);
      editing=true;
      jTextField1_ActionPerformed();
    }
    if (getState() == java.awt.Frame.ICONIFIED) {
      minimText.append(resultString);
      if (minimTextReportCount > maxLines) {
        minimText.delete(0,resultString.length());
      }
 else       minimTextReportCount++;
    }
 else {
      SmartTextPane resultArea=getReportArea();
      try {
        if (errorResponse) {
          resultArea.setCaretPosition(resultArea.getText().length());
          resultArea.setLogicalStyle(redStyle);
        }
        getReportArea().append(resultString);
        if (errorResponse)         resultArea.append("String_Node_Str");
      }
  finally {
        resultArea.setLogicalStyle(blackStyle);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Method unpacks the RemoteResponse data and writes it into the ResultArea Creation date: (2/25/00 12:44:55 PM)
 */
public void reportRemoteResponse(RemoteResponse response){
  getJLabel3().setText(String.valueOf(response.getSequenceNumber()));
  getmessageField().setText(response.getName());
  if (enabled) {
    processChartValues(response);
    boolean errorResponse=response.isErrorResponse();
    String resultString=processResponse(response,errorResponse | isExpand());
    if (reportLength == -1) {
      reportLength=DataFormatter.getLineCount(resultString);
      editing=true;
      jTextField1_ActionPerformed();
    }
    if (getState() == java.awt.Frame.ICONIFIED) {
      minimText.append(resultString);
      if (minimTextReportCount > maxLines) {
        minimText.delete(0,resultString.length());
      }
 else       minimTextReportCount++;
    }
 else {
      SmartTextPane resultArea=getReportArea();
      try {
        if (errorResponse) {
          resultArea.setCaretPosition(resultArea.getText().length());
          resultArea.setLogicalStyle(redStyle);
        }
        resultArea.append(resultString);
        if (errorResponse)         resultArea.append("String_Node_Str");
      }
  finally {
        resultArea.setLogicalStyle(blackStyle);
      }
    }
  }
}
Program: 135059
Project: 135059
Buggy source:
/** 
 * Return the ReportArea property value.
 * @return com.cosylab.gui.components.SmartTextArea
 */
private SmartTextPane getReportArea(){
  if (ivjReportArea == null) {
    try {
      ivjReportArea=new SmartTextPane();
      ivjReportArea.setName("String_Node_Str");
      ivjReportArea.setMaxLines(1000);
      ivjReportArea.setLocation(0,0);
      blackStyle=ivjReportArea.getLogicalStyle();
      redStyle=ivjReportArea.addStyle("String_Node_Str",null);
      StyleConstants.setForeground(redStyle,Color.red);
      ivjReportArea.setEnabled(false);
    }
 catch (    java.lang.Throwable ivjExc) {
      handleException(ivjExc);
    }
  }
  return ivjReportArea;
}

Fixed version (ground truth):
/** 
 * Return the ReportArea property value.
 * @return com.cosylab.gui.components.SmartTextArea
 */
private SmartTextPane getReportArea(){
  if (ivjReportArea == null) {
    try {
      ivjReportArea=new SmartTextPane();
      ivjReportArea.setName("String_Node_Str");
      ivjReportArea.setMaxLines(1000);
      ivjReportArea.setLocation(0,0);
      blackStyle=ivjReportArea.getLogicalStyle();
      redStyle=ivjReportArea.addStyle("String_Node_Str",null);
      StyleConstants.setForeground(redStyle,Color.red);
    }
 catch (    java.lang.Throwable ivjExc) {
      handleException(ivjExc);
    }
  }
  return ivjReportArea;
}
Program: 135060
Project: 135060
Buggy source:
/** 
 * Method unpacks the RemoteResponse data and writes it into the ResultArea Creation date: (2/25/00 12:44:55 PM)
 */
public void reportRemoteResponse(RemoteResponse response){
  getJLabel3().setText(String.valueOf(response.getSequenceNumber()));
  getmessageField().setText(response.getName());
  if (enabled) {
    processChartValues(response);
    boolean errorResponse=response.isErrorResponse();
    String resultString=processResponse(response,errorResponse | isExpand());
    if (reportLength == -1) {
      reportLength=DataFormatter.getLineCount(resultString);
      editing=true;
      jTextField1_ActionPerformed();
    }
    if (getState() == java.awt.Frame.ICONIFIED) {
      minimText.append(resultString);
      if (minimTextReportCount > maxLines) {
        minimText.delete(0,resultString.length());
      }
 else       minimTextReportCount++;
    }
 else {
      SmartTextPane resultArea=getReportArea();
      try {
        if (errorResponse) {
          resultArea.setCaretPosition(resultArea.getText().length());
          resultArea.setLogicalStyle(redStyle);
        }
        getReportArea().append(resultString);
        if (errorResponse)         resultArea.append("String_Node_Str");
      }
  finally {
        resultArea.setLogicalStyle(blackStyle);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Method unpacks the RemoteResponse data and writes it into the ResultArea Creation date: (2/25/00 12:44:55 PM)
 */
public void reportRemoteResponse(RemoteResponse response){
  getJLabel3().setText(String.valueOf(response.getSequenceNumber()));
  getmessageField().setText(response.getName());
  if (enabled) {
    processChartValues(response);
    boolean errorResponse=response.isErrorResponse();
    String resultString=processResponse(response,errorResponse | isExpand());
    if (reportLength == -1) {
      reportLength=DataFormatter.getLineCount(resultString);
      editing=true;
      jTextField1_ActionPerformed();
    }
    if (getState() == java.awt.Frame.ICONIFIED) {
      minimText.append(resultString);
      if (minimTextReportCount > maxLines) {
        minimText.delete(0,resultString.length());
      }
 else       minimTextReportCount++;
    }
 else {
      SmartTextPane resultArea=getReportArea();
      try {
        if (errorResponse) {
          resultArea.setCaretPosition(resultArea.getText().length());
          resultArea.setLogicalStyle(redStyle);
        }
        resultArea.append(resultString);
        if (errorResponse)         resultArea.append("String_Node_Str");
      }
  finally {
        resultArea.setLogicalStyle(blackStyle);
      }
    }
  }
}
Program: 135061
Project: 135061
Buggy source:
/** 
 * Return the ReportArea property value.
 * @return com.cosylab.gui.components.SmartTextArea
 */
private SmartTextPane getReportArea(){
  if (ivjReportArea == null) {
    try {
      ivjReportArea=new SmartTextPane();
      ivjReportArea.setName("String_Node_Str");
      ivjReportArea.setMaxLines(1000);
      ivjReportArea.setLocation(0,0);
      blackStyle=ivjReportArea.getLogicalStyle();
      redStyle=ivjReportArea.addStyle("String_Node_Str",null);
      StyleConstants.setForeground(redStyle,Color.red);
      ivjReportArea.setEnabled(false);
    }
 catch (    java.lang.Throwable ivjExc) {
      handleException(ivjExc);
    }
  }
  return ivjReportArea;
}

Fixed version (ground truth):
/** 
 * Return the ReportArea property value.
 * @return com.cosylab.gui.components.SmartTextArea
 */
private SmartTextPane getReportArea(){
  if (ivjReportArea == null) {
    try {
      ivjReportArea=new SmartTextPane();
      ivjReportArea.setName("String_Node_Str");
      ivjReportArea.setMaxLines(1000);
      ivjReportArea.setLocation(0,0);
      blackStyle=ivjReportArea.getLogicalStyle();
      redStyle=ivjReportArea.addStyle("String_Node_Str",null);
      StyleConstants.setForeground(redStyle,Color.red);
    }
 catch (    java.lang.Throwable ivjExc) {
      handleException(ivjExc);
    }
  }
  return ivjReportArea;
}
Program: 135062
Project: 135062
Buggy source:
/** 
 * Prints usage information.
 */
protected void usage(){
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Prints usage information.
 */
protected static void usage(){
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
}
Program: 135066
Project: 135066
Buggy source:
/** 
 * Compare a log with another log knowing the index of this last one
 * @param log The first log to compare
 * @param secondItem The index in the LogCache of the second log entry
 * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
 * @see java.util.Comparable
 */
public final int compare(ILogEntry log,Integer secondItem){
  ILogEntry log2=null;
  try {
    VisibleLogsVector.this.cache.getLog(secondItem);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace(System.err);
  }
  return compareLogs(log,log2);
}

Fixed version (ground truth):
/** 
 * Compare a log with another log knowing the index of this last one
 * @param log The first log to compare
 * @param secondItem The index in the LogCache of the second log entry
 * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
 * @see java.util.Comparable
 */
public final int compare(ILogEntry log,Integer secondItem){
  ILogEntry log2=null;
  try {
    log2=VisibleLogsVector.this.cache.getLog(secondItem);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace(System.err);
  }
  return compareLogs(log,log2);
}
Program: 135067
Project: 135067
Buggy source:
/** 
 * Compare a log with another log knowing the index of this last one
 * @param log The first log to compare
 * @param secondItem The index in the LogCache of the second log entry
 * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
 * @see java.util.Comparable
 */
public final int compare(ILogEntry log,Integer secondItem){
  ILogEntry log2=null;
  try {
    VisibleLogsVector.this.cache.getLog(secondItem);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace(System.err);
  }
  return compareLogs(log,log2);
}

Fixed version (ground truth):
/** 
 * Compare a log with another log knowing the index of this last one
 * @param log The first log to compare
 * @param secondItem The index in the LogCache of the second log entry
 * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
 * @see java.util.Comparable
 */
public final int compare(ILogEntry log,Integer secondItem){
  ILogEntry log2=null;
  try {
    log2=VisibleLogsVector.this.cache.getLog(secondItem);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace(System.err);
  }
  return compareLogs(log,log2);
}
Program: 135068
Project: 135068
Buggy source:
/** 
 * Compare a log with another log knowing the index of this last one
 * @param log The first log to compare
 * @param secondItem The index in the LogCache of the second log entry
 * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
 * @see java.util.Comparable
 */
public final int compare(ILogEntry log,Integer secondItem){
  ILogEntry log2=null;
  try {
    VisibleLogsVector.this.cache.getLog(secondItem);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace(System.err);
  }
  return compareLogs(log,log2);
}

Fixed version (ground truth):
/** 
 * Compare a log with another log knowing the index of this last one
 * @param log The first log to compare
 * @param secondItem The index in the LogCache of the second log entry
 * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
 * @see java.util.Comparable
 */
public final int compare(ILogEntry log,Integer secondItem){
  ILogEntry log2=null;
  try {
    log2=VisibleLogsVector.this.cache.getLog(secondItem);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace(System.err);
  }
  return compareLogs(log,log2);
}
Program: 135072
Project: 135072
Buggy source:
/** 
 * Load the logs from a buffered reader
 * @param reader The buffered reader containing the logs
 * @param engine The LCEngine to inject logs in the GUI
 * @param cache The cache To show info in the dialog (can be null)
 * @param showProgress If true a progress bar is shown
 * @see loadLogs
 */
public void loadLogs(BufferedReader reader,IACSLogRemoteConnection listener,LogCache cache,boolean showProgress){
  if (!this.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (listener == null || reader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IOOperationInProgress=true;
  LoggingClient.getInstance().getScrollPaneTable().setVisible(false);
  if (showProgress) {
    progressDialog=new ProgressDialog("String_Node_Str");
  }
 else {
    progressDialog=null;
  }
  IOAction action=new IOAction(reader,listener,cache);
synchronized (actions) {
    actions.add(action);
  }
synchronized (this) {
    notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * Load the logs from a buffered reader
 * @param reader The buffered reader containing the logs
 * @param listener The listener to add logs in
 * @param cache The cache To show info in the dialog (can be null)
 * @param showProgress If true a progress bar is shown
 * @param progressRange An integer to make the progress bar showing the real state of the operation (determinate) If it is <=0 then the progress bar is indeterminate
 * @see loadLogs
 */
public void loadLogs(BufferedReader reader,IACSLogRemoteConnection listener,LogCache cache,boolean showProgress,int progressRange){
  if (!this.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (listener == null || reader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IOOperationInProgress=true;
  LoggingClient.getInstance().getScrollPaneTable().setVisible(false);
  if (showProgress) {
    if (progressRange <= 0) {
      progressDialog=new ProgressDialog("String_Node_Str");
    }
 else {
      progressDialog=new ProgressDialog("String_Node_Str",0,progressRange);
    }
  }
 else {
    progressDialog=null;
  }
  IOAction action=new IOAction(reader,listener,cache);
synchronized (actions) {
    actions.add(action);
  }
synchronized (this) {
    notifyAll();
  }
}
Program: 135074
Project: 135074
Buggy source:
/** 
 * Load the logs from a buffered reader
 * @param reader The buffered reader containing the logs
 * @param engine The LCEngine to inject logs in the GUI
 * @param cache The cache To show info in the dialog (can be null)
 * @param showProgress If true a progress bar is shown
 * @see loadLogs
 */
public void loadLogs(BufferedReader reader,IACSLogRemoteConnection listener,LogCache cache,boolean showProgress){
  if (!this.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (listener == null || reader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IOOperationInProgress=true;
  LoggingClient.getInstance().getScrollPaneTable().setVisible(false);
  if (showProgress) {
    progressDialog=new ProgressDialog("String_Node_Str");
  }
 else {
    progressDialog=null;
  }
  IOAction action=new IOAction(reader,listener,cache);
synchronized (actions) {
    actions.add(action);
  }
synchronized (this) {
    notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * Load the logs from a buffered reader
 * @param reader The buffered reader containing the logs
 * @param listener The listener to add logs in
 * @param cache The cache To show info in the dialog (can be null)
 * @param showProgress If true a progress bar is shown
 * @param progressRange An integer to make the progress bar showing the real state of the operation (determinate) If it is <=0 then the progress bar is indeterminate
 * @see loadLogs
 */
public void loadLogs(BufferedReader reader,IACSLogRemoteConnection listener,LogCache cache,boolean showProgress,int progressRange){
  if (!this.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (listener == null || reader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IOOperationInProgress=true;
  LoggingClient.getInstance().getScrollPaneTable().setVisible(false);
  if (showProgress) {
    if (progressRange <= 0) {
      progressDialog=new ProgressDialog("String_Node_Str");
    }
 else {
      progressDialog=new ProgressDialog("String_Node_Str",0,progressRange);
    }
  }
 else {
    progressDialog=null;
  }
  IOAction action=new IOAction(reader,listener,cache);
synchronized (actions) {
    actions.add(action);
  }
synchronized (this) {
    notifyAll();
  }
}
Program: 135076
Project: 135076
Buggy source:
/** 
 * Load the logs from a buffered reader
 * @param reader The buffered reader containing the logs
 * @param engine The LCEngine to inject logs in the GUI
 * @param cache The cache To show info in the dialog (can be null)
 * @param showProgress If true a progress bar is shown
 * @see loadLogs
 */
public void loadLogs(BufferedReader reader,IACSLogRemoteConnection listener,LogCache cache,boolean showProgress){
  if (!this.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (listener == null || reader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IOOperationInProgress=true;
  LoggingClient.getInstance().getScrollPaneTable().setVisible(false);
  if (showProgress) {
    progressDialog=new ProgressDialog("String_Node_Str");
  }
 else {
    progressDialog=null;
  }
  IOAction action=new IOAction(reader,listener,cache);
synchronized (actions) {
    actions.add(action);
  }
synchronized (this) {
    notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * Load the logs from a buffered reader
 * @param reader The buffered reader containing the logs
 * @param listener The listener to add logs in
 * @param cache The cache To show info in the dialog (can be null)
 * @param showProgress If true a progress bar is shown
 * @param progressRange An integer to make the progress bar showing the real state of the operation (determinate) If it is <=0 then the progress bar is indeterminate
 * @see loadLogs
 */
public void loadLogs(BufferedReader reader,IACSLogRemoteConnection listener,LogCache cache,boolean showProgress,int progressRange){
  if (!this.isAlive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (listener == null || reader == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IOOperationInProgress=true;
  LoggingClient.getInstance().getScrollPaneTable().setVisible(false);
  if (showProgress) {
    if (progressRange <= 0) {
      progressDialog=new ProgressDialog("String_Node_Str");
    }
 else {
      progressDialog=new ProgressDialog("String_Node_Str",0,progressRange);
    }
  }
 else {
    progressDialog=null;
  }
  IOAction action=new IOAction(reader,listener,cache);
synchronized (actions) {
    actions.add(action);
  }
synchronized (this) {
    notifyAll();
  }
}
Program: 135077
Project: 135077
Buggy source:
/** 
 * Fill the cache with dinamically generated logs The number of logs inserted in the list is gretare than the  memory cache size to stress the disk cache also.
 * @return The number of logs inserted in the cache
 * @throws Exception
 */
private long fillCache() throws Exception {
  ACSLogParser parser=new ACSLogParser();
  String logMsg="String_Node_Str";
  cache.clear();
  long logToInsert=2 * cache.getCacheSize();
  for (int t=0; t < logToInsert; t++) {
    String newLogMsg=logMsg + "String_Node_Str";
    String logStr="String_Node_Str" + newLogMsg + "String_Node_Str";
    LogEntryXML newLog=parser.parse(logStr);
    cache.add(newLog);
  }
  return logToInsert;
}

Fixed version (ground truth):
/** 
 * Fill the cache with dynamically generated logs The number of logs inserted in the list is greater than the  memory cache size to stress the disk cache also.
 * @return The number of logs inserted in the cache
 * @throws Exception
 */
private long fillCache() throws Exception {
  ACSLogParser parser=new ACSLogParser();
  String logMsg="String_Node_Str";
  cache.clear();
  long logToInsert=2 * cache.getCacheSize();
  for (int t=0; t < logToInsert; t++) {
    String newLogMsg=logMsg + "String_Node_Str";
    String logStr="String_Node_Str" + newLogMsg + "String_Node_Str";
    LogEntryXML newLog=parser.parse(logStr);
    cache.add(newLog);
  }
  return logToInsert;
}
Program: 135078
Project: 135078
Buggy source:
/** 
 * This execute for each test and we want to have a cache with some logs 
 * @see junit.framework.TestCase
 */
protected void setUp() throws Exception {
  try {
    cache=new LogCache();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    e.printStackTrace();
    System.exit(0);
  }
  logsGenerated=fillCache();
}

Fixed version (ground truth):
/** 
 * This execute for each test and we want to have a cache with some logs 
 * @see junit.framework.TestCase
 */
protected void setUp() throws Exception {
  try {
    cache=new LogCache();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    throw e;
  }
  logsGenerated=fillCache();
}
Program: 135079
Project: 135079
Buggy source:
/** 
 * Fill the cache with dinamically generated logs The number of logs inserted in the list is gretare than the  memory cache size to stress the disk cache also.
 * @return The number of logs inserted in the cache
 * @throws Exception
 */
private long fillCache() throws Exception {
  ACSLogParser parser=new ACSLogParser();
  String logMsg="String_Node_Str";
  cache.clear();
  long logToInsert=2 * cache.getCacheSize();
  for (int t=0; t < logToInsert; t++) {
    String newLogMsg=logMsg + "String_Node_Str";
    String logStr="String_Node_Str" + newLogMsg + "String_Node_Str";
    LogEntryXML newLog=parser.parse(logStr);
    cache.add(newLog);
  }
  return logToInsert;
}

Fixed version (ground truth):
/** 
 * Fill the cache with dynamically generated logs The number of logs inserted in the list is greater than the  memory cache size to stress the disk cache also.
 * @return The number of logs inserted in the cache
 * @throws Exception
 */
private long fillCache() throws Exception {
  ACSLogParser parser=new ACSLogParser();
  String logMsg="String_Node_Str";
  cache.clear();
  long logToInsert=2 * cache.getCacheSize();
  for (int t=0; t < logToInsert; t++) {
    String newLogMsg=logMsg + "String_Node_Str";
    String logStr="String_Node_Str" + newLogMsg + "String_Node_Str";
    LogEntryXML newLog=parser.parse(logStr);
    cache.add(newLog);
  }
  return logToInsert;
}
Program: 135080
Project: 135080
Buggy source:
/** 
 * This execute for each test and we want to have a cache with some logs 
 * @see junit.framework.TestCase
 */
protected void setUp() throws Exception {
  try {
    cache=new LogCache();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    e.printStackTrace();
    System.exit(0);
  }
  logsGenerated=fillCache();
}

Fixed version (ground truth):
/** 
 * This execute for each test and we want to have a cache with some logs 
 * @see junit.framework.TestCase
 */
protected void setUp() throws Exception {
  try {
    cache=new LogCache();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    throw e;
  }
  logsGenerated=fillCache();
}
Program: 135081
Project: 135081
Buggy source:
/** 
 * Fill the cache with dinamically generated logs The number of logs inserted in the list is gretare than the  memory cache size to stress the disk cache also.
 * @return The number of logs inserted in the cache
 * @throws Exception
 */
private long fillCache() throws Exception {
  ACSLogParser parser=new ACSLogParser();
  String logMsg="String_Node_Str";
  cache.clear();
  long logToInsert=2 * cache.getCacheSize();
  for (int t=0; t < logToInsert; t++) {
    String newLogMsg=logMsg + "String_Node_Str";
    String logStr="String_Node_Str" + newLogMsg + "String_Node_Str";
    LogEntryXML newLog=parser.parse(logStr);
    cache.add(newLog);
  }
  return logToInsert;
}

Fixed version (ground truth):
/** 
 * Fill the cache with dynamically generated logs The number of logs inserted in the list is greater than the  memory cache size to stress the disk cache also.
 * @return The number of logs inserted in the cache
 * @throws Exception
 */
private long fillCache() throws Exception {
  ACSLogParser parser=new ACSLogParser();
  String logMsg="String_Node_Str";
  cache.clear();
  long logToInsert=2 * cache.getCacheSize();
  for (int t=0; t < logToInsert; t++) {
    String newLogMsg=logMsg + "String_Node_Str";
    String logStr="String_Node_Str" + newLogMsg + "String_Node_Str";
    LogEntryXML newLog=parser.parse(logStr);
    cache.add(newLog);
  }
  return logToInsert;
}
Program: 135082
Project: 135082
Buggy source:
/** 
 * This execute for each test and we want to have a cache with some logs 
 * @see junit.framework.TestCase
 */
protected void setUp() throws Exception {
  try {
    cache=new LogCache();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    e.printStackTrace();
    System.exit(0);
  }
  logsGenerated=fillCache();
}

Fixed version (ground truth):
/** 
 * This execute for each test and we want to have a cache with some logs 
 * @see junit.framework.TestCase
 */
protected void setUp() throws Exception {
  try {
    cache=new LogCache();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    throw e;
  }
  logsGenerated=fillCache();
}
Program: 135083
Project: 135083
Buggy source:
/** 
 * Reads a List of enchantments from an ItemEnchantedBook stack.
 * @param book Instance of ItemEnchantedBook, as it uses non-static methods for somereason.
 * @param stack The stack to read the data from.
 * @return The list of enchantments stored on the stack.
 */
private List<Enchantment> getEnchantments(ItemEnchantedBook book,ItemStack stack){
  final NBTTagList enchTags=book.getEnchantments(stack);
  final List<Enchantment> enchantments=new ArrayList<>();
  if (enchTags != null)   for (int index=0; index < enchTags.tagCount(); ++index) {
    final int id=enchTags.getCompoundTagAt(index).getShort("String_Node_Str");
    final Enchantment enchant=Enchantment.getEnchantmentByID(id);
    if (enchant != null)     enchantments.add(enchant);
  }
  return enchantments;
}

Fixed version (ground truth):
/** 
 * Reads a List of enchantments from an ItemEnchantedBook stack.
 * @param book Instance of ItemEnchantedBook, as it uses non-static methods for somereason.
 * @param stack The stack to read the data from.
 * @return The list of enchantments stored on the stack.
 */
@SideOnly(Side.CLIENT) private List<Enchantment> getEnchantments(ItemEnchantedBook book,ItemStack stack){
  final NBTTagList enchTags=book.getEnchantments(stack);
  final List<Enchantment> enchantments=new ArrayList<>();
  if (enchTags != null)   for (int index=0; index < enchTags.tagCount(); ++index) {
    final int id=enchTags.getCompoundTagAt(index).getShort("String_Node_Str");
    final Enchantment enchant=Enchantment.getEnchantmentByID(id);
    if (enchant != null)     enchantments.add(enchant);
  }
  return enchantments;
}
Program: 135084
Project: 135084
Buggy source:
/** 
 * Gets the name of the mod that registered the passed object. Works for anthing which uses Forge's registry.
 * @param registerable The object to get the mod name of.
 * @return The name of the mod which registered the object.
 */
public static String getModName(IForgeRegistryEntry.Impl<?> registerable){
  final String modID=registerable.getRegistryName().getResourceDomain();
  final ModContainer mod=Loader.instance().getIndexedModList().get(modID);
  return mod != null ? mod.getName() : modID;
}

Fixed version (ground truth):
/** 
 * Gets the name of the mod that registered the passed object. Works for anthing which uses Forge's registry.
 * @param registerable The object to get the mod name of.
 * @return The name of the mod which registered the object.
 */
@SideOnly(Side.CLIENT) public static String getModName(IForgeRegistryEntry.Impl<?> registerable){
  final String modID=registerable.getRegistryName().getResourceDomain();
  final ModContainer mod=Loader.instance().getIndexedModList().get(modID);
  return mod != null ? mod.getName() : modID;
}
Program: 135085
Project: 135085
Buggy source:
public static String getTranslationKey(Enchantment enchant){
  return String.format("String_Node_Str",enchant.getRegistryName().getResourceDomain(),enchant.getRegistryName().getResourcePath());
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) public static String getTranslationKey(Enchantment enchant){
  return String.format("String_Node_Str",enchant.getRegistryName().getResourceDomain(),enchant.getRegistryName().getResourcePath());
}
Program: 135086
Project: 135086
Buggy source:
@Override public void addItemInfo(List<String> info,ItemStack stack,boolean advanced,EntityPlayer entityPlayer){
  if (stack.getItem() instanceof ItemEnchantedBook)   if (GameSettings.isKeyDown(keyBindSneak)) {
    final ItemEnchantedBook item=(ItemEnchantedBook)stack.getItem();
    final List<Enchantment> enchants=this.getEnchantments(item,stack);
    for (    final Enchantment enchant : enchants) {
      info.add(I18n.format("String_Node_Str") + "String_Node_Str" + I18n.format(enchant.getName()));
      info.add(this.getDescription(enchant));
      if (showOwner)       info.add(I18n.format("String_Node_Str") + "String_Node_Str" + ChatFormatting.BLUE+ getModName(enchant));
    }
  }
 else   info.add(I18n.format("String_Node_Str",ChatFormatting.LIGHT_PURPLE,keyBindSneak.getDisplayName(),ChatFormatting.GRAY));
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public void addItemInfo(List<String> info,ItemStack stack,boolean advanced,EntityPlayer entityPlayer){
  final KeyBinding keyBindSneak=Minecraft.getMinecraft().gameSettings.keyBindSneak;
  if (stack.getItem() instanceof ItemEnchantedBook)   if (GameSettings.isKeyDown(keyBindSneak)) {
    final ItemEnchantedBook item=(ItemEnchantedBook)stack.getItem();
    final List<Enchantment> enchants=this.getEnchantments(item,stack);
    for (    final Enchantment enchant : enchants) {
      info.add(I18n.format("String_Node_Str") + "String_Node_Str" + I18n.format(enchant.getName()));
      info.add(this.getDescription(enchant));
      if (showOwner)       info.add(I18n.format("String_Node_Str") + "String_Node_Str" + ChatFormatting.BLUE+ getModName(enchant));
    }
  }
 else   info.add(I18n.format("String_Node_Str",ChatFormatting.LIGHT_PURPLE,keyBindSneak.getDisplayName(),ChatFormatting.GRAY));
}
Program: 135087
Project: 135087
Buggy source:
/** 
 * Gets the description of the enchantment. Or the missing text, if no description exists.
 * @param enchantment The enchantment to get a description for.
 * @return The enchantment description.
 */
private String getDescription(Enchantment enchantment){
  final String key=getTranslationKey(enchantment);
  String description=I18n.format(key);
  if (description.startsWith("String_Node_Str"))   description=I18n.format("String_Node_Str",getModName(enchantment),key);
  return description;
}

Fixed version (ground truth):
/** 
 * Gets the description of the enchantment. Or the missing text, if no description exists.
 * @param enchantment The enchantment to get a description for.
 * @return The enchantment description.
 */
@SideOnly(Side.CLIENT) private String getDescription(Enchantment enchantment){
  final String key=getTranslationKey(enchantment);
  String description=I18n.format(key);
  if (description.startsWith("String_Node_Str"))   description=I18n.format("String_Node_Str",getModName(enchantment),key);
  return description;
}
Program: 135088
Project: 135088
Buggy source:
@EventHandler public void preInit(FMLPreInitializationEvent event){
  if (Loader.isModLoaded("String_Node_Str"))   engine=new WailaEngine();
 else   if (Loader.isModLoaded("String_Node_Str")) {
    engine=new ICSEEngine();
    ICSE.plugins.add((ICSEEngine)engine);
  }
  tileProviders.add(new PluginBreakProgression());
  tileProviders.add(new PluginEnchantmentPower());
  tileProviders.add(new PluginBlastResistance());
  tileProviders.add(new PluginHardness());
  tileProviders.add(new PluginHarvestability());
  entityProviders.add(new PluginEquipment());
  entityProviders.add(new PluginArmorPoints());
  entityProviders.add(new PluginTameable());
  entityProviders.add(new PluginAnimal());
  itemProviders.add(new PluginEnchantmentPower());
  itemProviders.add(new PluginFluidDescription());
  if (!Loader.isModLoaded("String_Node_Str"))   itemProviders.add(new PluginEnchantmentDescription());
  tileProviders.add(new PluginSkulls());
  tileProviders.add(new PluginFurnace());
  entityProviders.add(new PluginHorse());
  entityProviders.add(new PluginVillagerTypes());
  entityProviders.add(new PluginItemFrame());
  entityProviders.add(new PluginPrimedTNT());
  entityProviders.add(new PluginEXPOrb());
  if (Loader.isModLoaded("String_Node_Str")) {
    tileProviders.add(new PluginEggInfo());
    entityProviders.add(new PluginStageInfo());
  }
  new WawlaConfiguration(event.getSuggestedConfigurationFile());
  proxy.preInit();
}

Fixed version (ground truth):
@EventHandler public void preInit(FMLPreInitializationEvent event){
  if (Loader.isModLoaded("String_Node_Str"))   engine=new WailaEngine();
 else   if (Loader.isModLoaded("String_Node_Str")) {
    engine=new ICSEEngine();
    ICSE.plugins.add((ICSEEngine)engine);
  }
  tileProviders.add(new PluginBreakProgression());
  tileProviders.add(new PluginEnchantmentPower());
  tileProviders.add(new PluginBlastResistance());
  tileProviders.add(new PluginHardness());
  tileProviders.add(new PluginHarvestability());
  entityProviders.add(new PluginEquipment());
  entityProviders.add(new PluginArmorPoints());
  entityProviders.add(new PluginTameable());
  entityProviders.add(new PluginAnimal());
  itemProviders.add(new PluginEnchantmentPower());
  itemProviders.add(new PluginFluidDescription());
  if (!Loader.isModLoaded("String_Node_Str") && event.getSide().equals(Side.CLIENT))   itemProviders.add(new PluginEnchantmentDescription());
  tileProviders.add(new PluginSkulls());
  tileProviders.add(new PluginFurnace());
  entityProviders.add(new PluginHorse());
  entityProviders.add(new PluginVillagerTypes());
  entityProviders.add(new PluginItemFrame());
  entityProviders.add(new PluginPrimedTNT());
  entityProviders.add(new PluginEXPOrb());
  if (Loader.isModLoaded("String_Node_Str")) {
    tileProviders.add(new PluginEggInfo());
    entityProviders.add(new PluginStageInfo());
  }
  new WawlaConfiguration(event.getSuggestedConfigurationFile());
  proxy.preInit();
}
Program: 135089
Project: 135089
Buggy source:
@SubscribeEvent public void onItemTooltip(ItemTooltipEvent event){
  if (event.getEntityPlayer() != null && event.getEntityPlayer().worldObj != null && event.getItemStack() != null) {
    final KeyBinding keyBindSneak=Minecraft.getMinecraft().gameSettings.keyBindSneak;
    final boolean isShifting=GameSettings.isKeyDown(keyBindSneak);
    final Item item=event.getItemStack().getItem();
    final Block block=Block.getBlockFromItem(item);
    if (item instanceof ItemEnchantedBook && enchantmentDescription) {
      final List<String> tooltip=event.getToolTip();
      if (GameSettings.isKeyDown(keyBindSneak)) {
        final List<Enchantment> enchants=getEnchantments((ItemEnchantedBook)item,event.getItemStack());
        for (        Enchantment enchant : enchants) {
          tooltip.add(I18n.format("String_Node_Str") + "String_Node_Str" + I18n.format(enchant.getName()));
          tooltip.add(getDescription(enchant));
          tooltip.add(I18n.format("String_Node_Str") + "String_Node_Str" + ChatFormatting.BLUE+ getModName(enchant));
        }
      }
 else       tooltip.add(I18n.format("String_Node_Str",ChatFormatting.LIGHT_PURPLE,keyBindSneak.getDisplayName(),ChatFormatting.GRAY));
    }
    if (block != null && showEnchantmentPower)     try {
      final float enchPower=block.getEnchantPowerBonus(event.getEntityPlayer().worldObj,BlockPos.ORIGIN);
      if (enchPower > 0)       event.getToolTip().add(I18n.format("String_Node_Str") + "String_Node_Str" + enchPower);
    }
 catch (    final IllegalArgumentException exception) {
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onItemTooltip(ItemTooltipEvent event){
  if (event.getEntityPlayer() != null && event.getEntityPlayer().worldObj != null && event.getItemStack() != null) {
    final Item item=event.getItemStack().getItem();
    final Block block=Block.getBlockFromItem(item);
    if (item instanceof ItemEnchantedBook && enchantmentDescription && GameSettings.isKeyDown(keyBindSneak)&& !isEnchDescLoaded) {
      final List<String> tooltip=event.getToolTip();
      if (GameSettings.isKeyDown(keyBindSneak)) {
        final List<Enchantment> enchants=getEnchantments((ItemEnchantedBook)item,event.getItemStack());
        for (        Enchantment enchant : enchants) {
          tooltip.add(I18n.format("String_Node_Str") + "String_Node_Str" + I18n.format(enchant.getName()));
          tooltip.add(getDescription(enchant));
          tooltip.add(I18n.format("String_Node_Str") + "String_Node_Str" + ChatFormatting.BLUE+ getModName(enchant));
        }
      }
 else       tooltip.add(I18n.format("String_Node_Str",ChatFormatting.LIGHT_PURPLE,keyBindSneak.getDisplayName(),ChatFormatting.GRAY));
    }
    if (block != null && showEnchantmentPower)     try {
      final float enchPower=block.getEnchantPowerBonus(event.getEntityPlayer().worldObj,BlockPos.ORIGIN);
      if (enchPower > 0)       event.getToolTip().add(I18n.format("String_Node_Str") + "String_Node_Str" + enchPower);
    }
 catch (    final IllegalArgumentException exception) {
    }
  }
}
Program: 135090
Project: 135090
Buggy source:
public static void handleConfigs(Configuration config){
  showEnchantmentPower=config.getBoolean("String_Node_Str",CATAGORY,true,"String_Node_Str");
  enchantmentDescription=config.getBoolean("String_Node_Str",CATAGORY,true,"String_Node_Str");
}

Fixed version (ground truth):
public static void handleConfigs(Configuration config){
  showEnchantmentPower=config.getBoolean("String_Node_Str",CATAGORY,true,"String_Node_Str");
  enchantmentDescription=config.getBoolean("String_Node_Str",CATAGORY,true,"String_Node_Str");
  isEnchDescLoaded=Loader.isModLoaded("String_Node_Str");
}
Program: 135092
Project: 135092
Buggy source:
public static void register(IWailaRegistrar register){
  final EntityProvider provider=new EntityProvider();
  register.registerOverrideEntityProvider(provider,Entity.class);
  register.registerBodyProvider(provider,Entity.class);
  register.registerNBTProvider(provider,EntitySkeleton.class);
}

Fixed version (ground truth):
public static void register(IWailaRegistrar register){
  final EntityProvider provider=new EntityProvider();
  register.registerOverrideEntityProvider(provider,Entity.class);
  register.registerBodyProvider(provider,Entity.class);
  register.registerNBTProvider(provider,Entity.class);
}
Program: 135093
Project: 135093
Buggy source:
@Override public DataAccess overrideEntity(DataAccess data){
  InfoAccess info=new InfoAccess(data.world,data.player,data.entity,data.tag);
  if (info.isValidBlock())   for (  InfoProvider provider : Wawla.entityProviders)   if (provider.requireEntityOverride(info))   info=provider.overrideTile(info);
  return new DataAccess(info.world,info.player,info.entity,info.tag);
}

Fixed version (ground truth):
@Override public DataAccess overrideEntity(DataAccess data){
  InfoAccess info=new InfoAccess(data.world,data.player,data.entity,data.tag);
  if (info.entity != null)   for (  InfoProvider provider : Wawla.entityProviders)   if (provider.requireEntityOverride(info))   info=provider.overrideTile(info);
  return new DataAccess(info.world,info.player,info.entity,info.tag);
}
Program: 135094
Project: 135094
Buggy source:
@Override public boolean requireTileSync(World world,TileEntity tile){
  for (  InfoProvider plugin : Wawla.entityProviders)   if (plugin.requireTileSync(world,tile))   return true;
  return false;
}

Fixed version (ground truth):
@Override public boolean requireTileSync(World world,TileEntity tile){
  for (  InfoProvider plugin : Wawla.tileProviders)   if (plugin.requireTileSync(world,tile))   return true;
  return false;
}
Program: 135095
Project: 135095
Buggy source:
private void syncConfigData(){
  for (  InfoProvider provider : Wawla.tileProviders)   provider.syncConfig(config);
  for (  InfoProvider provider : Wawla.entityProviders)   provider.syncConfig(config);
}

Fixed version (ground truth):
private void syncConfigData(){
  for (  InfoProvider provider : Wawla.tileProviders)   provider.syncConfig(config);
  for (  InfoProvider provider : Wawla.entityProviders)   provider.syncConfig(config);
  config.save();
}
Program: 135101
Project: 135101
Buggy source:
public static void registerAddon(IWailaRegistrar register){
  AddonGenericTiles dataProvider=new AddonGenericTiles();
  register.addConfig("String_Node_Str",showTool);
  register.addConfig("String_Node_Str",showHarvestable);
  register.addConfig("String_Node_Str",showTier);
  register.addConfig("String_Node_Str",showProgress);
  register.addConfig("String_Node_Str",showLightLevel);
  register.addConfig("String_Node_Str",showMonsterSpawn);
  register.addConfig("String_Node_Str",showDay);
  register.registerBodyProvider(dataProvider,Block.class);
  if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT))   currentBlockDamage=ReflectionHelper.findField(PlayerControllerMP.class,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public static void registerAddon(IWailaRegistrar register){
  AddonGenericTiles dataProvider=new AddonGenericTiles();
  register.addConfig("String_Node_Str",showTool);
  register.addConfig("String_Node_Str",showHarvestable);
  register.addConfig("String_Node_Str",showTier);
  register.addConfig("String_Node_Str",showProgress);
  register.addConfig("String_Node_Str",showLightLevel);
  register.addConfig("String_Node_Str",showMonsterSpawn);
  register.addConfig("String_Node_Str",showDay);
  register.registerBodyProvider(dataProvider,Block.class);
  if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT))   currentBlockDamage=ReflectionHelper.findField(PlayerControllerMP.class,"String_Node_Str","String_Node_Str","String_Node_Str");
}