nus-yam/ex-repair huggingface dataset:
Program: 135026
Project: 135026
Buggy source:
/** 
 * Gets a reference to the CDB. Reuses the previously obtained reference. Implemented as on-demand remote call, so always use this method  instead of directly accessing the field   {@link #cdb}.  <p> TODO: reuse this CDB reference in ContainerServicesImpl for method getCDB()
 * @return the CDB reference, or <code>null</code> if it could not be obtained.
 */
DAL getCDB(){
  if (cdb != null) {
    return cdb;
  }
  try {
    IntHolder status=new IntHolder();
    org.omg.CORBA.Object dalObj=m_managerProxy.get_service("String_Node_Str",true,status);
    cdb=DALHelper.narrow(dalObj);
    if (cdb == null || status.value != ManagerOperations.COMPONENT_ACTIVATED) {
      m_logger.log(Level.WARNING,"String_Node_Str" + status.value);
    }
  }
 catch (  Exception e) {
    m_logger.log(Level.WARNING,"String_Node_Str",e);
  }
  return cdb;
}

Fixed version (ground truth):
/** 
 * Gets a reference to the CDB. Reuses the previously obtained reference. Implemented as on-demand remote call, so always use this method instead of directly accessing the field   {@link #cdb}. <p> TODO: reuse this CDB reference in ContainerServicesImpl for method getCDB()
 * @return the CDB reference, or <code>null</code> if it could not beobtained.
 */
DAL getCDB(){
  if (cdb != null) {
    return cdb;
  }
  try {
    IntHolder status=new IntHolder();
    org.omg.CORBA.Object dalObj=m_managerProxy.get_service("String_Node_Str",true,status);
    cdb=DALHelper.narrow(dalObj);
    if (cdb == null || status.value != ManagerOperations.COMPONENT_ACTIVATED) {
      m_logger.log(Level.WARNING,"String_Node_Str" + status.value);
    }
  }
 catch (  Exception e) {
    m_logger.log(Level.WARNING,"String_Node_Str",e);
  }
  return cdb;
}
Program: 135027
Project: 135027
Buggy source:
/** 
 * @param containerName
 * @param acsCorba
 * @param managerProxy
 * @param isEmbedded  true if this container runs within an application. Affects shutdown behavior.
 * @throws ContainerException  if anything goes wrong, or if another instance of this classhas already been created.
 */
