nus-yam/ex-repair huggingface dataset:
Program: 90609
Project: 90609
Buggy source:
@Override public StackTraceElement deserialize(final JsonParser jp,final DeserializationContext ctxt) throws IOException, JsonProcessingException {
  JsonToken t=jp.getCurrentToken();
  if (t == JsonToken.START_OBJECT) {
    String className=null, methodName=null, fileName=null;
    int lineNumber=-1;
    while ((t=jp.nextValue()) != JsonToken.END_OBJECT) {
      final String propName=jp.getCurrentName();
      if ("String_Node_Str".equals(propName)) {
        className=jp.getText();
      }
 else       if ("String_Node_Str".equals(propName)) {
        fileName=jp.getText();
      }
 else       if ("String_Node_Str".equals(propName)) {
        if (t.isNumeric()) {
          lineNumber=jp.getIntValue();
        }
 else {
          try {
            lineNumber=Integer.valueOf(jp.getText().trim()).intValue();
          }
 catch (          final NumberFormatException e) {
            throw JsonMappingException.from(jp,"String_Node_Str" + t + "String_Node_Str",e);
          }
        }
      }
 else       if ("String_Node_Str".equals(propName)) {
        methodName=jp.getText();
      }
 else       if ("String_Node_Str".equals(propName)) {
      }
 else {
        this.handleUnknownProperty(jp,ctxt,this._valueClass,propName);
      }
    }
    return new StackTraceElement(className,methodName,fileName,lineNumber);
  }
  throw ctxt.mappingException(this._valueClass,t);
}

Fixed version (ground truth):
@Override public StackTraceElement deserialize(final JsonParser jp,final DeserializationContext ctxt) throws IOException, JsonProcessingException {
  JsonToken t=jp.getCurrentToken();
  if (t == JsonToken.START_OBJECT) {
    String className=null, methodName=null, fileName=null;
    int lineNumber=-1;
    while ((t=jp.nextValue()) != JsonToken.END_OBJECT) {
      final String propName=jp.getCurrentName();
      if ("String_Node_Str".equals(propName)) {
        className=jp.getText();
      }
 else       if ("String_Node_Str".equals(propName)) {
        fileName=jp.getText();
      }
 else       if ("String_Node_Str".equals(propName)) {
        if (t.isNumeric()) {
          lineNumber=jp.getIntValue();
        }
 else {
          try {
            lineNumber=Integer.parseInt(jp.getText().trim());
          }
 catch (          final NumberFormatException e) {
            throw JsonMappingException.from(jp,"String_Node_Str" + t + "String_Node_Str",e);
          }
        }
      }
 else       if ("String_Node_Str".equals(propName)) {
        methodName=jp.getText();
      }
 else       if ("String_Node_Str".equals(propName)) {
      }
 else {
        this.handleUnknownProperty(jp,ctxt,this._valueClass,propName);
      }
    }
    return new StackTraceElement(className,methodName,fileName,lineNumber);
  }
  throw ctxt.mappingException(this._valueClass,t);
}
Program: 90610
Project: 90610
Buggy source:
@Setup(Level.Trial) public void up(){
  new File("String_Node_Str").delete();
  System.setProperty("String_Node_Str","String_Node_Str");
  logger=LogManager.getLogger(getClass());
  formatterLogger=LogManager.getLogger("String_Node_Str");
}

Fixed version (ground truth):
@Setup(Level.Trial) public void up(){
  new File("String_Node_Str").delete();
  System.setProperty("String_Node_Str","String_Node_Str");
  logger=LogManager.getLogger(getClass());
  formatterLogger=LogManager.getLogger("String_Node_Str",new StringFormatterMessageFactory());
}
Program: 90611
Project: 90611
Buggy source:
private <E extends Enum<E>>TypeConverter<? extends E> registerEnumType(final Type type){
  @SuppressWarnings("String_Node_Str") final TypeConverter<E> converter=new EnumConverter<E>((Class<E>)type);
  registry.putIfAbsent(type,converter);
  return converter;
}

Fixed version (ground truth):
private <E extends Enum<E>>TypeConverter<? extends E> registerEnumType(final Class<E> type){
  final TypeConverter<E> converter=new EnumConverter<E>(type);
  registry.putIfAbsent(type,converter);
  return converter;
}
Program: 90612
Project: 90612
Buggy source:
/** 
 * Finds a   {@link TypeConverter} for the given {@link Type}, falling back to an assignment-compatible TypeConverter if none exist for the given type. That is, if the given Type does not have a TypeConverter, but another Type which can be assigned to the given Type <em>does</em> have a TypeConverter, then that TypeConverter will be used and registered.
 * @param type the Type to find a TypeConverter for (must not be {@code null}).
 * @return a TypeConverter for the given Type.
 * @throws UnknownFormatConversionException if no TypeConverter can be found for the given type.
 */
public TypeConverter<?> findCompatibleConverter(final Type type){
  Assert.requireNonNull(type,"String_Node_Str");
  final TypeConverter<?> primary=registry.get(type);
  if (primary != null) {
    return primary;
  }
  if (type instanceof Class<?> && ((Class<?>)type).isEnum()) {
    return registerEnumType(type);
  }
  for (  final Map.Entry<Type,TypeConverter<?>> entry : registry.entrySet()) {
    final Type key=entry.getKey();
    if (TypeUtil.isAssignable(type,key)) {
      LOGGER.debug("String_Node_Str",key,type);
      final TypeConverter<?> value=entry.getValue();
      registry.putIfAbsent(type,value);
      return value;
    }
  }
  throw new UnknownFormatConversionException(type.toString());
}

