nus-yam/ex-repair huggingface dataset:
Program: 18106
Project: 18106
Buggy source:
public void newSnapshot(Snapshot snapshot){
}

Fixed version (ground truth):
public void newSnapshot(Snapshot snapshot){
  try {
    String oldSnapshotFileName=snapshotFileName();
    snapshotFileNumber++;
    String newSnapshotFileName=snapshotFileName();
    DataOutputStream snapshotStream=new DataOutputStream(new FileOutputStream(newSnapshotFileName,false));
    snapshot.writeTo(snapshotStream);
    snapshotStream.close();
    ByteBuffer buffer=ByteBuffer.allocate(1 + 4);
    buffer.put(SNAPSHOT);
    buffer.putInt(snapshotFileNumber);
    logStream.write(buffer.array());
    if (new File(oldSnapshotFileName).exists())     new File(oldSnapshotFileName).delete();
    this.snapshot=snapshot;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 18107
Project: 18107
Buggy source:
public Collection<ConsensusInstance> load() throws IOException {
  Pattern pattern=Pattern.compile("String_Node_Str");
  List<Integer> numbers=new ArrayList<Integer>();
  for (  String fileName : directory.list()) {
    Matcher matcher=pattern.matcher(fileName);
    if (matcher.find()) {
      int x=Integer.parseInt(matcher.group(1));
      numbers.add(x);
    }
  }
  Collections.sort(numbers);
  Map<Integer,ConsensusInstance> instances=new TreeMap<Integer,ConsensusInstance>();
  for (  Integer number : numbers) {
    String fileName="String_Node_Str" + number + "String_Node_Str";
    loadInstances(new File(directoryPath + "String_Node_Str" + fileName),instances);
  }
  if (previousSnapshotId == null)   return instances.values();
  DataInputStream snapshotStream=new DataInputStream(new FileInputStream(snapshotFileNameForRequest(previousSnapshotId)));
  snapshot=new Snapshot(snapshotStream);
  return instances.values();
}

Fixed version (ground truth):
public Collection<ConsensusInstance> load() throws IOException {
  Pattern pattern=Pattern.compile("String_Node_Str");
  List<Integer> numbers=new ArrayList<Integer>();
  for (  String fileName : directory.list()) {
    Matcher matcher=pattern.matcher(fileName);
    if (matcher.find()) {
      int x=Integer.parseInt(matcher.group(1));
      numbers.add(x);
    }
  }
  Collections.sort(numbers);
  Map<Integer,ConsensusInstance> instances=new TreeMap<Integer,ConsensusInstance>();
  for (  Integer number : numbers) {
    String fileName="String_Node_Str" + number + "String_Node_Str";
    loadInstances(new File(directoryPath + "String_Node_Str" + fileName),instances);
  }
  if (snapshotFileNumber == -1)   return instances.values();
  DataInputStream snapshotStream=new DataInputStream(new FileInputStream(snapshotFileName()));
  snapshot=new Snapshot(snapshotStream);
  snapshotStream.close();
  return instances.values();
}
Program: 18108
Project: 18108
Buggy source:
@Test public void shouldHandleSnapshotFromServiceCalledWithinExecuteMethod(){
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(0);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(1);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  SnapshotListener2 snapshotListener2=mock(SnapshotListener2.class);
  serviceProxy.addSnapshotListener(snapshotListener2);
  responsesCache.put(2,Arrays.asList(ReplyGenerator.generate(),ReplyGenerator.generate()));
  Request lastRequest=RequestGenerator.generate();
  serviceProxy.execute(lastRequest);
  serviceProxy.onSnapshotMade(8,new byte[]{1,2,3},new byte[]{1,2,3,4});
  executeDispatcher();
  ArgumentCaptor<Snapshot> snapshotCaptor=ArgumentCaptor.forClass(Snapshot.class);
  verify(snapshotListener2).onSnapshotMade(snapshotCaptor.capture());
  Snapshot snapshot=snapshotCaptor.getValue();
  assertArrayEquals(new byte[]{1,2,3},snapshot.getValue());
  assertEquals(2,(int)snapshot.getNextInstanceId());
  assertEquals(8,snapshot.getNextRequestSeqNo());
  assertEquals(5,snapshot.getStartingRequestSeqNo());
  assertEquals(3,snapshot.getPartialResponseCache().size());
}

Fixed version (ground truth):
@Test public void shouldHandleSnapshotFromServiceCalledWithinExecuteMethod(){
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(0);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(1);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  SnapshotListener2 snapshotListener2=mock(SnapshotListener2.class);
  serviceProxy.addSnapshotListener(snapshotListener2);
  responsesCache.put(2,Arrays.asList(ReplyGenerator.generate(),ReplyGenerator.generate()));
  Request lastRequest=RequestGenerator.generate();
  serviceProxy.execute(lastRequest);
  serviceProxy.onSnapshotMade(8,new byte[]{1,2,3},new byte[]{1,2,3,4});
  executeDispatcher();
  ArgumentCaptor<Snapshot> snapshotCaptor=ArgumentCaptor.forClass(Snapshot.class);
  verify(snapshotListener2).onSnapshotMade(snapshotCaptor.capture());
  Snapshot snapshot=snapshotCaptor.getValue();
  assertArrayEquals(new byte[]{1,2,3},snapshot.getValue());
  assertEquals(2,snapshot.getNextInstanceId());
  assertEquals(8,snapshot.getNextRequestSeqNo());
  assertEquals(5,snapshot.getStartingRequestSeqNo());
  assertEquals(3,snapshot.getPartialResponseCache().size());
}
Program: 18109
Project: 18109
Buggy source:
@Test public void shouldHandleSnapshotFromServiceAfterInstanceIsExecuted(){
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(0);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(1);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(2);
  SnapshotListener2 snapshotListener2=mock(SnapshotListener2.class);
  serviceProxy.addSnapshotListener(snapshotListener2);
  serviceProxy.onSnapshotMade(8,new byte[]{1,2,3},null);
  executeDispatcher();
  ArgumentCaptor<Snapshot> snapshotCaptor=ArgumentCaptor.forClass(Snapshot.class);
  verify(snapshotListener2).onSnapshotMade(snapshotCaptor.capture());
  Snapshot snapshot=snapshotCaptor.getValue();
  assertArrayEquals(new byte[]{1,2,3},snapshot.getValue());
  assertEquals(3,(int)snapshot.getNextInstanceId());
  assertEquals(8,snapshot.getNextRequestSeqNo());
  assertEquals(8,snapshot.getStartingRequestSeqNo());
  assertEquals(0,snapshot.getPartialResponseCache().size());
}

Fixed version (ground truth):
@Test public void shouldHandleSnapshotFromServiceAfterInstanceIsExecuted(){
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(0);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(1);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(2);
  SnapshotListener2 snapshotListener2=mock(SnapshotListener2.class);
  serviceProxy.addSnapshotListener(snapshotListener2);
  serviceProxy.onSnapshotMade(8,new byte[]{1,2,3},null);
  executeDispatcher();
  ArgumentCaptor<Snapshot> snapshotCaptor=ArgumentCaptor.forClass(Snapshot.class);
  verify(snapshotListener2).onSnapshotMade(snapshotCaptor.capture());
  Snapshot snapshot=snapshotCaptor.getValue();
  assertArrayEquals(new byte[]{1,2,3},snapshot.getValue());
  assertEquals(3,snapshot.getNextInstanceId());
  assertEquals(8,snapshot.getNextRequestSeqNo());
  assertEquals(8,snapshot.getStartingRequestSeqNo());
  assertEquals(0,snapshot.getPartialResponseCache().size());
}
Program: 18110
Project: 18110
Buggy source:
@Test public void shouldHandleSnapshotFromService(){
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(0);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(1);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  responsesCache.put(2,Arrays.asList(ReplyGenerator.generate(),ReplyGenerator.generate(),ReplyGenerator.generate()));
  SnapshotListener2 snapshotListener2=mock(SnapshotListener2.class);
  serviceProxy.addSnapshotListener(snapshotListener2);
  serviceProxy.onSnapshotMade(8,new byte[]{1,2,3},null);
  executeDispatcher();
  ArgumentCaptor<Snapshot> snapshotCaptor=ArgumentCaptor.forClass(Snapshot.class);
  verify(snapshotListener2).onSnapshotMade(snapshotCaptor.capture());
  Snapshot snapshot=snapshotCaptor.getValue();
  assertArrayEquals(new byte[]{1,2,3},snapshot.getValue());
  assertEquals(2,(int)snapshot.getNextInstanceId());
  assertEquals(8,snapshot.getNextRequestSeqNo());
  assertEquals(5,snapshot.getStartingRequestSeqNo());
  assertEquals(responsesCache.get(2),snapshot.getPartialResponseCache());
}

Fixed version (ground truth):
@Test public void shouldHandleSnapshotFromService(){
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(0);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.instanceExecuted(1);
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  serviceProxy.execute(RequestGenerator.generate());
  responsesCache.put(2,Arrays.asList(ReplyGenerator.generate(),ReplyGenerator.generate(),ReplyGenerator.generate()));
  SnapshotListener2 snapshotListener2=mock(SnapshotListener2.class);
  serviceProxy.addSnapshotListener(snapshotListener2);
  serviceProxy.onSnapshotMade(8,new byte[]{1,2,3},null);
  executeDispatcher();
  ArgumentCaptor<Snapshot> snapshotCaptor=ArgumentCaptor.forClass(Snapshot.class);
  verify(snapshotListener2).onSnapshotMade(snapshotCaptor.capture());
  Snapshot snapshot=snapshotCaptor.getValue();
  assertArrayEquals(new byte[]{1,2,3},snapshot.getValue());
  assertEquals(2,snapshot.getNextInstanceId());
  assertEquals(8,snapshot.getNextRequestSeqNo());
  assertEquals(5,snapshot.getStartingRequestSeqNo());
  assertEquals(responsesCache.get(2),snapshot.getPartialResponseCache());
}
Program: 18111
Project: 18111
Buggy source:
public void onSnapshotMade(final Snapshot snapshot){
  dispatcher.checkInDispatcher();
  if (snapshot.getValue() == null)   throw new RuntimeException("String_Node_Str");
  Map<Long,Reply> requestHistory=new HashMap<Long,Reply>(executedRequests);
  for (int i=executeUB - 1; i >= snapshot.getNextInstanceId(); i--) {
    List<Reply> ides=executedDifference.get(i);
    if (ides == null)     continue;
    for (    Reply reply : ides) {
      requestHistory.put(reply.getRequestId().getClientId(),reply);
    }
  }
  while (executedDifference.firstKey() < snapshot.getNextInstanceId()) {
    executedDifference.pollFirstEntry();
  }
  snapshot.setLastReplyForClient(requestHistory);
  paxos.onSnapshotMade(snapshot);
}

Fixed version (ground truth):
public void onSnapshotMade(final Snapshot snapshot){
  dispatcher.checkInDispatcher();
  if (snapshot.getValue() == null)   throw new RuntimeException("String_Node_Str");
  Map<Long,Reply> requestHistory=new HashMap<Long,Reply>(executedRequests);
  for (int i=executeUB - 1; i >= snapshot.getNextInstanceId(); i--) {
    List<Reply> ides=executedDifference.get(i);
    if (ides == null)     continue;
    for (    Reply reply : ides) {
      requestHistory.put(reply.getRequestId().getClientId(),reply);
    }
  }
  while (!executedDifference.isEmpty() && executedDifference.firstKey() < snapshot.getNextInstanceId()) {
    executedDifference.pollFirstEntry();
  }
  snapshot.setLastReplyForClient(requestHistory);
  paxos.onSnapshotMade(snapshot);
}
Program: 18113
Project: 18113
Buggy source:
private void stop(int i){
  prepared.set(i);
  prepareRetransmitter.stop();
}

Fixed version (ground truth):
private void stop(int i){
  prepared.set(i);
  prepareRetransmitter.stop(i);
}
Program: 18114
Project: 18114
Buggy source:
public void update(PrepareOK message,int sender){
  storage.updateEpoch(message.getEpoch());
  prepareEpoch[sender]=Math.max(prepareEpoch[sender],message.getEpoch()[sender]);
  for (int i=0; i < numReplicas; i++) {
    if (prepareEpoch[i] == storage.getEpoch()[i])     stop(i);
 else     start(i);
  }
  prepareRetransmitter.stop(sender);
}

Fixed version (ground truth):
public void update(PrepareOK message,int sender){
  storage.updateEpoch(message.getEpoch());
  prepareEpoch[sender]=Math.max(prepareEpoch[sender],message.getEpoch()[sender]);
  for (int i=0; i < numReplicas; i++) {
    if (prepareEpoch[i] == storage.getEpoch()[i])     stop(i);
 else     start(i);
  }
}
Program: 18115
Project: 18115
Buggy source:
public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str"+ Arrays.toString(epoch)+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str"+ Arrays.toString(epoch)+ "String_Node_Str"+ nextId+ "String_Node_Str";
}
Program: 18116
Project: 18116
Buggy source:
/** 
 * Adds a new message listener for a certain type of message or all messages ( see   {@link MessageType}). The listener cannot be added twice for the same message - this causes a   {@link RuntimeException}.
 */
final public static void addMessageListener(MessageType mType,MessageHandler handler){
  CopyOnWriteArrayList<MessageHandler> handlers=_msgListeners.get(mType);
  boolean wasAdded=handlers.addIfAbsent(handler);
  if (!wasAdded) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Adds a new message listener for a certain type of message or all messages ( see   {@link MessageType}). The listener cannot be added twice for the same message - this causes a   {@link RuntimeException}.
 */
final public static void addMessageListener(MessageType mType,MessageHandler handler){
  CopyOnWriteArrayList<MessageHandler> handlers=msgListeners.get(mType);
  boolean wasAdded=handlers.addIfAbsent(handler);
  if (!wasAdded) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 18117
Project: 18117
Buggy source:
/** 
 * Removes a previously registered listener. Throws   {@link RuntimeException}if the listener is not on list.
 */
final public static void removeMessageListener(MessageType mType,MessageHandler handler){
  CopyOnWriteArrayList<MessageHandler> handlers=_msgListeners.get(mType);
  boolean wasPresent=handlers.remove(handler);
  if (!wasPresent) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Removes a previously registered listener. Throws   {@link RuntimeException}if the listener is not on list.
 */
final public static void removeMessageListener(MessageType mType,MessageHandler handler){
  CopyOnWriteArrayList<MessageHandler> handlers=msgListeners.get(mType);
  boolean wasPresent=handlers.remove(handler);
  if (!wasPresent) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 18118
Project: 18118
Buggy source:
/** 
 * Informs all listeners waiting for the message type about the message. Parameter type is needed in order to support MessageType.ANY value. Returns if there was at least one listener.
 */
private final boolean broadcastToListeners(MessageType type,Message msg,int sender){
  List<MessageHandler> handlers=_msgListeners.get(type);
  boolean handled=false;
  for (  MessageHandler listener : handlers) {
    listener.onMessageReceived(msg,sender);
    handled=true;
  }
  return handled;
}

Fixed version (ground truth):
/** 
 * Informs all listeners waiting for the message type about the message. Parameter type is needed in order to support MessageType.ANY value. Returns if there was at least one listener.
 */
private final boolean broadcastToListeners(MessageType type,Message msg,int sender){
  List<MessageHandler> handlers=msgListeners.get(type);
  boolean handled=false;
  for (  MessageHandler listener : handlers) {
    listener.onMessageReceived(msg,sender);
    handled=true;
  }
  return handled;
}
Program: 18119
Project: 18119
Buggy source:
/** 
 * Notifies all active network listeners that message was sent.
 */
protected final void fireSentMessage(Message msg,BitSet dest){
  List<MessageHandler> handlers=_msgListeners.get(MessageType.SENT);
  for (  MessageHandler listener : handlers) {
    listener.onMessageSent(msg,dest);
  }
}

Fixed version (ground truth):
/** 
 * Notifies all active network listeners that message was sent.
 */
protected final void fireSentMessage(Message msg,BitSet dest){
  List<MessageHandler> handlers=msgListeners.get(MessageType.SENT);
  for (  MessageHandler listener : handlers) {
    listener.onMessageSent(msg,dest);
  }
}
Program: 18120
Project: 18120
Buggy source:
public synchronized void start(){
  receiverThread.start();
  senderThread.start();
}

Fixed version (ground truth):
/** 
 * Starts the receiver and sender thread.
 */
public synchronized void start(){
  receiverThread.start();
  senderThread.start();
}
Program: 18121
Project: 18121
Buggy source:
/** 
 * Creates a new TCP connection to specified replica.
 * @param network - related <code>TcpNetwork</code>
 * @param replica - replica to connect to
 * @param active - Initiate connection or wait for remote connection
 */
public TcpConnection(TcpNetwork network,PID replica,boolean active){
  this.network=network;
  this.replica=replica;
  this.active=active;
  _logger.info("String_Node_Str" + replica + "String_Node_Str"+ active);
  this.receiverThread=new Thread(new ReceiverThread(),"String_Node_Str" + this.replica.getId());
  this.senderThread=new Thread(new Sender(),"String_Node_Str" + this.replica.getId());
  receiverThread.setUncaughtExceptionHandler(new KillOnExceptionHandler());
  senderThread.setUncaughtExceptionHandler(new KillOnExceptionHandler());
}

Fixed version (ground truth):
/** 
 * Creates a new TCP connection to specified replica.
 * @param network - related <code>TcpNetwork</code>.
 * @param replica - replica to connect to.
 * @param active - initiates connection if true; waits for remote connectionotherwise.
 */
public TcpConnection(TcpNetwork network,PID replica,boolean active){
  this.network=network;
  this.replica=replica;
  this.active=active;
  _logger.info("String_Node_Str" + replica + "String_Node_Str"+ active);
  this.receiverThread=new Thread(new ReceiverThread(),"String_Node_Str" + this.replica.getId());
  this.senderThread=new Thread(new Sender(),"String_Node_Str" + this.replica.getId());
  receiverThread.setUncaughtExceptionHandler(new KillOnExceptionHandler());
  senderThread.setUncaughtExceptionHandler(new KillOnExceptionHandler());
}
Program: 18122
Project: 18122
Buggy source:
public void run(){
  while (true) {
    _logger.info("String_Node_Str" + replica.getId());
    connect();
    _logger.info("String_Node_Str" + replica.getId());
    while (true) {
      if (Thread.interrupted()) {
        _logger.log(Level.SEVERE,"String_Node_Str");
        close();
        return;
      }
      Message message;
      try {
        message=MessageFactory.create(input);
      }
 catch (      IllegalArgumentException e) {
        _logger.log(Level.SEVERE,"String_Node_Str",e);
        close();
        break;
      }
      if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("String_Node_Str" + replica.getId() + "String_Node_Str"+ message+ "String_Node_Str"+ message.byteSize());
      }
      network.fireReceiveMessage(message,replica.getId());
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (true) {
    _logger.info("String_Node_Str" + replica.getId());
    try {
      connect();
    }
 catch (    InterruptedException e) {
      _logger.severe("String_Node_Str");
      break;
    }
    _logger.info("String_Node_Str" + replica.getId());
    while (true) {
      if (Thread.interrupted()) {
        _logger.severe("String_Node_Str");
        close();
        return;
      }
      Message message;
      try {
        message=MessageFactory.create(input);
      }
 catch (      IllegalArgumentException e) {
        _logger.log(Level.SEVERE,"String_Node_Str",e);
        close();
        break;
      }
      if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("String_Node_Str" + replica.getId() + "String_Node_Str"+ message+ "String_Node_Str"+ message.byteSize());
      }
      network.fireReceiveMessage(message,replica.getId());
    }
  }
}
Program: 18123
Project: 18123
Buggy source:
/** 
 * Closes the connection clean.
 */
private synchronized void close(){
  try {
    _logger.info("String_Node_Str");
    if (socket != null) {
      socket.shutdownOutput();
      socket.close();
      socket=null;
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  connected=false;
}

Fixed version (ground truth):
/** 
 * Closes the connection.
 */
private synchronized void close(){
  try {
    _logger.info("String_Node_Str");
    if (socket != null && socket.isConnected()) {
      socket.shutdownOutput();
      socket.close();
      socket=null;
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  connected=false;
  _logger.info("String_Node_Str");
}
Program: 18124
Project: 18124
Buggy source:
/** 
 * Establishes connection to host specified by this object. If this is active connection then it will try to connect to other side. Otherwise we will wait until connection will be set-up using <code>setConnection</code> method. This method will return only if the connection is established and initialized properly.
 */
private synchronized void connect(){
}

Fixed version (ground truth):
/** 
 * Establishes connection to host specified by this object. If this is active connection then it will try to connect to other side. Otherwise we will wait until connection will be set-up using <code>setConnection</code> method. This method will return only if the connection is established and initialized properly.
 * @throws InterruptedException
 */
private void connect() throws InterruptedException {
}
Program: 18125
Project: 18125
Buggy source:
public AfterCatchupSnapshotEvent(Snapshot snapshot,Storage storage,final Object snapshotLock){
  _snapshot=snapshot;
  this.snapshotLock=snapshotLock;
  _stableStorage=storage.getStableStorage();
  _storage=storage;
}

Fixed version (ground truth):
public AfterCatchupSnapshotEvent(Snapshot snapshot,Storage storage,Object snapshotLock){
  this.snapshot=snapshot;
  this.snapshotLock=snapshotLock;
  this.storage=storage;
  stableStorage=storage.getStableStorage();
}
Program: 18126
Project: 18126
Buggy source:
public void run(){
  int oldInstanceId=_stableStorage.getLastSnapshot().nextIntanceId;
  if (oldInstanceId >= _snapshot.nextIntanceId) {
synchronized (snapshotLock) {
      snapshotLock.notify();
    }
    return;
  }
  _stableStorage.setLastSnapshot(_snapshot);
  _stableStorage.getLog().truncateBelow(oldInstanceId);
  _stableStorage.getLog().clearUndecidedBelow(_snapshot.nextIntanceId);
  _storage.updateFirstUncommitted();
synchronized (snapshotLock) {
    snapshotLock.notify();
  }
}

Fixed version (ground truth):
public void run(){
  Snapshot lastSnapshot=stableStorage.getLastSnapshot();
  if (lastSnapshot != null && lastSnapshot.nextIntanceId >= snapshot.nextIntanceId) {
synchronized (snapshotLock) {
      snapshotLock.notify();
    }
    return;
  }
  stableStorage.setLastSnapshot(snapshot);
  if (lastSnapshot != null) {
    stableStorage.getLog().truncateBelow(lastSnapshot.nextIntanceId);
  }
  stableStorage.getLog().clearUndecidedBelow(snapshot.nextIntanceId);
  storage.updateFirstUncommitted();
synchronized (snapshotLock) {
    snapshotLock.notify();
  }
}
Program: 18127
Project: 18127
Buggy source:
/** 
 * Get Element name for rendering ( imj , a , object, applet ).
 */
@Attribute public abstract String getElement();

Fixed version (ground truth):
/** 
 * Get the Element name for rendering ( img , a , object, applet ).
 */
@Attribute public abstract String getElement();
Program: 18128
Project: 18128
Buggy source:
/** 
 * The label for the Add button.
 */
@Attribute public abstract String getUploadLabel();

Fixed version (ground truth):
/** 
 * The label for the Upload button.
 */
@Attribute public abstract String getUploadLabel();
Program: 18129
Project: 18129
Buggy source:
private int getColumnCount(List<UIComponent> components){
  int result=0;
  for (  UIComponent component : components) {
    if (component instanceof AbstractToolbarGroup) {
      result+=component.getChildren().size();
    }
 else {
      result++;
    }
  }
  return result;
}

Fixed version (ground truth):
private int getColumnCount(List<UIComponent> components){
  int result=0;
  for (  UIComponent component : components) {
    if (component instanceof AbstractToolbarGroup) {
      result+=((AbstractToolbarGroup)component).getRenderedChildren().size();
    }
 else {
      result++;
    }
  }
  return result;
}
Program: 18130
Project: 18130
Buggy source:
@Override protected boolean isSubmitted(FacesContext context,AbstractTogglePanel panel){
  String activePanelName=panel.getSubmittedActiveItem();
  int itemIndex=panel.getIndexByName(activePanelName);
  if (itemIndex < 0) {
    return false;
  }
  UIComponent item=(UIComponent)panel.getItem(activePanelName);
  Map<String,String> parameterMap=context.getExternalContext().getRequestParameterMap();
  return parameterMap.get(item.getClientId(context)) != null;
}

Fixed version (ground truth):
@Override protected boolean isSubmitted(FacesContext context,AbstractTogglePanel panel){
  String activePanelName=panel.getSubmittedActiveItem();
  int itemIndex=panel.getIndexByName(activePanelName);
  if (itemIndex < 0) {
    return false;
  }
  Map<String,String> parameterMap=context.getExternalContext().getRequestParameterMap();
  return parameterMap.get(activePanelName) != null;
}
Program: 18131
Project: 18131
Buggy source:
/** 
 * Find all instances of the   {@link UIRichMessages} and update list of the rendered messages.
 * @param context
 * @param component
 * @param messages
 */
protected void findRichMessages(FacesContext context,UIComponent component,String id,Set<UIComponent> messages){
  Iterator<UIComponent> facetsAndChildren=component.getFacetsAndChildren();
  while (facetsAndChildren.hasNext()) {
    UIComponent child=(UIComponent)facetsAndChildren.next();
    if (child instanceof ClientSideMessage) {
      ClientSideMessage richMessage=(ClientSideMessage)child;
      if (null == richMessage.getFor()) {
        richMessage.updateMessages(context,id);
        messages.add(child);
      }
    }
 else {
      findRichMessages(context,child,id,messages);
    }
  }
}

Fixed version (ground truth):
/** 
 * Find all instances of the   {@link org.richfaces.component.UIRichMessages} and update list of the rendered messages.
 * @param context
 * @param component
 * @param messages
 */
protected void findRichMessages(FacesContext context,UIComponent component,String id,Set<UIComponent> messages){
  Iterator<UIComponent> facetsAndChildren=component.getFacetsAndChildren();
  while (facetsAndChildren.hasNext()) {
    UIComponent child=(UIComponent)facetsAndChildren.next();
    if (child instanceof ClientSideMessage) {
      ClientSideMessage richMessage=(ClientSideMessage)child;
      if (null == richMessage.getFor()) {
        richMessage.updateMessages(context,id);
        messages.add(child);
      }
    }
 else {
      findRichMessages(context,child,id,messages);
    }
  }
}
Program: 18132
Project: 18132
Buggy source:
@Test public void testSubmitTooShortValue() throws Exception {
  HtmlPage page=submitValueAndCheckMessage("String_Node_Str",equalTo(GraphBean.SHORT_MSG));
  checkMessage(page,"String_Node_Str",containsString(GraphBean.SHORT_MSG));
  checkMessage(page,"String_Node_Str",equalTo("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testSubmitTooShortValue() throws Exception {
  HtmlPage page=submitValueAndCheckMessage("String_Node_Str",containsString(GraphBean.SHORT_MSG));
  checkMessage(page,"String_Node_Str",containsString(GraphBean.SHORT_MSG));
  checkMessage(page,"String_Node_Str",equalTo("String_Node_Str"));
}
Program: 18133
Project: 18133
Buggy source:
protected HtmlPage submitValueAndCheckMessage(String value,Matcher<String> matcher) throws Exception {
  HtmlPage page=requestPage();
  HtmlInput input=getInput(page);
  page=(HtmlPage)input.setValueAttribute(value);
  page=submit(page);
  checkMessage(page,"String_Node_Str",matcher);
  return page;
}

Fixed version (ground truth):
protected HtmlPage submitValueAndCheckMessage(String value,Matcher<String> matcher) throws Exception {
  HtmlPage page=requestPage();
  HtmlInput input=getInput(page);
  page=(HtmlPage)input.setValueAttribute(value);
  page=submit(page);
  System.out.println(page.asXml());
  checkMessage(page,"String_Node_Str",matcher);
  return page;
}
Program: 18134
Project: 18134
Buggy source:
@Attribute(events=@EventName("String_Node_Str")) public abstract String getOnblur();

Fixed version (ground truth):
/** 
 * Javascript code executed when this element loses focus.
 */
@Attribute(events=@EventName("String_Node_Str")) public abstract String getOnblur();
Program: 18135
Project: 18135
Buggy source:
@Attribute(events=@EventName("String_Node_Str")) public abstract String getOnfocus();

Fixed version (ground truth):
/** 
 * Javascript code executed when this element receives focus.
 */
@Attribute(events=@EventName("String_Node_Str")) public abstract String getOnfocus();
Program: 18136
Project: 18136
Buggy source:
private static LibraryFunction getScriptFromAnnotation(Class<?> javaClass) throws ScriptNotFoundException {
  if (javaClass.isAnnotationPresent(ClientSideScript.class)) {
    ClientSideScript clientSideScript=javaClass.getAnnotation(ClientSideScript.class);
    List<ResourceKey> resources=Lists.newArrayList();
    for (    ResourceDependency dependency : clientSideScript.resources()) {
      resources.add(ResourceKey.create(dependency.name(),dependency.library()));
    }
    return new LibraryFunctionImplementation(clientSideScript.function(),resources);
  }
 else {
    throw new ScriptNotFoundException();
  }
}

Fixed version (ground truth):
private static LibraryFunction getScriptFromAnnotation(Class<?> javaClass){
  if (javaClass.isAnnotationPresent(ClientSideScript.class)) {
    ClientSideScript clientSideScript=javaClass.getAnnotation(ClientSideScript.class);
    List<ResourceKey> resources=Lists.newArrayList();
    for (    ResourceDependency dependency : clientSideScript.resources()) {
      resources.add(ResourceKey.create(dependency.name(),dependency.library()));
    }
    return new LibraryFunctionImplementation(clientSideScript.function(),resources);
  }
 else {
    return NO_SCRIPT;
  }
}
Program: 18137
Project: 18137
Buggy source:
private static LibraryFunction getScriptResource(FacesContext facesContext,Class<?> javaClass) throws ScriptNotFoundException {
  ResourceHandler resourceHandler=facesContext.getApplication().getResourceHandler();
  String resourceName=javaClass.getSimpleName() + "String_Node_Str";
  Resource facesResource=resourceHandler.createResource(resourceName,ORG_RICHFACES_CSV,TEXT_JAVASCRIPT);
  if (null != facesResource) {
    final String functionName=Strings.firstToLowerCase(javaClass.getSimpleName());
    return new LibraryFunctionImplementation(functionName,resourceName,ORG_RICHFACES_CSV);
  }
 else {
    throw new ScriptNotFoundException();
  }
}

Fixed version (ground truth):
private static LibraryFunction getScriptResource(FacesContext facesContext,Class<?> javaClass){
  ResourceHandler resourceHandler=facesContext.getApplication().getResourceHandler();
  String resourceName=javaClass.getSimpleName() + "String_Node_Str";
  Resource facesResource=resourceHandler.createResource(resourceName,ORG_RICHFACES_CSV,TEXT_JAVASCRIPT);
  if (null != facesResource) {
    final String functionName=Strings.firstToLowerCase(javaClass.getSimpleName());
    return new LibraryFunctionImplementation(functionName,resourceName,ORG_RICHFACES_CSV);
  }
 else {
    return NO_SCRIPT;
  }
}
Program: 18138
Project: 18138
Buggy source:
private LibraryFunction getFromComputationMap(ConcurrentMap<Class<?>,LibraryFunction> map,Class<?> clazz) throws ScriptNotFoundException {
  try {
    return map.get(clazz);
  }
 catch (  ComputationException e) {
    Throwable cause=e.getCause();
    if (cause instanceof ScriptNotFoundException) {
      ScriptNotFoundException snfe=(ScriptNotFoundException)cause;
      throw snfe;
    }
    throw e;
  }
}

Fixed version (ground truth):
private LibraryFunction getFromComputationMap(ConcurrentMap<Class<?>,LibraryFunction> map,Class<?> clazz){
  try {
    return map.get(clazz);
  }
 catch (  ComputationException e) {
    Throwable cause=e.getCause();
    throw new FacesException(cause);
  }
}
Program: 18139
Project: 18139
Buggy source:
public LibraryFunction getScript(FacesContext facesContext,Class<?> javaClass) throws ScriptNotFoundException {
  if (null == facesContext || null == javaClass) {
    throw new NullPointerException();
  }
  LibraryFunction function;
  try {
    function=getFromComputationMap(resourcesMapping,javaClass);
  }
 catch (  ScriptNotFoundException e) {
    if (defaultMapping.containsKey(javaClass)) {
      function=defaultMapping.get(javaClass);
    }
 else {
      function=getFromComputationMap(annotationsMapping,javaClass);
    }
  }
  return function;
}

Fixed version (ground truth):
public LibraryFunction getScript(FacesContext facesContext,Class<?> javaClass) throws ScriptNotFoundException {
  if (null == facesContext || null == javaClass) {
    throw new NullPointerException();
  }
  LibraryFunction function=getFromComputationMap(resourcesMapping,javaClass);
  if (NO_SCRIPT == function) {
    if (defaultMapping.containsKey(javaClass)) {
      function=defaultMapping.get(javaClass);
    }
 else {
      function=getFromComputationMap(annotationsMapping,javaClass);
    }
  }
  if (NO_SCRIPT == function) {
    throw new ScriptNotFoundException("String_Node_Str" + javaClass.getName());
  }
  return function;
}
Program: 18140
Project: 18140
Buggy source:
public abstract Object getAutocompleteList();

Fixed version (ground truth):
@Attribute() public abstract Object getAutocompleteList();
Program: 18141
Project: 18141
Buggy source:
public abstract InplaceState getState();

Fixed version (ground truth):
@Attribute(hidden=true) public abstract InplaceState getState();
Program: 18142
Project: 18142
Buggy source:
public abstract InplaceState getState();

Fixed version (ground truth):
@Attribute(hidden=true) public abstract InplaceState getState();
Program: 18143
Project: 18143
Buggy source:
public abstract String getLeftIconClass();

Fixed version (ground truth):
@Attribute public abstract String getLeftIconClass();
Program: 18144
Project: 18144
Buggy source:
public abstract String getHoverClass();

Fixed version (ground truth):
@Attribute public abstract String getHoverClass();
Program: 18145
Project: 18145
Buggy source:
public abstract String getRightIconClass();

Fixed version (ground truth):
@Attribute public abstract String getRightIconClass();
Program: 18146
Project: 18146
Buggy source:
protected String getOnClickFunction(FacesContext facesContext,UIComponent component){
  AbstractMenuItem menuItem=(AbstractMenuItem)component;
  Mode subminMode=resolveSubmitMode(menuItem);
  if (menuItem.isDisabled()) {
    return "String_Node_Str";
  }
 else   if (subminMode == null || Mode.server.equals(subminMode)) {
    return getServerSubmitFunction(menuItem);
  }
 else   if (Mode.ajax.equals(subminMode)) {
    return getOnClick(facesContext,menuItem);
  }
 else   if (Mode.client.equals(subminMode)) {
    return "String_Node_Str";
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
protected String getOnClickFunction(FacesContext facesContext,UIComponent component){
  AbstractMenuItem menuItem=(AbstractMenuItem)component;
  Mode subminMode=resolveSubmitMode(menuItem);
  if (Mode.ajax.equals(subminMode)) {
    return getOnClick(facesContext,menuItem);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 18147
Project: 18147
Buggy source:
protected Mode resolveSubmitMode(AbstractMenuItem menuItem){
  Mode submitMode=menuItem.getMode();
  if (null != submitMode) {
    return submitMode;
  }
  AbstractDropDownMenu parent=getDDMenu(menuItem);
  if (parent != null) {
    return parent.getMode();
  }
  return Mode.server;
}

Fixed version (ground truth):
protected Mode resolveSubmitMode(AbstractMenuItem menuItem){
  if (menuItem.getMode() != null) {
    return menuItem.getMode();
  }
  AbstractDropDownMenu parent=getDDMenu(menuItem);
  if (parent != null && parent.getMode() != null) {
    return parent.getMode();
  }
  return Mode.server;
}
Program: 18148
Project: 18148
Buggy source:
public DropEvent(UIComponent component,ClientDropBehavior behavior){
  super(component,behavior);
}

Fixed version (ground truth):
public DropEvent(UIComponent component,ClientDropBehavior behavior){
  super(component,behavior);
  this.dropComponent=component;
  this.dropBehavior=behavior;
}
Program: 18149
Project: 18149
Buggy source:
public UIComponent getDropComponent(){
  return getComponent();
}

Fixed version (ground truth):
public UIComponent getDropComponent(){
  return this.dropComponent;
}
Program: 18150
Project: 18150
Buggy source:
private boolean isImmediate(){
  boolean immediate=this.dropBehavior.isImmediate();
  if (!immediate) {
    if (dropSource instanceof EditableValueHolder) {
      immediate=((EditableValueHolder)dropSource).isImmediate();
    }
 else     if (dropSource instanceof ActionSource) {
      immediate=((ActionSource)dropSource).isImmediate();
    }
  }
  return immediate;
}

Fixed version (ground truth):
private boolean isImmediate(UIComponent component,ClientDropBehavior dropBehavior){
  boolean immediate=dropBehavior.isImmediate();
  if (!immediate) {
    if (component instanceof EditableValueHolder) {
      immediate=((EditableValueHolder)component).isImmediate();
    }
 else     if (component instanceof ActionSource) {
      immediate=((ActionSource)component).isImmediate();
    }
  }
  return immediate;
}
Program: 18151
Project: 18151
Buggy source:
@Override public void decode(FacesContext facesContext,UIComponent component,ClientBehavior behavior){
  if (null == facesContext || null == component || behavior == null) {
    throw new NullPointerException();
  }
  Map<String,String> requestParamMap=facesContext.getExternalContext().getRequestParameterMap();
  String dragSource=(String)requestParamMap.get("String_Node_Str");
  facesContext.getViewRoot().invokeOnComponent(facesContext,dragSource,new DropBehaviorContextCallBack(component,(ClientDropBehavior)behavior));
}

Fixed version (ground truth):
@Override public void decode(FacesContext facesContext,UIComponent component,ClientBehavior behavior){
  if (null == facesContext || null == component || behavior == null) {
    throw new NullPointerException();
  }
  Map<String,String> requestParamMap=facesContext.getExternalContext().getRequestParameterMap();
  String dragSource=(String)requestParamMap.get("String_Node_Str");
  DragBehaviorContextCallBack dragBehaviorContextCallBack=new DragBehaviorContextCallBack();
  facesContext.getViewRoot().invokeOnComponent(facesContext,dragSource,dragBehaviorContextCallBack);
  if (behavior instanceof ClientDropBehavior) {
    ClientDropBehavior dropBehavior=(ClientDropBehavior)behavior;
    DropEvent dropEvent=new DropEvent(component,dropBehavior);
    dropEvent.setDropValue(dropBehavior.getDropValue());
    dropEvent.setDragComponent(dragBehaviorContextCallBack.getDragComponent());
    dropEvent.setDragBehavior(dragBehaviorContextCallBack.getDragBehavior());
    dropEvent.setDragValue(dragBehaviorContextCallBack.getDragValue());
    queueEvent(dropEvent);
  }
}
Program: 18152
Project: 18152
Buggy source:
public void invokeContextCallback(FacesContext context,UIComponent target){
  ClientDragBehavior dragBehavior=getDragBehavior(target,"String_Node_Str");
  if (dragBehavior != null) {
    DropEvent dropEvent=new DropEvent(dropSource,dropBehavior);
    dropEvent.setDragSource(dragBehavior);
    dropEvent.setDragComponent(target);
    queueDropEvent(dropEvent);
  }
 else {
  }
}

Fixed version (ground truth):
public void invokeContextCallback(FacesContext context,UIComponent target){
  ClientDragBehavior dragBehavior=getDragBehavior(target,"String_Node_Str");
  this.dragValue=dragBehavior.getDragValue();
  this.dragBehavior=dragBehavior;
  this.dragComponent=target;
}
Program: 18153
Project: 18153
Buggy source:
private boolean isBypassUpdates(){
  boolean bypassUpdates=this.dropBehavior.isBypassUpdates();
  if (!bypassUpdates) {
    bypassUpdates=getUtils().isBooleanAttribute(this.dropSource,"String_Node_Str");
  }
  return bypassUpdates;
}

Fixed version (ground truth):
private boolean isBypassUpdates(UIComponent component,ClientDropBehavior dropBehavior){
  boolean bypassUpdates=dropBehavior.isBypassUpdates();
  if (!bypassUpdates) {
    bypassUpdates=getUtils().isBooleanAttribute(component,"String_Node_Str");
  }
  return bypassUpdates;
}
Program: 18154
Project: 18154
Buggy source:
@Override public Metadata applyRule(String name,TagAttribute attribute,MetadataTarget meta){
  if (meta.isTargetInstanceOf(ClientBehavior.class)) {
    if (!attribute.isLiteral()) {
      Class<?> type=meta.getPropertyType(name);
      if (type == null) {
        type=Object.class;
      }
      return new ValueExpressionMetadata(name,type,attribute);
    }
 else     if (meta != null && meta.getWriteMethod(name) == null) {
      if (log.isDebugEnabled()) {
        log.debug(attribute + "String_Node_Str" + name+ "String_Node_Str"+ meta.getTargetClass().getName());
      }
      return new LiteralAttributeMetadata(name,attribute.getValue());
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Metadata applyRule(String name,TagAttribute attribute,MetadataTarget meta){
  if (meta.isTargetInstanceOf(ClientBehavior.class)) {
    if (!attribute.isLiteral()) {
      Class<?> type=meta.getPropertyType(name);
      if (type == null) {
        type=Object.class;
      }
      return new ValueExpressionMetadata(name,type,attribute);
    }
 else {
      return new LiteralAttributeMetadata(name,attribute.getValue());
    }
  }
  return null;
}
Program: 18155
Project: 18155
Buggy source:
@Override public void addToOptions(FacesContext facesContext,UIComponent component,Map<String,Object> options,Object additional){
  options.put(PopupConstants.OPTIONS_ITEM_CLASS,"String_Node_Str");
  options.put(PopupConstants.OPTIONS_SELECT_ITEM_CLASS,"String_Node_Str");
  options.put(OPTION_LIST_ITEMS,additional);
  String clientId=component.getClientId(facesContext);
  options.put(PopupConstants.OPTIONS_LIST_CORD,clientId + "String_Node_Str");
  options.put(PopupConstants.OPTIONS_LIST_CLASS,component.getAttributes().get("String_Node_Str"));
  options.put(OPTIONS_SELECT_ITEM_VALUE_INPUT,clientId + "String_Node_Str");
  options.put(OPTIONS_VISIBLE,component.getAttributes().get("String_Node_Str"));
}

Fixed version (ground truth):
@Override public void addToOptions(FacesContext facesContext,UIComponent component,Map<String,Object> options,Object additional){
  options.put(PopupConstants.OPTIONS_ITEM_CLASS,"String_Node_Str");
  options.put(PopupConstants.OPTIONS_SELECT_ITEM_CLASS,"String_Node_Str");
  String clientId=component.getClientId(facesContext);
  options.put(PopupConstants.OPTIONS_LIST_CORD,clientId + "String_Node_Str");
  options.put(PopupConstants.OPTIONS_LIST_CLASS,component.getAttributes().get("String_Node_Str"));
  options.put(SelectHelper.OPTIONS_SELECT_ITEM_VALUE_INPUT,clientId + "String_Node_Str");
  options.put(SelectHelper.OPTIONS_LIST_ITEMS,additional);
  options.put(OPTIONS_VISIBLE,component.getAttributes().get("String_Node_Str"));
}
Program: 18156
Project: 18156
Buggy source:
protected void doDecode(FacesContext context,UIComponent component){
  String clientId=component.getClientId(context);
  Map requestParameterMap=context.getExternalContext().getRequestParameterMap();
  String newValue=(String)requestParameterMap.get(clientId);
  if (null != newValue) {
    UIInput input=(UIInput)component;
    input.setSubmittedValue(newValue);
  }
}

Fixed version (ground truth):
protected void doDecode(FacesContext context,UIComponent component){
  String clientId=component.getClientId(context);
  Map<String,String> requestParameterMap=context.getExternalContext().getRequestParameterMap();
  String newValue=(String)requestParameterMap.get(clientId);
  if (null != newValue) {
    UIInput input=(UIInput)component;
    input.setSubmittedValue(newValue);
  }
}
Program: 18157
Project: 18157
Buggy source:
public static String getSelectInputLabel(FacesContext facesContext,UIComponent component){
  AbstractSelect select=(AbstractSelect)component;
  Object value=select.getSubmittedValue();
  if (value == null) {
    value=select.getValue();
    if (value != null) {
      List<SelectItem> items=SelectUtils.getSelectItems(facesContext,component);
      for (      SelectItem item : items) {
        if (value.equals(item.getValue())) {
          value=item.getLabel();
        }
      }
    }
  }
  return (String)value;
}

Fixed version (ground truth):
public static String getSelectInputLabel(FacesContext facesContext,UIComponent component){
  AbstractSelect select=(AbstractSelect)component;
  Object value=select.getSubmittedValue();
  String label=null;
  if (value == null) {
    value=select.getValue();
    if (value != null) {
      List<SelectItem> items=SelectUtils.getSelectItems(facesContext,component);
      for (      SelectItem item : items) {
        if (value.equals(item.getValue())) {
          label=item.getLabel();
        }
      }
    }
  }
  return label;
}
Program: 18158
Project: 18158
Buggy source:
public void buildScript(ResponseWriter writer,FacesContext facesContext,UIComponent component,List<ClientSelectItem> selectItems) throws IOException {
  if (!(component instanceof AbstractSelect)) {
    return;
  }
  AbstractSelect abstractSelect=(AbstractSelect)component;
  String scriptName=getScriptName();
  JSFunction function=new JSFunction(scriptName);
  String clientId=abstractSelect.getClientId(facesContext);
  Map<String,Object> options=new HashMap<String,Object>();
  options.put(SelectHelper.OPTIONS_SHOWCONTROL,abstractSelect.isShowButton());
  options.put(SelectHelper.OPTIONS_LIST_ITEMS,selectItems);
  options.put(PopupConstants.OPTIONS_ITEM_CLASS,abstractSelect.getItemCss());
  options.put(PopupConstants.OPTIONS_SELECT_ITEM_CLASS,abstractSelect.getSelectItemCss());
  options.put(PopupConstants.OPTIONS_LIST_CLASS,abstractSelect.getListCss());
  options.put(PopupConstants.OPTIONS_LIST_CORD,clientId + "String_Node_Str");
  function.addParameter(clientId);
  function.addParameter(options);
  writer.write(function.toString());
}

Fixed version (ground truth):
public void buildScript(ResponseWriter writer,FacesContext facesContext,UIComponent component,List<ClientSelectItem> selectItems) throws IOException {
  if (!(component instanceof AbstractSelect)) {
    return;
  }
  AbstractSelect abstractSelect=(AbstractSelect)component;
  String scriptName=getScriptName();
  JSFunction function=new JSFunction(scriptName);
  String clientId=abstractSelect.getClientId(facesContext);
  Map<String,Object> options=new HashMap<String,Object>();
  options.put(SelectHelper.OPTIONS_SHOWCONTROL,abstractSelect.isShowButton());
  options.put(SelectHelper.OPTIONS_LIST_ITEMS,selectItems);
  options.put(SelectHelper.OPTIONS_SELECT_ITEM_VALUE_INPUT,clientId + "String_Node_Str");
  options.put(PopupConstants.OPTIONS_ITEM_CLASS,abstractSelect.getItemCss());
  options.put(PopupConstants.OPTIONS_SELECT_ITEM_CLASS,abstractSelect.getSelectItemCss());
  options.put(PopupConstants.OPTIONS_LIST_CLASS,abstractSelect.getListCss());
  options.put(PopupConstants.OPTIONS_LIST_CORD,clientId + "String_Node_Str");
  function.addParameter(clientId);
  function.addParameter(options);
  writer.write(function.toString());
}