AcsContainer(String containerName,AcsCorba acsCorba,AcsManagerProxy managerProxy,boolean isEmbedded) throws ContainerException {
  if (s_instance == null) {
    m_containerName=containerName;
    m_managerProxy=managerProxy;
    this.isEmbedded=isEmbedded;
    ClientLogManager clm=ClientLogManager.getAcsLogManager();
    m_logger=clm.getLoggerForContainer(containerName);
    m_activeComponentMap=new ComponentMap(m_logger);
    m_acsCorba=acsCorba;
    registerWithCorba();
    LogConfig logConfig=clm.getLogConfig();
    logConfig.setCDBContainerPath("String_Node_Str" + containerName);
    logConfig.setCDB(getCDB());
    try {
      logConfig.initialize();
    }
 catch (    LogConfigException ex) {
      m_logger.log(Level.FINE,"String_Node_Str" + ex.getMessage());
    }
    s_instance=this;
    try {
      ACSAlarmSystemInterfaceFactory.init(m_acsCorba.getORB(),m_managerProxy.getManager(),m_logger);
    }
 catch (    Exception e) {
      throw new ContainerException("String_Node_Str");
    }
  }
 else {
    throw new ContainerException("String_Node_Str" + AcsContainer.class.getName() + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Constructor which creates a container that is registered as a CORBA object, but not yet logged in to the manager (for that, call   {@link #initialize()}.
 * @param containerName
 * @param acsCorba
 * @param managerProxy
 * @param isEmbedded  true if this container runs within an application. Affects shutdown behavior.
 * @throws ContainerException  if anything goes wrong, or if another instance of this classhas already been created.
 */
AcsContainer(String containerName,AcsCorba acsCorba,AcsManagerProxy managerProxy,boolean isEmbedded) throws ContainerException {
  if (s_instance == null) {
    m_containerName=containerName;
    m_managerProxy=managerProxy;
    this.isEmbedded=isEmbedded;
    m_logger=ClientLogManager.getAcsLogManager().getLoggerForContainer(containerName);
    m_activeComponentMap=new ComponentMap(m_logger);
    m_acsCorba=acsCorba;
    registerWithCorba();
    s_instance=this;
  }
 else {
    throw new ContainerException("String_Node_Str" + AcsContainer.class.getName() + "String_Node_Str");
  }
}
Program: 135028
Project: 135028
Buggy source:
/** 
 * Gets a reference to the CDB. Reuses the previously obtained reference. Implemented as on-demand remote call, so always use this method  instead of directly accessing the field   {@link #cdb}.  <p> TODO: reuse this CDB reference in ContainerServicesImpl for method getCDB()
 * @return the CDB reference, or <code>null</code> if it could not be obtained.
 */
DAL getCDB(){
  if (cdb != null) {
    return cdb;
  }
  IntHolder status=new IntHolder();
  try {
    org.omg.CORBA.Object dalObj=m_managerProxy.get_service("String_Node_Str",true,status);
    cdb=DALHelper.narrow(dalObj);
  }
 catch (  Exception e) {
    m_logger.log(Level.WARNING,"String_Node_Str",e);
  }
  if (status.value != ManagerOperations.COMPONENT_ACTIVATED) {
    m_logger.log(Level.WARNING,"String_Node_Str" + status.value);
  }
  return cdb;
}

Fixed version (ground truth):
/** 
 * Gets a reference to the CDB. Reuses the previously obtained reference. Implemented as on-demand remote call, so always use this method  instead of directly accessing the field   {@link #cdb}.  <p> TODO: reuse this CDB reference in ContainerServicesImpl for method getCDB()
 * @return the CDB reference, or <code>null</code> if it could not be obtained.
 */
DAL getCDB(){
  if (cdb != null) {
    return cdb;
  }
  try {
    IntHolder status=new IntHolder();
    org.omg.CORBA.Object dalObj=m_managerProxy.get_service("String_Node_Str",true,status);
    cdb=DALHelper.narrow(dalObj);
    if (cdb == null || status.value != ManagerOperations.COMPONENT_ACTIVATED) {
      m_logger.log(Level.WARNING,"String_Node_Str" + status.value);
    }
  }
 catch (  Exception e) {
    m_logger.log(Level.WARNING,"String_Node_Str",e);
  }
  return cdb;
}
Program: 135029
Project: 135029
Buggy source:
/** 
 * Converts an <code>ErrorTrace</code> object to a Java <code>Throwable</code>. The chain of caused-by exceptions is translated, too. <p> See the comment on class substitution at  {@link DefaultAcsJException}.
 * @param et
 * @return Throwable  current implementation always returns a subclass of <code>AcsJException</code>, but don't rely on it yet.
 */
static Throwable recursiveGetThrowable(ErrorTrace et){
  String classname=ErrorTraceManipulator.getProperty(et,PROPERTY_JAVAEXCEPTION_CLASS);
  String message=ErrorTraceManipulator.getProperty(et,PROPERTY_JAVAEXCEPTION_MESSAGE);
  if (message == null) {
    message="String_Node_Str";
  }
  Throwable thr=null;
  if (classname != null) {
    try {
      Class exClass=Class.forName(classname);
      if (Throwable.class.isAssignableFrom(exClass)) {
        if (!AcsJException.class.isAssignableFrom(exClass)) {
          message+="String_Node_Str" + classname + "String_Node_Str";
          exClass=DefaultAcsJException.class;
        }
        Constructor msgCtor=exClass.getConstructor(new Class[]{String.class});
        thr=(Throwable)msgCtor.newInstance(new Object[]{message});
      }
    }
 catch (    Exception e) {
      message="String_Node_Str" + message;
    }
  }
  if (thr == null) {
    thr=new DefaultAcsJException(message,et.errorType,et.errorCode,et.shortDescription);
  }
  resurrectThrowable(thr,et);
  return thr;
}

Fixed version (ground truth):
/** 
 * Converts an <code>ErrorTrace</code> object to a Java <code>Throwable</code>. The chain of caused-by exceptions is translated, too. <p> See the comment on class substitution at  {@link DefaultAcsJException}.
 * @param et
 * @return Throwable  current implementation always returns a subclass of <code>AcsJException</code>, but don't rely on it yet.
 */
static Throwable recursiveGetThrowable(ErrorTrace et){
  String classname=ErrorTraceManipulator.getProperty(et,PROPERTY_JAVAEXCEPTION_CLASS);
  String message=ErrorTraceManipulator.getProperty(et,PROPERTY_JAVAEXCEPTION_MESSAGE);
  if (message == null) {
    message="String_Node_Str";
  }
  Throwable thr=null;
  if (classname != null) {
    try {
      Class exClass=Class.forName(classname);
      if (AcsJException.class.isAssignableFrom(exClass)) {
        Constructor msgCtor=exClass.getConstructor(new Class[]{String.class});
        thr=(Throwable)msgCtor.newInstance(new Object[]{message});
      }
 else {
        thr=new DefaultAcsJException(message,0,0,classname);
      }
    }
 catch (    Exception e) {
      message="String_Node_Str" + classname + "String_Node_Str"+ message+ "String_Node_Str";
    }
  }
  if (thr == null) {
    thr=new DefaultAcsJException(message,et.errorType,et.errorCode,et.shortDescription);
  }
  resurrectThrowable(thr,et);
  return thr;
}
Program: 135030
Project: 135030
Buggy source:
/** 
 * Gets a logger for an application (which is not an ACS component itself), e.g. a GUI application using the ACS ComponentClient. 
 * @param namespace  the logger namespace, should identify the application.
 * @param enableRemoteLogging  if true (generally recommended), log messages will be sent to the remote log service,as it always happens for container and component loggers. 
 * @return a configured Logger  
 */
public Logger getLoggerForApplication(String namespace,boolean enableRemoteLogging){
  if (namespace == null || namespace.trim().length() == 0) {
    namespace="String_Node_Str";
  }
  Logger logger=null;
  if (enableRemoteLogging) {
    logger=createRemoteLogger(namespace);
  }
 else {
    logger=Logger.getLogger(namespace);
    addLocalHandler(logger);
    AcsLogger.configureJDKLogger(logger,logConfig.getLogConfigData());
  }
  return logger;
}

Fixed version (ground truth):
/** 
 * Gets a logger for an application (which is not an ACS component itself), e.g. a GUI application using the ACS ComponentClient. 
 * @param namespace  the logger namespace, should identify the application.
 * @param enableRemoteLogging  if true (generally recommended), log messages will be sent to the remote log service,as it always happens for container and component loggers. 
 * @return a configured Logger  
 */
public Logger getLoggerForApplication(String namespace,boolean enableRemoteLogging){
  if (namespace == null || namespace.trim().length() == 0) {
    namespace="String_Node_Str";
  }
  Logger logger=null;
  if (enableRemoteLogging) {
    logger=createRemoteLogger(namespace);
  }
 else {
    logger=Logger.getLogger(namespace);
    logger.setUseParentHandlers(false);
    addLocalHandler(logger);
    AcsLogger.configureJDKLogger(logger,logConfig.getLogConfigData());
  }
  return logger;
}
Program: 135031
Project: 135031
Buggy source:
/** 
 * Factory method for additional container service instances. This method should only be used by specialized clients such as the OMC GUI which needs independent ContainerServices instances for the plug-ins it runs.
 * @param clientName  name for {@link ContainerServices#getName()}
 * @param csLogger  logger to be used internally by the new ContainerServices instance (which is different from the Logger returned in  {@link ContainerServices#getLogger()}). 
 */
public ContainerServices createContainerServices(String clientName,Logger csLogger) throws ContainerException {
  try {
    ThreadFactory threadFactory=new CleaningDaemonThreadFactory(clientName,csLogger);
    AcsManagerProxy acsManagerProxy=m_acsManagerProxy.createInstance();
    ManagerClient clImpl=new ManagerClient(clientName,csLogger);
    Client managerClient=clImpl._this(acsCorba.getORB());
    acsManagerProxy.loginToManager(managerClient,false);
    int clientHandle=acsManagerProxy.getManagerHandle();
    ContainerServices cs=new ContainerServicesImpl(acsManagerProxy,acsCorba.getRootPOA(),acsCorba,csLogger,clientHandle,clientName,null,threadFactory);
    return cs;
  }
 catch (  ContainerException ex) {
    throw ex;
  }
catch (  Throwable thr) {
    throw new ContainerException(thr);
  }
}

Fixed version (ground truth):
/** 
 * Factory method for additional container service instances. This method should only be used by specialized clients such as the OMC GUI which needs independent ContainerServices instances for the plug-ins it runs. <p> Make sure to call   {@link #destroyContainerServices(ContainerServices)} when done with the new CS.
 * @param clientName  name for {@link ContainerServices#getName()}
 * @param csLogger  logger to be used internally by the new ContainerServices instance (which is different from the Logger returned in  {@link ContainerServices#getLogger()}). 
 */
public ContainerServices createContainerServices(String clientName,Logger csLogger) throws ContainerException {
  try {
    ThreadFactory threadFactory=new CleaningDaemonThreadFactory(clientName,csLogger);
    AcsManagerProxy acsManagerProxy=m_acsManagerProxy.createInstance();
    ManagerClient clImpl=new ManagerClient(clientName,csLogger);
    Client managerClient=clImpl._this(acsCorba.getORB());
    acsManagerProxy.loginToManager(managerClient,false);
    int clientHandle=acsManagerProxy.getManagerHandle();
    ContainerServicesImpl cs=new ContainerServicesImpl(acsManagerProxy,acsCorba.getRootPOA(),acsCorba,csLogger,clientHandle,clientName,null,threadFactory);
    additionalContainerServices.put(cs,acsManagerProxy);
    return cs;
  }
 catch (  ContainerException ex) {
    throw ex;
  }
catch (  Throwable thr) {
    throw new ContainerException(thr);
  }
}
Program: 135032
Project: 135032
Buggy source:
/** 
 * "un-factory" method which inverts   {@link #createContainerServices(String,Logger)}.
 * @param cs ContainerServices instance created by {@link #createContainerServices(String,Logger)}.
 */
public void destroyContainerServices(ContainerServices cs) throws ContainerException {
  try {
    ContainerServicesImpl csImpl=(ContainerServicesImpl)cs;
    m_acsManagerProxy.shutdownNotify();
    csImpl.releaseAllComponents();
    ((CleaningDaemonThreadFactory)csImpl.getThreadFactory()).cleanUp();
    m_acsManagerProxy.logoutFromManager();
  }
 catch (  Throwable thr) {
    throw new ContainerException("String_Node_Str",thr);
  }
}

Fixed version (ground truth):
/** 
 * "un-factory" method which inverts   {@link #createContainerServices(String,Logger)}.
 * @param cs ContainerServices instance created by {@link #createContainerServices(String,Logger)}.
 */
public void destroyContainerServices(ContainerServices cs) throws ContainerException {
  if (!additionalContainerServices.containsKey(cs)) {
    throw new ContainerException("String_Node_Str");
  }
  try {
    ContainerServicesImpl csImpl=(ContainerServicesImpl)cs;
    AcsManagerProxy acsManagerProxy=additionalContainerServices.get(cs);
    acsManagerProxy.shutdownNotify();
    csImpl.releaseAllComponents();
    ((CleaningDaemonThreadFactory)csImpl.getThreadFactory()).cleanUp();
    acsManagerProxy.logoutFromManager();
    additionalContainerServices.remove(cs);
  }
 catch (  Throwable thr) {
    throw new ContainerException("String_Node_Str",thr);
  }
}
Program: 135033
Project: 135033
Buggy source:
/** 
 * @return an XML string representing this log
 */
public String toXMLString(){
  StringBuffer sb=new StringBuffer();
  String logType=LogTypeHelper.getLogTypeDescription(type);
  sb.append("String_Node_Str" + logType);
  for (int t=0; t < NUMBER_OF_FIELDS; t++) {
    if (t == FIELD_LOGMESSAGE || t == FIELD_ENTRYTYPE) {
      continue;
    }
    Object attrValue=getField(t);
    if (attrValue != null) {
      if (Date.class.isInstance(attrValue)) {
        SimpleDateFormat df=new SimpleDateFormat(TIME_FORMAT);
        Date dt=(Date)attrValue;
        StringBuffer dateSB=new StringBuffer();
        java.text.FieldPosition pos=new java.text.FieldPosition(0);
        df.format(dt,dateSB,pos);
        attrValue=dateSB.toString();
      }
      String attrValStr=attrValue.toString();
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      sb.append("String_Node_Str" + tagAttributes[t] + "String_Node_Str"+ attrValStr+ "String_Node_Str");
    }
  }
  if (type == LogTypeHelper.ENTRYTYPE_TRACE) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str" + logMessage + "String_Node_Str");
    if (hasDatas()) {
      sb.append(getXMLDatas());
    }
    sb.append("String_Node_Str" + logType + "String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * @return an XML string representing this log
 */
public String toXMLString(){
  StringBuilder sb=new StringBuilder();
  String logType=LogTypeHelper.getLogTypeDescription(type);
  sb.append("String_Node_Str" + logType);
  for (int t=0; t < NUMBER_OF_FIELDS; t++) {
    if (t == FIELD_LOGMESSAGE || t == FIELD_ENTRYTYPE) {
      continue;
    }
    Object attrValue=getField(t);
    if (attrValue != null) {
      if (Date.class.isInstance(attrValue)) {
        SimpleDateFormat df=new SimpleDateFormat(TIME_FORMAT);
        Date dt=(Date)attrValue;
        StringBuffer dateSB=new StringBuffer();
        java.text.FieldPosition pos=new java.text.FieldPosition(0);
        df.format(dt,dateSB,pos);
        attrValue=dateSB.toString();
      }
      String attrValStr=attrValue.toString();
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      sb.append("String_Node_Str" + tagAttributes[t] + "String_Node_Str"+ attrValStr+ "String_Node_Str");
    }
  }
  if (type == LogTypeHelper.ENTRYTYPE_TRACE && !hasDatas()) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str");
    if (logMessage != null) {
      sb.append("String_Node_Str" + logMessage + "String_Node_Str");
    }
    if (hasDatas()) {
      sb.append(getXMLDatas());
    }
    sb.append("String_Node_Str" + logType + "String_Node_Str");
  }
  return sb.toString();
}
Program: 135034
Project: 135034
Buggy source:
/** 
 * @return The XML representation of the additional data
 */
private StringBuffer getXMLDatas(){
  StringBuffer tempStr=new StringBuffer();
  if (additionalData != null) {
    int size=additionalData.size();
    for (int t=0; t < size; t++) {
      AdditionalData temp=additionalData.get(t);
      String name=temp.getName();
      String value=temp.getValue();
      name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      value=value.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      tempStr.append("String_Node_Str" + name + "String_Node_Str");
      tempStr.append(value);
      tempStr.append("String_Node_Str");
    }
  }
  return tempStr;
}

Fixed version (ground truth):
/** 
 * @return The XML representation of the additional data
 */
private StringBuilder getXMLDatas(){
  StringBuilder tempStr=new StringBuilder();
  if (additionalData != null) {
    int size=additionalData.size();
    for (int t=0; t < size; t++) {
      AdditionalData temp=additionalData.get(t);
      String name=temp.getName();
      String value=temp.getValue();
      name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      value=value.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      tempStr.append("String_Node_Str" + name + "String_Node_Str");
      tempStr.append(value);
      tempStr.append("String_Node_Str");
    }
  }
  return tempStr;
}
Program: 135035
Project: 135035
Buggy source:
/** 
 * @return an XML string representing this log
 */
public String toXMLString(){
  StringBuffer sb=new StringBuffer();
  String logType=LogTypeHelper.getLogTypeDescription(type);
  sb.append("String_Node_Str" + logType);
  for (int t=0; t < NUMBER_OF_FIELDS; t++) {
    if (t == FIELD_LOGMESSAGE || t == FIELD_ENTRYTYPE) {
      continue;
    }
    Object attrValue=getField(t);
    if (attrValue != null) {
      if (Date.class.isInstance(attrValue)) {
        SimpleDateFormat df=new SimpleDateFormat(TIME_FORMAT);
        Date dt=(Date)attrValue;
        StringBuffer dateSB=new StringBuffer();
        java.text.FieldPosition pos=new java.text.FieldPosition(0);
        df.format(dt,dateSB,pos);
        attrValue=dateSB.toString();
      }
      String attrValStr=attrValue.toString();
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      sb.append("String_Node_Str" + tagAttributes[t] + "String_Node_Str"+ attrValStr+ "String_Node_Str");
    }
  }
  if (type == LogTypeHelper.ENTRYTYPE_TRACE) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str" + logMessage + "String_Node_Str");
    if (hasDatas()) {
      sb.append(getXMLDatas());
    }
    sb.append("String_Node_Str" + logType + "String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * @return an XML string representing this log
 */
public String toXMLString(){
  StringBuilder sb=new StringBuilder();
  String logType=LogTypeHelper.getLogTypeDescription(type);
  sb.append("String_Node_Str" + logType);
  for (int t=0; t < NUMBER_OF_FIELDS; t++) {
    if (t == FIELD_LOGMESSAGE || t == FIELD_ENTRYTYPE) {
      continue;
    }
    Object attrValue=getField(t);
    if (attrValue != null) {
      if (Date.class.isInstance(attrValue)) {
        SimpleDateFormat df=new SimpleDateFormat(TIME_FORMAT);
        Date dt=(Date)attrValue;
        StringBuffer dateSB=new StringBuffer();
        java.text.FieldPosition pos=new java.text.FieldPosition(0);
        df.format(dt,dateSB,pos);
        attrValue=dateSB.toString();
      }
      String attrValStr=attrValue.toString();
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      sb.append("String_Node_Str" + tagAttributes[t] + "String_Node_Str"+ attrValStr+ "String_Node_Str");
    }
  }
  if (type == LogTypeHelper.ENTRYTYPE_TRACE && !hasDatas()) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str");
    if (logMessage != null) {
      sb.append("String_Node_Str" + logMessage + "String_Node_Str");
    }
    if (hasDatas()) {
      sb.append(getXMLDatas());
    }
    sb.append("String_Node_Str" + logType + "String_Node_Str");
  }
  return sb.toString();
}
Program: 135036
Project: 135036
Buggy source:
/** 
 * @return The XML representation of the additional data
 */
private StringBuffer getXMLDatas(){
  StringBuffer tempStr=new StringBuffer();
  if (additionalData != null) {
    int size=additionalData.size();
    for (int t=0; t < size; t++) {
      AdditionalData temp=additionalData.get(t);
      String name=temp.getName();
      String value=temp.getValue();
      name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      value=value.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      tempStr.append("String_Node_Str" + name + "String_Node_Str");
      tempStr.append(value);
      tempStr.append("String_Node_Str");
    }
  }
  return tempStr;
}

Fixed version (ground truth):
/** 
 * @return The XML representation of the additional data
 */
private StringBuilder getXMLDatas(){
  StringBuilder tempStr=new StringBuilder();
  if (additionalData != null) {
    int size=additionalData.size();
    for (int t=0; t < size; t++) {
      AdditionalData temp=additionalData.get(t);
      String name=temp.getName();
      String value=temp.getValue();
      name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      value=value.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      tempStr.append("String_Node_Str" + name + "String_Node_Str");
      tempStr.append(value);
      tempStr.append("String_Node_Str");
    }
  }
  return tempStr;
}
Program: 135037
Project: 135037
Buggy source:
/** 
 * @return an XML string representing this log
 */
public String toXMLString(){
  StringBuffer sb=new StringBuffer();
  String logType=LogTypeHelper.getLogTypeDescription(type);
  sb.append("String_Node_Str" + logType);
  for (int t=0; t < NUMBER_OF_FIELDS; t++) {
    if (t == FIELD_LOGMESSAGE || t == FIELD_ENTRYTYPE) {
      continue;
    }
    Object attrValue=getField(t);
    if (attrValue != null) {
      if (Date.class.isInstance(attrValue)) {
        SimpleDateFormat df=new SimpleDateFormat(TIME_FORMAT);
        Date dt=(Date)attrValue;
        StringBuffer dateSB=new StringBuffer();
        java.text.FieldPosition pos=new java.text.FieldPosition(0);
        df.format(dt,dateSB,pos);
        attrValue=dateSB.toString();
      }
      String attrValStr=attrValue.toString();
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      sb.append("String_Node_Str" + tagAttributes[t] + "String_Node_Str"+ attrValStr+ "String_Node_Str");
    }
  }
  if (type == LogTypeHelper.ENTRYTYPE_TRACE) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str" + logMessage + "String_Node_Str");
    if (hasDatas()) {
      sb.append(getXMLDatas());
    }
    sb.append("String_Node_Str" + logType + "String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * @return an XML string representing this log
 */
public String toXMLString(){
  StringBuilder sb=new StringBuilder();
  String logType=LogTypeHelper.getLogTypeDescription(type);
  sb.append("String_Node_Str" + logType);
  for (int t=0; t < NUMBER_OF_FIELDS; t++) {
    if (t == FIELD_LOGMESSAGE || t == FIELD_ENTRYTYPE) {
      continue;
    }
    Object attrValue=getField(t);
    if (attrValue != null) {
      if (Date.class.isInstance(attrValue)) {
        SimpleDateFormat df=new SimpleDateFormat(TIME_FORMAT);
        Date dt=(Date)attrValue;
        StringBuffer dateSB=new StringBuffer();
        java.text.FieldPosition pos=new java.text.FieldPosition(0);
        df.format(dt,dateSB,pos);
        attrValue=dateSB.toString();
      }
      String attrValStr=attrValue.toString();
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      attrValStr=attrValStr.replaceAll("String_Node_Str","String_Node_Str");
      sb.append("String_Node_Str" + tagAttributes[t] + "String_Node_Str"+ attrValStr+ "String_Node_Str");
    }
  }
  if (type == LogTypeHelper.ENTRYTYPE_TRACE && !hasDatas()) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str");
    if (logMessage != null) {
      sb.append("String_Node_Str" + logMessage + "String_Node_Str");
    }
    if (hasDatas()) {
      sb.append(getXMLDatas());
    }
    sb.append("String_Node_Str" + logType + "String_Node_Str");
  }
  return sb.toString();
}
Program: 135038
Project: 135038
Buggy source:
/** 
 * @return The XML representation of the additional data
 */
private StringBuffer getXMLDatas(){
  StringBuffer tempStr=new StringBuffer();
  if (additionalData != null) {
    int size=additionalData.size();
    for (int t=0; t < size; t++) {
      AdditionalData temp=additionalData.get(t);
      String name=temp.getName();
      String value=temp.getValue();
      name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      value=value.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      tempStr.append("String_Node_Str" + name + "String_Node_Str");
      tempStr.append(value);
      tempStr.append("String_Node_Str");
    }
  }
  return tempStr;
}

Fixed version (ground truth):
/** 
 * @return The XML representation of the additional data
 */
private StringBuilder getXMLDatas(){
  StringBuilder tempStr=new StringBuilder();
  if (additionalData != null) {
    int size=additionalData.size();
    for (int t=0; t < size; t++) {
      AdditionalData temp=additionalData.get(t);
      String name=temp.getName();
      String value=temp.getValue();
      name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      value=value.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim();
      tempStr.append("String_Node_Str" + name + "String_Node_Str");
      tempStr.append(value);
      tempStr.append("String_Node_Str");
    }
  }
  return tempStr;
}
Program: 135039
Project: 135039
Buggy source:
/** 
 * Implements required method of ACSLogParser interface.
 * @param xmlString the XML string to parse
 * @throws LogParseException when problems are encountered parsing an XML message.
 * @see ACSLogParser
 */
public ILogEntry parse(String xmlString) throws LogParseException {
  LogEntry retVal=null;
  byte[] bytesArray=xmlString.getBytes();
  VTDGen vg=null;
  try {
    try {
      vg=new VTDGen();
      vg.setDoc(bytesArray);
      vg.parse(false);
    }
 catch (    Exception e) {
      vg.clear();
      String newLogString=XmlNormalizer.normalizeXMLEmbeddedTextOnly(xmlString);
      vg.setDoc(newLogString.getBytes());
      vg.parse(false);
    }
    retVal=makeLogEntryFromParsedXML(vg,bytesArray,xmlString);
  }
 catch (  ParseException ex) {
    ex.printStackTrace();
    throw new LogParseException("String_Node_Str",ex);
  }
  return retVal;
}

Fixed version (ground truth):
/** 
 * Implements required method of ACSLogParser interface.
 * @param xmlString the XML string to parse
 * @throws LogParseException when problems are encountered parsing an XML message.
 * @see ACSLogParser
 */
public ILogEntry parse(String xmlString) throws LogParseException {
  LogEntry retVal=null;
  byte[] bytesArray=xmlString.getBytes();
  VTDGen vg=null;
  try {
    try {
      vg=new VTDGen();
      vg.setDoc(bytesArray);
      vg.parse(false);
    }
 catch (    Exception e) {
      vg.clear();
      xmlString=XmlNormalizer.normalizeXMLEmbeddedTextOnly(xmlString);
      bytesArray=xmlString.getBytes();
      vg.setDoc(xmlString.getBytes());
      vg.parse(false);
    }
    retVal=makeLogEntryFromParsedXML(vg,bytesArray,xmlString);
  }
 catch (  ParseException ex) {
    ex.printStackTrace();
    throw new LogParseException("String_Node_Str",ex);
  }
  return retVal;
}
Program: 135040
Project: 135040
Buggy source:
/** 
 * Implements required method of ACSLogParser interface.
 * @param xmlString the XML string to parse
 * @throws LogParseException when problems are encountered parsing an XML message.
 * @see ACSLogParser
 */
public ILogEntry parse(String xmlString) throws LogParseException {
  LogEntry retVal=null;
  byte[] bytesArray=xmlString.getBytes();
  VTDGen vg=null;
  try {
    try {
      vg=new VTDGen();
      vg.setDoc(bytesArray);
      vg.parse(false);
    }
 catch (    Exception e) {
      vg.clear();
      String newLogString=XmlNormalizer.normalizeXMLEmbeddedTextOnly(xmlString);
      vg.setDoc(newLogString.getBytes());
      vg.parse(false);
    }
    retVal=makeLogEntryFromParsedXML(vg,bytesArray,xmlString);
  }
 catch (  ParseException ex) {
    ex.printStackTrace();
    throw new LogParseException("String_Node_Str",ex);
  }
  return retVal;
}

Fixed version (ground truth):
/** 
 * Implements required method of ACSLogParser interface.
 * @param xmlString the XML string to parse
 * @throws LogParseException when problems are encountered parsing an XML message.
 * @see ACSLogParser
 */
public ILogEntry parse(String xmlString) throws LogParseException {
  LogEntry retVal=null;
  byte[] bytesArray=xmlString.getBytes();
  VTDGen vg=null;
  try {
    try {
      vg=new VTDGen();
      vg.setDoc(bytesArray);
      vg.parse(false);
    }
 catch (    Exception e) {
      vg.clear();
      xmlString=XmlNormalizer.normalizeXMLEmbeddedTextOnly(xmlString);
      bytesArray=xmlString.getBytes();
      vg.setDoc(xmlString.getBytes());
      vg.parse(false);
    }
    retVal=makeLogEntryFromParsedXML(vg,bytesArray,xmlString);
  }
 catch (  ParseException ex) {
    ex.printStackTrace();
    throw new LogParseException("String_Node_Str",ex);
  }
  return retVal;
}
Program: 135041
Project: 135041
Buggy source:
/** 
 * Implements required method of ACSLogParser interface.
 * @param xmlString the XML string to parse
 * @throws LogParseException when problems are encountered parsing an XML message.
 * @see ACSLogParser
 */
public ILogEntry parse(String xmlString) throws LogParseException {
  LogEntry retVal=null;
  byte[] bytesArray=xmlString.getBytes();
  VTDGen vg=null;
  try {
    try {
      vg=new VTDGen();
      vg.setDoc(bytesArray);
      vg.parse(false);
    }
 catch (    Exception e) {
      vg.clear();
      String newLogString=XmlNormalizer.normalizeXMLEmbeddedTextOnly(xmlString);
      vg.setDoc(newLogString.getBytes());
      vg.parse(false);
    }
    retVal=makeLogEntryFromParsedXML(vg,bytesArray,xmlString);
  }
 catch (  ParseException ex) {
    ex.printStackTrace();
    throw new LogParseException("String_Node_Str",ex);
  }
  return retVal;
}

Fixed version (ground truth):
/** 
 * Implements required method of ACSLogParser interface.
 * @param xmlString the XML string to parse
 * @throws LogParseException when problems are encountered parsing an XML message.
 * @see ACSLogParser
 */
public ILogEntry parse(String xmlString) throws LogParseException {
  LogEntry retVal=null;
  byte[] bytesArray=xmlString.getBytes();
  VTDGen vg=null;
  try {
    try {
      vg=new VTDGen();
      vg.setDoc(bytesArray);
      vg.parse(false);
    }
 catch (    Exception e) {
      vg.clear();
      xmlString=XmlNormalizer.normalizeXMLEmbeddedTextOnly(xmlString);
      bytesArray=xmlString.getBytes();
      vg.setDoc(xmlString.getBytes());
      vg.parse(false);
    }
    retVal=makeLogEntryFromParsedXML(vg,bytesArray,xmlString);
  }
 catch (  ParseException ex) {
    ex.printStackTrace();
    throw new LogParseException("String_Node_Str",ex);
  }
  return retVal;
}
Program: 135042
Project: 135042
Buggy source:
/** 
 * The thread for async long lasting op. At the end of each operation, it check if there are new logs to add in the buffer Vector. The ordering of logs is not performed in mutual exclusion i.e. other methods like add and setLogOrder will not hang.
 */
public void run(){
  LogOperationRequest request=null;
  AddLogItem item=null;
  while (true) {
synchronized (asyncOps) {
      if (asyncOps.size() > 0) {
        request=asyncOps.get(0);
      }
 else {
        request=null;
      }
    }
    if (request != null) {
      if (request.getType() == LogOperationRequest.TERMINATE) {
        return;
      }
 else {
        sort(request.getOrderingField(),request.orderDirection());
        LoggingClient.getInstance().getLogEntryTable().getTableHeader().setEnabled(true);
        LoggingClient.getInstance().getLogEntryTable().getTableHeader().resizeAndRepaint();
      }
    }
synchronized (buffer) {
      while (buffer.size() > 0) {
        item=buffer.remove(0);
        addLogToVector(item.index,item.log);
      }
    }
    if (request != null) {
synchronized (asyncOps) {
        asyncOps.remove(0);
      }
    }
synchronized (this) {
      if (asyncOps.size() == 0 && buffer.size() == 0) {
        try {
          wait();
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * The thread for async long lasting op. At the end of each operation, it check if there are new logs to add in the buffer Vector. The ordering of logs is not performed in mutual exclusion i.e. other methods like add and setLogOrder will not hang.
 */
public void run(){
  LogOperationRequest request=null;
  AddLogItem item=null;
  while (true) {
synchronized (asyncOps) {
      if (asyncOps.size() > 0) {
        request=asyncOps.get(0);
      }
 else {
        request=null;
      }
    }
    if (request != null) {
      if (request.getType() == LogOperationRequest.TERMINATE) {
        return;
      }
 else {
        LoggingClient.getInstance().getLogEntryTable().getTableHeader().setEnabled(false);
        LoggingClient.getInstance().setEnabledGUIControls(false);
        sort(request.getOrderingField(),request.orderDirection());
        LoggingClient.getInstance().getLogEntryTable().getTableHeader().setEnabled(true);
        LoggingClient.getInstance().setEnabledGUIControls(true);
        LoggingClient.getInstance().getLogEntryTable().getTableHeader().resizeAndRepaint();
      }
    }
synchronized (buffer) {
      while (buffer.size() > 0) {
        item=buffer.remove(0);
        addLogToVector(item.index,item.log);
      }
    }
    if (request != null) {
synchronized (asyncOps) {
        asyncOps.remove(0);
      }
    }
synchronized (this) {
      if (asyncOps.size() == 0 && buffer.size() == 0) {
        try {
          wait();
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
}
Program: 135044
Project: 135044
Buggy source:
/** 
 * When the logs are ordered by timestamp, it finds the position in the ordered list where the log has to be inserted. The algoritm has logaritmic complexity param The timestamp of the log to be inserted
 * @return The position log to insert in the visible logs
 */
private int findPosLogarthmicDate(long date){
  int minInter=0;
  int maxInter=visibleLogs.size() - 1;
  int middle=0;
  long maxDate=-1;
  long minDate=-1;
  boolean sortAscending=comparator.isSortAscending();
  do {
    maxDate=cache.getLogTimestamp(maxInter);
    minDate=cache.getLogTimestamp(minInter);
    if (maxInter - minInter <= 1) {
      if (sortAscending) {
        if (date > maxDate) {
          return maxInter + 1;
        }
 else         if (date < minDate) {
          return minInter;
        }
 else {
          return maxInter;
        }
      }
 else {
        if (date > minDate) {
          return minInter;
        }
 else         if (date < maxDate) {
          return maxInter + 1;
        }
 else {
          return maxInter;
        }
      }
    }
    middle=minInter + (maxInter - minInter) / 2;
    long dateShift=date - cache.getLogTimestamp(middle);
    if (sortAscending) {
      if (dateShift >= 0) {
        minInter=middle;
        continue;
      }
 else       if (dateShift < 0) {
        maxInter=middle;
        continue;
      }
    }
 else {
      if (dateShift >= 0) {
        maxInter=middle;
        continue;
      }
 else       if (dateShift < 0) {
        minInter=middle;
        continue;
      }
    }
  }
 while (true);
}

Fixed version (ground truth):
/** 
 * When the logs are ordered by entry type, it finds the position in the ordered list where the log has to be inserted. The algoritm has logaritmic complexity
 * @param The entry type of the log to be inserted
 * @return The position log to insert in the visible logs
 */
private int findPosLogarthmicDate(long date){
  int minInter=0;
  int maxInter=visibleLogs.size() - 1;
  int middle=0;
  long maxDate;
  long minDate;
  boolean sortAscending=comparator.isSortAscending();
  int iter=0;
  do {
    maxDate=cache.getLogTimestamp(visibleLogs.get(maxInter));
    minDate=cache.getLogTimestamp(visibleLogs.get(minInter));
    if (maxInter - minInter <= 1) {
      if (sortAscending) {
        if (date >= maxDate) {
          return maxInter + 1;
        }
 else         if (date < minDate) {
          return minInter;
        }
 else {
          return maxInter;
        }
      }
 else {
        if (date >= minDate) {
          return minInter;
        }
 else         if (date >= maxDate) {
          return maxInter;
        }
 else {
          return maxInter + 1;
        }
      }
    }
    middle=minInter + (maxInter - minInter) / 2;
    long dateShift=date - cache.getLogTimestamp(visibleLogs.get(middle));
    if (sortAscending) {
      if (dateShift >= 0) {
        minInter=middle;
        continue;
      }
 else {
        maxInter=middle;
        continue;
      }
    }
 else {
      if (dateShift >= 0) {
        maxInter=middle;
        continue;
      }
 else {
        minInter=middle;
        continue;
      }
    }
  }
 while (true);
}
Program: 135045
Project: 135045
Buggy source:
/** 
 * Compare the entries with the given position in the cache It works only for TIMESTAMP and ENTRYTYPE because the cache has two arrays and there is no need to load the log
 * @param fisrt The index of the first item to compare
 * @param second The index of the second item to compare
 * @return 
 */
private int fastCompare(int first,int second){
  long firstVal;
  long secondVal;
  if (fieldIndex == ILogEntry.FIELD_TIMESTAMP) {
    firstVal=(Long)cache.getLogTimestamp(first);
    secondVal=(Long)cache.getLogTimestamp(second);
  }
 else {
    firstVal=(Integer)cache.getLogType(first);
    secondVal=(Integer)cache.getLogType(second);
  }
  if (firstVal == secondVal) {
    return 0;
  }
  int ret=(secondVal > firstVal) ? 1 : 1;
  if (sortAscending) {
    return -1 * ret;
  }
 else {
    return ret;
  }
}

Fixed version (ground truth):
/** 
 * Compare the entries with the given position in the cache It works only for TIMESTAMP and ENTRYTYPE because the cache has two arrays and there is no need to load the log
 * @param fisrt The index of the first item to compare
 * @param second The index of the second item to compare
 * @return 
 */
private int fastCompare(int first,int second){
  long firstVal;
  long secondVal;
  if (fieldIndex == ILogEntry.FIELD_TIMESTAMP) {
    firstVal=(Long)cache.getLogTimestamp(first);
    secondVal=(Long)cache.getLogTimestamp(second);
  }
 else {
    firstVal=(Integer)cache.getLogType(first);
    secondVal=(Integer)cache.getLogType(second);
  }
  if (firstVal == secondVal) {
    return 0;
  }
  int ret=(secondVal > firstVal) ? 1 : -1;
  if (sortAscending) {
    return -1 * ret;
  }
 else {
    return ret;
  }
}
Program: 135046
Project: 135046
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: 135047
Project: 135047
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: 135048
Project: 135048
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: 135049
Project: 135049
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: 135050
Project: 135050
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: 135051
Project: 135051
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: 135052
Project: 135052
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);
}