Fixed version (ground truth):
/** 
 * Finds a   {@link TypeConverter} for the given {@link Type}, falling back to an assignment-compatible TypeConverter if none exist for the given type. That is, if the given Type does not have a TypeConverter, but another Type which can be assigned to the given Type <em>does</em> have a TypeConverter, then that TypeConverter will be used and registered.
 * @param type the Type to find a TypeConverter for (must not be {@code null}).
 * @return a TypeConverter for the given Type.
 * @throws UnknownFormatConversionException if no TypeConverter can be found for the given type.
 */
public TypeConverter<?> findCompatibleConverter(final Type type){
  Assert.requireNonNull(type,"String_Node_Str");
  final TypeConverter<?> primary=registry.get(type);
  if (primary != null) {
    return primary;
  }
  if (type instanceof Class<?> && ((Class<?>)type).isEnum()) {
    return registerEnumType(((Class<?>)type).asSubclass(Enum.class));
  }
  for (  final Map.Entry<Type,TypeConverter<?>> entry : registry.entrySet()) {
    final Type key=entry.getKey();
    if (TypeUtil.isAssignable(type,key)) {
      LOGGER.debug("String_Node_Str",key,type);
      final TypeConverter<?> value=entry.getValue();
      registry.putIfAbsent(type,value);
      return value;
    }
  }
  throw new UnknownFormatConversionException(type.toString());
}
Program: 90613
Project: 90613
Buggy source:
@Override public void logMessage(final String fqcn,final Level level,final Marker marker,final Message message,final Throwable t){
  if (locationAwareLogger != null) {
    if (message instanceof LoggerNameAwareMessage) {
      ((LoggerNameAwareMessage)message).setLoggerName(getName());
    }
    locationAwareLogger.log(getMarker(marker),fqcn,convertLevel(level),message.getFormattedMessage(),message.getParameters(),t);
  }
 else {
switch (level.getStandardLevel()) {
case DEBUG:
      logger.debug(fqcn,getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
    break;
case TRACE:
  logger.trace(fqcn,getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
case INFO:
logger.info(fqcn,getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
case WARN:
logger.warn(fqcn,getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
case ERROR:
logger.error(fqcn,getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
default :
logger.error(fqcn,getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
}
}
}

Fixed version (ground truth):
@Override public void logMessage(final String fqcn,final Level level,final Marker marker,final Message message,final Throwable t){
  if (locationAwareLogger != null) {
    if (message instanceof LoggerNameAwareMessage) {
      ((LoggerNameAwareMessage)message).setLoggerName(getName());
    }
    locationAwareLogger.log(getMarker(marker),fqcn,convertLevel(level),message.getFormattedMessage(),message.getParameters(),t);
  }
 else {
switch (level.getStandardLevel()) {
case DEBUG:
      logger.debug(getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
    break;
case TRACE:
  logger.trace(getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
case INFO:
logger.info(getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
case WARN:
logger.warn(getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
case ERROR:
logger.error(getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
default :
logger.error(getMarker(marker),message.getFormattedMessage(),message.getParameters(),t);
break;
}
}
}
Program: 90614
Project: 90614
Buggy source:
public MessageFormatMessage(final String messagePattern,final Object... arguments){
  this.messagePattern=messagePattern;
  this.argArray=arguments;
  if (arguments != null && arguments.length > 0 && arguments[arguments.length - 1] instanceof Throwable) {
    this.throwable=(Throwable)arguments[arguments.length - 1];
  }
  getFormattedMessage();
}

Fixed version (ground truth):
public MessageFormatMessage(final String messagePattern,final Object... arguments){
  this.messagePattern=messagePattern;
  this.argArray=arguments;
  if (arguments != null && arguments.length > 0 && arguments[arguments.length - 1] instanceof Throwable) {
    this.throwable=(Throwable)arguments[arguments.length - 1];
  }
}
Program: 90615
Project: 90615
Buggy source:
/** 
 * Create the ObjectMessage.
 * @param obj The Object to format.
 */
public ObjectMessage(Object obj){
  if (obj == null) {
    obj="String_Node_Str";
  }
  this.obj=obj;
  objectString=String.valueOf(obj);
}

Fixed version (ground truth):
/** 
 * Create the ObjectMessage.
 * @param obj The Object to format.
 */
public ObjectMessage(Object obj){
  if (obj == null) {
    obj="String_Node_Str";
  }
  this.obj=obj;
}
Program: 90616
Project: 90616
Buggy source:
private void writeObject(final ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  if (obj instanceof Serializable) {
    out.writeObject(obj);
  }
 else {
    out.writeObject(obj.toString());
  }
}

Fixed version (ground truth):
private void writeObject(final ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  if (obj instanceof Serializable) {
    out.writeObject(obj);
  }
 else {
    out.writeObject(String.valueOf(obj));
  }
}
Program: 90617
Project: 90617
Buggy source:
@Override public boolean equals(final Object o){
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  final ObjectMessage that=(ObjectMessage)o;
  return !(obj != null ? !obj.equals(that.obj) : that.obj != null);
}

Fixed version (ground truth):
@Override public boolean equals(final Object o){
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  final ObjectMessage that=(ObjectMessage)o;
  return obj == null ? that.obj == null : obj.equals(that.obj);
}
Program: 90618
Project: 90618
Buggy source:
/** 
 * Returns the formatted object message.
 * @return the formatted object message.
 */
@Override public String getFormattedMessage(){
  return objectString;
}

Fixed version (ground truth):
/** 
 * Returns the formatted object message.
 * @return the formatted object message.
 */
@Override public String getFormattedMessage(){
  if (objectString == null) {
    objectString=String.valueOf(obj);
  }
  return objectString;
}
Program: 90619
Project: 90619
Buggy source:
/** 
 * Returns the object formatted using its toString method.
 * @return the String representation of the object.
 */
@Override public String getFormat(){
  return objectString;
}

Fixed version (ground truth):
/** 
 * Returns the object formatted using its toString method.
 * @return the String representation of the object.
 */
@Override public String getFormat(){
  return getFormattedMessage();
}
Program: 90620
Project: 90620
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + objectString + ']';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + getFormattedMessage() + ']';
}
Program: 90621
Project: 90621
Buggy source:
public StringFormattedMessage(final String messagePattern,final Object... arguments){
  this.messagePattern=messagePattern;
  this.argArray=arguments;
  if (arguments != null && arguments.length > 0 && arguments[arguments.length - 1] instanceof Throwable) {
    this.throwable=(Throwable)arguments[arguments.length - 1];
  }
  getFormattedMessage();
}

Fixed version (ground truth):
public StringFormattedMessage(final String messagePattern,final Object... arguments){
  this.messagePattern=messagePattern;
  this.argArray=arguments;
  if (arguments != null && arguments.length > 0 && arguments[arguments.length - 1] instanceof Throwable) {
    this.throwable=(Throwable)arguments[arguments.length - 1];
  }
}
Program: 90622
Project: 90622
Buggy source:
/** 
 * Actual writing occurs here. <p/>
 * @param logEvent The LogEvent.
 */
@Override public void append(LogEvent logEvent){
  if (!isStarted()) {
    throw new IllegalStateException("String_Node_Str" + getName() + "String_Node_Str");
  }
  if (!(logEvent instanceof Log4jLogEvent)) {
    if (!(logEvent instanceof RingBufferLogEvent)) {
      return;
    }
    logEvent=((RingBufferLogEvent)logEvent).createMemento();
  }
  final Log4jLogEvent coreEvent=(Log4jLogEvent)logEvent;
  boolean appendSuccessful=false;
  if (blocking) {
    if (isAppenderThread.get() == Boolean.TRUE && queue.remainingCapacity() == 0) {
      coreEvent.setEndOfBatch(false);
      appendSuccessful=thread.callAppenders(coreEvent);
    }
 else {
      try {
        queue.put(Log4jLogEvent.serialize(coreEvent,includeLocation));
        appendSuccessful=true;
      }
 catch (      final InterruptedException e) {
        LOGGER.warn("String_Node_Str",getName());
      }
    }
  }
 else {
    appendSuccessful=queue.offer(Log4jLogEvent.serialize(coreEvent,includeLocation));
    if (!appendSuccessful) {
      error("String_Node_Str" + getName() + "String_Node_Str");
    }
  }
  if (!appendSuccessful && errorAppender != null) {
    errorAppender.callAppender(coreEvent);
  }
}

Fixed version (ground truth):
/** 
 * Actual writing occurs here. <p/>
 * @param logEvent The LogEvent.
 */
@Override public void append(LogEvent logEvent){
  if (!isStarted()) {
    throw new IllegalStateException("String_Node_Str" + getName() + "String_Node_Str");
  }
  if (!(logEvent instanceof Log4jLogEvent)) {
    if (!(logEvent instanceof RingBufferLogEvent)) {
      return;
    }
    logEvent=((RingBufferLogEvent)logEvent).createMemento();
  }
  logEvent.getMessage().getFormattedMessage();
  final Log4jLogEvent coreEvent=(Log4jLogEvent)logEvent;
  boolean appendSuccessful=false;
  if (blocking) {
    if (isAppenderThread.get() == Boolean.TRUE && queue.remainingCapacity() == 0) {
      coreEvent.setEndOfBatch(false);
      appendSuccessful=thread.callAppenders(coreEvent);
    }
 else {
      try {
        queue.put(Log4jLogEvent.serialize(coreEvent,includeLocation));
        appendSuccessful=true;
      }
 catch (      final InterruptedException e) {
        LOGGER.warn("String_Node_Str",getName());
      }
    }
  }
 else {
    appendSuccessful=queue.offer(Log4jLogEvent.serialize(coreEvent,includeLocation));
    if (!appendSuccessful) {
      error("String_Node_Str" + getName() + "String_Node_Str");
    }
  }
  if (!appendSuccessful && errorAppender != null) {
    errorAppender.callAppender(coreEvent);
  }
}
Program: 90623
Project: 90623
Buggy source:
@Override public void logMessage(final String fqcn,final Level level,final Marker marker,final Message message,final Throwable thrown){
  Info info=threadlocalInfo.get();
  if (info == null) {
    info=new Info(new RingBufferLogEventTranslator(),Thread.currentThread().getName(),false);
    threadlocalInfo.set(info);
  }
  final Disruptor<RingBufferLogEvent> temp=disruptor;
  if (temp == null) {
    LOGGER.fatal("String_Node_Str");
    return;
  }
  if (info.isAppenderThread && temp.getRingBuffer().remainingCapacity() == 0) {
    config.loggerConfig.log(getName(),fqcn,marker,level,message,thrown);
    return;
  }
  final boolean includeLocation=config.loggerConfig.isIncludeLocation();
  info.translator.setValues(this,getName(),marker,fqcn,level,message,thrown,ThreadContext.getImmutableContext(),ThreadContext.getImmutableStack(),THREAD_NAME_STRATEGY.getThreadName(info),includeLocation ? location(fqcn) : null,message instanceof TimestampMessage ? ((TimestampMessage)message).getTimestamp() : clock.currentTimeMillis());
  try {
    disruptor.publishEvent(info.translator);
  }
 catch (  final NullPointerException npe) {
    LOGGER.fatal("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void logMessage(final String fqcn,final Level level,final Marker marker,final Message message,final Throwable thrown){
  Info info=threadlocalInfo.get();
  if (info == null) {
    info=new Info(new RingBufferLogEventTranslator(),Thread.currentThread().getName(),false);
    threadlocalInfo.set(info);
  }
  final Disruptor<RingBufferLogEvent> temp=disruptor;
  if (temp == null) {
    LOGGER.fatal("String_Node_Str");
    return;
  }
  if (info.isAppenderThread && temp.getRingBuffer().remainingCapacity() == 0) {
    config.loggerConfig.log(getName(),fqcn,marker,level,message,thrown);
    return;
  }
  message.getFormattedMessage();
  final boolean includeLocation=config.loggerConfig.isIncludeLocation();
  info.translator.setValues(this,getName(),marker,fqcn,level,message,thrown,ThreadContext.getImmutableContext(),ThreadContext.getImmutableStack(),THREAD_NAME_STRATEGY.getThreadName(info),includeLocation ? location(fqcn) : null,message instanceof TimestampMessage ? ((TimestampMessage)message).getTimestamp() : clock.currentTimeMillis());
  try {
    disruptor.publishEvent(info.translator);
  }
 catch (  final NullPointerException npe) {
    LOGGER.fatal("String_Node_Str");
  }
}
Program: 90624
Project: 90624
Buggy source:
/** 
 * If possible, delegates the invocation to   {@code callAppenders} to anotherthread and returns  {@code true}. If this is not possible (if it detects that delegating to another thread would cause deadlock because the current call to Logger.log() originated from the appender thread and the ringbuffer is full) then this method does nothing and returns   {@code false}. It is the responsibility of the caller to process the event when this method returns   {@code false}.
 * @param event the event to delegate to another thread
 * @return {@code true} if delegation was successful, {@code false} if thecalling thread needs to process the event itself
 */
public boolean callAppendersFromAnotherThread(final LogEvent event){
  final Disruptor<Log4jEventWrapper> temp=disruptor;
  if (temp == null) {
    LOGGER.fatal("String_Node_Str");
    return true;
  }
  if (isAppenderThread.get() == Boolean.TRUE && temp.getRingBuffer().remainingCapacity() == 0) {
    return false;
  }
  try {
    LogEvent logEvent=event;
    if (event instanceof RingBufferLogEvent) {
      logEvent=((RingBufferLogEvent)event).createMemento();
    }
    disruptor.getRingBuffer().publishEvent(translator,logEvent,asyncLoggerConfig);
  }
 catch (  final NullPointerException npe) {
    LOGGER.fatal("String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
/** 
 * If possible, delegates the invocation to   {@code callAppenders} to anotherthread and returns  {@code true}. If this is not possible (if it detects that delegating to another thread would cause deadlock because the current call to Logger.log() originated from the appender thread and the ringbuffer is full) then this method does nothing and returns   {@code false}. It is the responsibility of the caller to process the event when this method returns   {@code false}.
 * @param event the event to delegate to another thread
 * @return {@code true} if delegation was successful, {@code false} if thecalling thread needs to process the event itself
 */
public boolean callAppendersFromAnotherThread(final LogEvent event){
  final Disruptor<Log4jEventWrapper> temp=disruptor;
  if (temp == null) {
    LOGGER.fatal("String_Node_Str");
    return true;
  }
  if (isAppenderThread.get() == Boolean.TRUE && temp.getRingBuffer().remainingCapacity() == 0) {
    return false;
  }
  try {
    LogEvent logEvent=event;
    if (event instanceof RingBufferLogEvent) {
      logEvent=((RingBufferLogEvent)event).createMemento();
    }
    logEvent.getMessage().getFormattedMessage();
    disruptor.getRingBuffer().publishEvent(translator,logEvent,asyncLoggerConfig);
  }
 catch (  final NullPointerException npe) {
    LOGGER.fatal("String_Node_Str");
  }
  return true;
}
Program: 90625
Project: 90625
Buggy source:
private URI getConfigURI(final String location){
  try {
    String configLocation=location;
    if (configLocation == null) {
      final String[] paths=SetUtils.prefixSet(servletContext.getResourcePaths("String_Node_Str"),"String_Node_Str");
      if (paths.length == 1) {
        configLocation=paths[0];
      }
 else       if (paths.length > 1) {
        final String prefix="String_Node_Str" + this.name + "String_Node_Str";
        final boolean found=false;
        for (        final String str : paths) {
          if (str.startsWith(prefix)) {
            configLocation=str;
            break;
          }
        }
        if (!found) {
          configLocation=paths[0];
        }
      }
    }
    if (configLocation != null) {
      final URL url=servletContext.getResource(configLocation);
      if (url != null) {
        return url.toURI();
      }
    }
  }
 catch (  final Exception ex) {
  }
  if (location != null) {
    try {
      return FileUtils.getCorrectedFilePathUri(location);
    }
 catch (    final Exception e) {
      this.servletContext.log("String_Node_Str" + location + "String_Node_Str",e);
    }
  }
  return null;
}

Fixed version (ground truth):
private URI getConfigURI(final String location){
  try {
    String configLocation=location;
    if (configLocation == null) {
      final String[] paths=SetUtils.prefixSet(servletContext.getResourcePaths("String_Node_Str"),"String_Node_Str");
      if (paths.length == 1) {
        configLocation=paths[0];
      }
 else       if (paths.length > 1) {
        final String prefix="String_Node_Str" + this.name + "String_Node_Str";
        boolean found=false;
        for (        final String str : paths) {
          if (str.startsWith(prefix)) {
            configLocation=str;
            found=true;
            break;
          }
        }
        if (!found) {
          configLocation=paths[0];
        }
      }
    }
    if (configLocation != null) {
      final URL url=servletContext.getResource(configLocation);
      if (url != null) {
        return url.toURI();
      }
    }
  }
 catch (  final Exception ex) {
  }
  if (location != null) {
    try {
      return FileUtils.getCorrectedFilePathUri(location);
    }
 catch (    final Exception e) {
      this.servletContext.log("String_Node_Str" + location + "String_Node_Str",e);
    }
  }
  return null;
}
Program: 90626
Project: 90626
Buggy source:
/** 
 * Returns a copy of the ContextStack.
 * @return a copy of the ContextStack.s
 */
ContextStack copy();

Fixed version (ground truth):
/** 
 * Returns a copy of the ContextStack.
 * @return a copy of the ContextStack.
 */
ContextStack copy();
Program: 90627
Project: 90627
Buggy source:
/** 
 * Gets an immutable copy of this current thread's context stack.
 * @return an immutable copy of the ThreadContext stack.
 */
public static ContextStack getImmutableStack(){
  return contextStack;
}

Fixed version (ground truth):
/** 
 * Gets an immutable copy of this current thread's context stack.
 * @return an immutable copy of the ThreadContext stack.
 */
public static ContextStack getImmutableStack(){
  ContextStack result=contextStack.getImmutableStackOrNull();
  return result == null ? EMPTY_STACK : result;
}
Program: 90628
Project: 90628
Buggy source:
@Override public boolean add(final String s){
  if (!useStack) {
    return false;
  }
  final List<String> list=stack.get();
  final List<String> copy=list == null ? new ArrayList<String>() : new ArrayList<String>(list);
  copy.add(s);
  stack.set(Collections.unmodifiableList(copy));
  return true;
}

Fixed version (ground truth):
@Override public boolean add(final String s){
  if (!useStack) {
    return false;
  }
  final MutableThreadContextStack copy=getNonNullStackCopy();
  copy.add(s);
  copy.freeze();
  stack.set(copy);
  return true;
}
Program: 90629
Project: 90629
Buggy source:
@Override public int getDepth(){
  final List<String> list=stack.get();
  return list == null ? 0 : list.size();
}

Fixed version (ground truth):
@Override public int getDepth(){
  final MutableThreadContextStack values=stack.get();
  return values == null ? 0 : values.getDepth();
}
Program: 90630
Project: 90630
Buggy source:
@Override public boolean containsAll(final Collection<?> objects){
  if (objects.isEmpty()) {
    return true;
  }
  final List<String> list=stack.get();
  return list != null && list.containsAll(objects);
}

Fixed version (ground truth):
@Override public boolean containsAll(final Collection<?> objects){
  if (objects.isEmpty()) {
    return true;
  }
  final MutableThreadContextStack values=stack.get();
  return values != null && values.containsAll(objects);
}
Program: 90631
Project: 90631
Buggy source:
@Override public boolean isEmpty(){
  final List<String> result=stack.get();
  return result == null || result.isEmpty();
}

Fixed version (ground truth):
@Override public boolean isEmpty(){
  final MutableThreadContextStack values=stack.get();
  return values == null || values.isEmpty();
}
Program: 90632
Project: 90632
Buggy source:
@Override public List<String> asList(){
  final List<String> list=stack.get();
  if (list == null) {
    return Collections.emptyList();
  }
  return list;
}

Fixed version (ground truth):
@Override public List<String> asList(){
  final MutableThreadContextStack values=stack.get();
  if (values == null) {
    return Collections.emptyList();
  }
  return values.asList();
}
Program: 90633
Project: 90633
Buggy source:
@Override public boolean remove(final Object o){
  if (!useStack) {
    return false;
  }
  final List<String> list=stack.get();
  if (list == null || list.size() == 0) {
    return false;
  }
  final List<String> copy=new ArrayList<String>(list);
  final boolean result=copy.remove(o);
  stack.set(Collections.unmodifiableList(copy));
  return result;
}

Fixed version (ground truth):
@Override public boolean remove(final Object o){
  if (!useStack) {
    return false;
  }
  final MutableThreadContextStack values=stack.get();
  if (values == null || values.size() == 0) {
    return false;
  }
  final MutableThreadContextStack copy=(MutableThreadContextStack)values.copy();
  final boolean result=copy.remove(o);
  copy.freeze();
  stack.set(copy);
  return result;
}
Program: 90634
Project: 90634
Buggy source:
@Override public String peek(){
  final List<String> list=stack.get();
  if (list == null || list.size() == 0) {
    return null;
  }
  final int last=list.size() - 1;
  return list.get(last);
}

Fixed version (ground truth):
@Override public String peek(){
  final MutableThreadContextStack values=stack.get();
  if (values == null || values.size() == 0) {
    return null;
  }
  return values.peek();
}
Program: 90635
Project: 90635
Buggy source:
@Override public String pop(){
  if (!useStack) {
    return Strings.EMPTY;
  }
  final List<String> list=stack.get();
  if (list == null || list.size() == 0) {
    throw new NoSuchElementException("String_Node_Str");
  }
  final List<String> copy=new ArrayList<String>(list);
  final int last=copy.size() - 1;
  final String result=copy.remove(last);
  stack.set(Collections.unmodifiableList(copy));
  return result;
}

Fixed version (ground truth):
@Override public String pop(){
  if (!useStack) {
    return Strings.EMPTY;
  }
  final MutableThreadContextStack values=stack.get();
  if (values == null || values.size() == 0) {
    throw new NoSuchElementException("String_Node_Str");
  }
  final MutableThreadContextStack copy=(MutableThreadContextStack)values.copy();
  final String result=copy.pop();
  copy.freeze();
  stack.set(copy);
  return result;
}
Program: 90636
Project: 90636
Buggy source:
@Override public boolean contains(final Object o){
  final List<String> result=stack.get();
  return result != null && result.contains(o);
}

Fixed version (ground truth):
@Override public boolean contains(final Object o){
  final MutableThreadContextStack values=stack.get();
  return values != null && values.contains(o);
}
Program: 90637
Project: 90637
Buggy source:
@Override public Iterator<String> iterator(){
  final List<String> immutable=stack.get();
  if (immutable == null) {
    final List<String> empty=Collections.emptyList();
    return empty.iterator();
  }
  return immutable.iterator();
}

Fixed version (ground truth):
@Override public Iterator<String> iterator(){
  final MutableThreadContextStack values=stack.get();
  if (values == null) {
    final List<String> empty=Collections.emptyList();
    return empty.iterator();
  }
  return values.iterator();
}
Program: 90638
Project: 90638
Buggy source:
@Override public boolean removeAll(final Collection<?> objects){
  if (!useStack || objects.isEmpty()) {
    return false;
  }
  final List<String> list=stack.get();
  if (list == null || list.isEmpty()) {
    return false;
  }
  final List<String> copy=new ArrayList<String>(list);
  final boolean result=copy.removeAll(objects);
  stack.set(Collections.unmodifiableList(copy));
  return result;
}

Fixed version (ground truth):
@Override public boolean removeAll(final Collection<?> objects){
  if (!useStack || objects.isEmpty()) {
    return false;
  }
  final MutableThreadContextStack values=stack.get();
  if (values == null || values.isEmpty()) {
    return false;
  }
  final MutableThreadContextStack copy=(MutableThreadContextStack)values.copy();
  final boolean result=copy.removeAll(objects);
  copy.freeze();
  stack.set(copy);
  return result;
}
Program: 90639
Project: 90639
Buggy source:
@Override public int size(){
  final List<String> result=stack.get();
  return result == null ? 0 : result.size();
}

Fixed version (ground truth):
@Override public int size(){
  final MutableThreadContextStack values=stack.get();
  return values == null ? 0 : values.size();
}
Program: 90640
Project: 90640
Buggy source:
@Override public void trim(final int depth){
  if (depth < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final List<String> list=stack.get();
  if (list == null) {
    return;
  }
  final List<String> copy=new ArrayList<String>();
  final int count=Math.min(depth,list.size());
  for (int i=0; i < count; i++) {
    copy.add(list.get(i));
  }
  stack.set(copy);
}

Fixed version (ground truth):
@Override public void trim(final int depth){
  if (depth < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final MutableThreadContextStack values=stack.get();
  if (values == null) {
    return;
  }
  final MutableThreadContextStack copy=(MutableThreadContextStack)values.copy();
  copy.trim(depth);
  copy.freeze();
  stack.set(copy);
}
Program: 90641
Project: 90641
Buggy source:
@Override public boolean addAll(final Collection<? extends String> strings){
  if (!useStack || strings.isEmpty()) {
    return false;
  }
  final List<String> list=stack.get();
  final List<String> copy=list == null ? new ArrayList<String>() : new ArrayList<String>(list);
  copy.addAll(strings);
  stack.set(Collections.unmodifiableList(copy));
  return true;
}

Fixed version (ground truth):
@Override public boolean addAll(final Collection<? extends String> strings){
  if (!useStack || strings.isEmpty()) {
    return false;
  }
  final MutableThreadContextStack copy=getNonNullStackCopy();
  copy.addAll(strings);
  copy.freeze();
  stack.set(copy);
  return true;
}
Program: 90642
Project: 90642
Buggy source:
@Override public int hashCode(){
  final List<String> list=stack.get();
  final int prime=31;
  int result=1;
  result=prime * result + ((list == null) ? 0 : list.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final MutableThreadContextStack values=stack.get();
  final int prime=31;
  int result=1;
  result=prime * result + ((values == null) ? 0 : values.hashCode());
  return result;
}
Program: 90643
Project: 90643
Buggy source:
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (obj instanceof DefaultThreadContextStack) {
    final DefaultThreadContextStack other=(DefaultThreadContextStack)obj;
    if (this.useStack != other.useStack) {
      return false;
    }
  }
  if (!(obj instanceof ThreadContextStack)) {
    return false;
  }
  final ThreadContextStack other=(ThreadContextStack)obj;
  final List<String> otherAsList=other.asList();
  final List<String> list=stack.get();
  if (list == null) {
    if (otherAsList != null) {
      return false;
    }
  }
 else   if (!list.equals(otherAsList)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (obj instanceof DefaultThreadContextStack) {
    final DefaultThreadContextStack other=(DefaultThreadContextStack)obj;
    if (this.useStack != other.useStack) {
      return false;
    }
  }
  if (!(obj instanceof ThreadContextStack)) {
    return false;
  }
  final ThreadContextStack other=(ThreadContextStack)obj;
  final MutableThreadContextStack values=stack.get();
  if (values == null) {
    return other == null;
  }
  return values.equals(other);
}
Program: 90644
Project: 90644
Buggy source:
@Override public <T>T[] toArray(final T[] ts){
  final List<String> result=stack.get();
  if (result == null) {
    if (ts.length > 0) {
      ts[0]=null;
    }
    return ts;
  }
  return result.toArray(ts);
}

Fixed version (ground truth):
@Override public <T>T[] toArray(final T[] ts){
  final MutableThreadContextStack result=stack.get();
  if (result == null) {
    if (ts.length > 0) {
      ts[0]=null;
    }
    return ts;
  }
  return result.toArray(ts);
}
Program: 90645
Project: 90645
Buggy source:
@Override public String toString(){
  final List<String> list=stack.get();
  return list == null ? "String_Node_Str" : list.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  final MutableThreadContextStack values=stack.get();
  return values == null ? "String_Node_Str" : values.toString();
}
Program: 90646
Project: 90646
Buggy source:
@Override public ThreadContextStack copy(){
  List<String> result=null;
  if (!useStack || (result=stack.get()) == null) {
    return new MutableThreadContextStack(new ArrayList<String>());
  }
  return new MutableThreadContextStack(result);
}

Fixed version (ground truth):
@Override public ThreadContextStack copy(){
  MutableThreadContextStack values=null;
  if (!useStack || (values=stack.get()) == null) {
    return new MutableThreadContextStack();
  }
  return values.copy();
}
Program: 90647
Project: 90647
Buggy source:
@Override public boolean retainAll(final Collection<?> objects){
  if (!useStack || objects.isEmpty()) {
    return false;
  }
  final List<String> list=stack.get();
  if (list == null || list.isEmpty()) {
    return false;
  }
  final List<String> copy=new ArrayList<String>(list);
  final boolean result=copy.retainAll(objects);
  stack.set(Collections.unmodifiableList(copy));
  return result;
}

Fixed version (ground truth):
@Override public boolean retainAll(final Collection<?> objects){
  if (!useStack || objects.isEmpty()) {
    return false;
  }
  final MutableThreadContextStack values=stack.get();
  if (values == null || values.isEmpty()) {
    return false;
  }
  final MutableThreadContextStack copy=(MutableThreadContextStack)values.copy();
  final boolean result=copy.retainAll(objects);
  copy.freeze();
  stack.set(copy);
  return result;
}
Program: 90648
Project: 90648
Buggy source:
public BasicConfiguration(){
  final LoggerConfig root=getRootLogger();
  setName("String_Node_Str");
  final String levelName=System.getProperty(DEFAULT_LEVEL);
  final Level level=(levelName != null && Level.getLevel(levelName) != null) ? Level.getLevel(levelName) : Level.DEBUG;
  root.setLevel(level);
}

Fixed version (ground truth):
public BasicConfiguration(){
  super(ConfigurationSource.NULL_SOURCE);
  final LoggerConfig root=getRootLogger();
  setName("String_Node_Str");
  final String levelName=System.getProperty(DEFAULT_LEVEL);
  final Level level=(levelName != null && Level.getLevel(levelName) != null) ? Level.getLevel(levelName) : Level.DEBUG;
  root.setLevel(level);
}
Program: 90649
Project: 90649
Buggy source:
public synchronized void setConfigLocation(final URI configLocation){
  this.configLocation=configLocation;
  reconfigure();
}

Fixed version (ground truth):
/** 
 * Sets the configLocation to the specified value and reconfigures this context.
 * @param configLocation the location of the new configuration
 */
public synchronized void setConfigLocation(final URI configLocation){
  this.configLocation=configLocation;
  reconfigure();
}
Program: 90650
Project: 90650
Buggy source:
public synchronized URI getConfigLocation(){
  return configLocation;
}

Fixed version (ground truth):
/** 
 * Returns the initial configuration location or   {@code null}. The returned value may not be the location of the current configuration. Use   {@link #getConfiguration()}.  {@link Configuration#getConfigurationSource() getConfigurationSource()}.  {@link ConfigurationSource#getLocation() getLocation()} to get the actual source of the current configuration.
 * @return the initial configuration location or {@code null}
 */
public synchronized URI getConfigLocation(){
  return configLocation;
}
Program: 90651
Project: 90651
Buggy source:
/** 
 * Constructor.
 */
protected AbstractConfiguration(){
  componentMap.put(Configuration.CONTEXT_PROPERTIES,properties);
  pluginManager=new PluginManager("String_Node_Str");
  rootNode=new Node();
}

Fixed version (ground truth):
/** 
 * Constructor.
 */
protected AbstractConfiguration(final ConfigurationSource configurationSource){
  this.configurationSource=Assert.requireNonNull(configurationSource,"String_Node_Str");
  componentMap.put(Configuration.CONTEXT_PROPERTIES,properties);
  pluginManager=new PluginManager("String_Node_Str");
  rootNode=new Node();
}
Program: 90652
Project: 90652
Buggy source:
protected void createAdvertiser(String advertiserString,ConfigurationFactory.ConfigurationSource configSource,byte[] buffer,String contentType){
  if (advertiserString != null) {
    Node node=new Node(null,advertiserString,null);
    Map<String,String> attributes=node.getAttributes();
    attributes.put("String_Node_Str",new String(buffer));
    attributes.put("String_Node_Str",contentType);
    attributes.put("String_Node_Str","String_Node_Str");
    if (configSource.getLocation() != null) {
      attributes.put("String_Node_Str",configSource.getLocation());
    }
    advertiserNode=node;
  }
}

Fixed version (ground truth):
protected void createAdvertiser(String advertiserString,ConfigurationSource configSource,byte[] buffer,String contentType){
  if (advertiserString != null) {
    Node node=new Node(null,advertiserString,null);
    Map<String,String> attributes=node.getAttributes();
    attributes.put("String_Node_Str",new String(buffer));
    attributes.put("String_Node_Str",contentType);
    attributes.put("String_Node_Str","String_Node_Str");
    if (configSource.getLocation() != null) {
      attributes.put("String_Node_Str",configSource.getLocation());
    }
    advertiserNode=node;
  }
}
Program: 90653
Project: 90653
Buggy source:
/** 
 * Retrieve the configuration via the ClassLoader.
 * @param resource The resource to load.
 * @param loader The default ClassLoader to use.
 * @return The ConfigurationSource for the configuration.
 */
protected ConfigurationSource getInputFromResource(final String resource,final ClassLoader loader){
  final URL url=Loader.getResource(resource,loader);
  if (url == null) {
    return null;
  }
  InputStream is=null;
  try {
    is=url.openStream();
  }
 catch (  final IOException ioe) {
    LOGGER.catching(Level.DEBUG,ioe);
    return null;
  }
  if (is == null) {
    return null;
  }
  if (FileUtils.isFile(url)) {
    try {
      return new ConfigurationSource(is,FileUtils.fileFromUri(url.toURI()));
    }
 catch (    final URISyntaxException ex) {
      LOGGER.catching(Level.DEBUG,ex);
    }
  }
  return new ConfigurationSource(is,resource);
}

Fixed version (ground truth):
/** 
 * Retrieve the configuration via the ClassLoader.
 * @param resource The resource to load.
 * @param loader The default ClassLoader to use.
 * @return The ConfigurationSource for the configuration.
 */
protected ConfigurationSource getInputFromResource(final String resource,final ClassLoader loader){
  final URL url=Loader.getResource(resource,loader);
  if (url == null) {
    return null;
  }
  InputStream is=null;
  try {
    is=url.openStream();
  }
 catch (  final IOException ioe) {
    LOGGER.catching(Level.DEBUG,ioe);
    return null;
  }
  if (is == null) {
    return null;
  }
  if (FileUtils.isFile(url)) {
    try {
      return new ConfigurationSource(is,FileUtils.fileFromUri(url.toURI()));
    }
 catch (    final URISyntaxException ex) {
      LOGGER.catching(Level.DEBUG,ex);
    }
  }
  return new ConfigurationSource(is,url);
}
Program: 90655
Project: 90655
Buggy source:
/** 
 * Initialize the configuration.
 */
@Override public void start(){
  LOGGER.debug("String_Node_Str",this);
  this.setStarting();
  pluginManager.collectPlugins();
  final PluginManager levelPlugins=new PluginManager("String_Node_Str");
  levelPlugins.collectPlugins();
  final Map<String,PluginType<?>> plugins=levelPlugins.getPlugins();
  if (plugins != null) {
    for (    final PluginType<?> type : plugins.values()) {
      try {
        Loader.initializeClass(type.getPluginClass().getName(),type.getPluginClass().getClassLoader());
      }
 catch (      final Exception ex) {
        LOGGER.error("String_Node_Str",type.getPluginClass().getName(),ex.getClass().getSimpleName(),ex.getMessage());
      }
    }
  }
  setup();
  setupAdvertisement();
  doConfigure();
  for (  final LoggerConfig logger : loggers.values()) {
    logger.start();
  }
  for (  final Appender appender : appenders.values()) {
    appender.start();
  }
  root.start();
  super.start();
  LOGGER.debug("String_Node_Str",this);
}

Fixed version (ground truth):
/** 
 * Initialize the configuration.
 */
@Override public void start(){
  LOGGER.debug("String_Node_Str",this);
  this.setStarting();
  pluginManager.collectPlugins();
  final PluginManager levelPlugins=new PluginManager("String_Node_Str");
  levelPlugins.collectPlugins();
  final Map<String,PluginType<?>> plugins=levelPlugins.getPlugins();
  if (plugins != null) {
    for (    final PluginType<?> type : plugins.values()) {
      try {
        Loader.initializeClass(type.getPluginClass().getName(),type.getPluginClass().getClassLoader());
      }
 catch (      final Exception ex) {
        LOGGER.error("String_Node_Str",type.getPluginClass().getName(),ex.getClass().getSimpleName(),ex.getMessage());
      }
    }
  }
  setup();
  setupAdvertisement();
  doConfigure();
  final Set<LoggerConfig> alreadyStarted=new HashSet<LoggerConfig>();
  for (  final LoggerConfig logger : loggers.values()) {
    logger.start();
    alreadyStarted.add(logger);
  }
  for (  final Appender appender : appenders.values()) {
    appender.start();
  }
  if (!alreadyStarted.contains(root)) {
    root.start();
  }
  super.start();
  LOGGER.debug("String_Node_Str",this);
}
Program: 90657
Project: 90657
Buggy source:
@Ignore @Test public void testFlushAtEndOfBatch() throws Exception {
  final File file=new File("String_Node_Str","String_Node_Str");
  file.delete();
  final Logger log=LogManager.getLogger("String_Node_Str");
  final String logMsg="String_Node_Str";
  log.info(logMsg);
  ((LifeCycle)LogManager.getContext()).stop();
  final BufferedReader reader=new BufferedReader(new FileReader(file));
  String line1;
  try {
    line1=reader.readLine();
  }
  finally {
    reader.close();
    file.delete();
  }
  assertNotNull("String_Node_Str",line1);
  final String msg1="String_Node_Str";
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg1+ ']',line1.contains(msg1));
  final String msg2="String_Node_Str";
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg2+ ']',line1.contains(msg2));
  final String msg3="String_Node_Str";
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg3+ ']',line1.contains(msg3));
  final String msg4=logMsg;
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg4+ ']',line1.contains(msg4));
  final String location="String_Node_Str";
  assertTrue("String_Node_Str",!line1.contains(location));
  assertTrue(line1.indexOf('\r') == -1);
  assertTrue(line1.indexOf('\n') == -1);
}

Fixed version (ground truth):
@Test public void testFlushAtEndOfBatch() throws Exception {
  final File file=new File("String_Node_Str","String_Node_Str");
  file.delete();
  final Logger log=LogManager.getLogger("String_Node_Str");
  final String logMsg="String_Node_Str";
  log.info(logMsg);
  ((LifeCycle)LogManager.getContext()).stop();
  final BufferedReader reader=new BufferedReader(new FileReader(file));
  String line1;
  try {
    line1=reader.readLine();
  }
  finally {
    reader.close();
    file.delete();
  }
  assertNotNull("String_Node_Str",line1);
  final String msg1="String_Node_Str";
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg1+ ']',line1.contains(msg1));
  final String msg2="String_Node_Str";
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg2+ ']',line1.contains(msg2));
  final String msg3="String_Node_Str";
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg3+ ']',line1.contains(msg3));
  final String msg4=logMsg;
  assertTrue("String_Node_Str" + line1 + "String_Node_Str"+ msg4+ ']',line1.contains(msg4));
  final String location="String_Node_Str";
  assertTrue("String_Node_Str",!line1.contains(location));
  assertTrue(line1.indexOf('\r') == -1);
  assertTrue(line1.indexOf('\n') == -1);
}