nus-yam/ex-repair huggingface dataset:
Program: 162721
Project: 162721
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mContext=this;
  mListView=(MaterialListView)findViewById(R.id.material_listview);
  mListView.setCardAnimation(MaterialListView.CardAnimation.SWING_BOTTOM_IN);
  fillArray();
  mListView.setOnDismissCallback(new OnDismissCallback(){
    @Override public void onDismiss(    Card card,    int position){
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mContext=this;
  View view=findViewById(R.id.material_listview);
  if (view instanceof MaterialListView) {
    mListView=(MaterialListView)view;
  }
 else {
    mListView=(MaterialStaggeredGridView)view;
  }
  mListView.setCardAnimation(MaterialListView.CardAnimation.SWING_BOTTOM_IN);
  fillArray();
  mListView.setOnDismissCallback(new OnDismissCallback(){
    @Override public void onDismiss(    Card card,    int position){
    }
  }
);
}
Program: 162722
Project: 162722
Buggy source:
private void fillArray(){
  for (int i=0; i < 35; i++) {
    Card card=getRandomCard(i);
    mListView.getAdapter().add(card);
  }
}

Fixed version (ground truth):
private void fillArray(){
  for (int i=0; i < 35; i++) {
    Card card=getRandomCard(i);
    mListView.add(card);
  }
}
Program: 162724
Project: 162724
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  CheckedTextView checkedTextView=(CheckedTextView)view;
  checkedTextView.setChecked(!checkedTextView.isChecked());
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  boolean checked=((BasicListCard)card).isItemChecked(((BasicListCard)card).getItems().get(position));
  ((BasicListCard)card).setItemChecked(position,!checked);
}
Program: 162725
Project: 162725
Buggy source:
public void setMaterialListViewAdapter(MaterialListViewAdapter adapter){
  BusProvider.getInstance().register(this);
  mAdapter=adapter;
  setAdapter(mAdapter);
  setDivider(null);
  setDividerHeight(8);
  setDefaultListeners();
}

Fixed version (ground truth):
public void setMaterialListViewAdapter(MaterialListViewAdapter adapter){
  mAdapter=adapter;
  setAdapter(mAdapter);
  setDivider(null);
  setDividerHeight(8);
  setDefaultListeners();
}
Program: 162727
Project: 162727
Buggy source:
private Card generateNewCard(){
  Card card=new BasicImageButtonsCard();
  card.setBitmap(mContext,R.drawable.dog);
  card.setTitle("String_Node_Str");
  card.setDescription("String_Node_Str");
  return card;
}

Fixed version (ground truth):
private Card generateNewCard(){
  Card card=new BasicImageButtonsCard(this);
  card.setBitmap(mContext,R.drawable.dog);
  card.setTitle("String_Node_Str");
  card.setDescription("String_Node_Str");
  return card;
}
Program: 162728
Project: 162728
Buggy source:
@Override public void onButtonPressedListener(TextView textView){
  Toast.makeText(mContext,"String_Node_Str",Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
@Override public void onButtonPressedListener(View view,Card card){
  Toast.makeText(mContext,"String_Node_Str",Toast.LENGTH_SHORT).show();
}
Program: 162730
Project: 162730
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup viewGroup){
  if (convertView == null) {
    boolean found=false;
    for (int i=0; i < mClassList.size() && !found; i++) {
      if (mClassList.get(i).isInstance(getItem(position))) {
        convertView=View.inflate(mContext,getItem(position).getLayout(),null);
        found=true;
      }
    }
  }
  ((GridItemView)convertView).configureView(getItem(position));
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup viewGroup){
  if (convertView == null) {
    boolean found=false;
    for (int i=0; i < mClassList.size() && !found; i++) {
      if (mClassList.get(i).isInstance(getItem(position))) {
        convertView=View.inflate(mContext,getItem(position).getLayout(),null);
        found=true;
      }
    }
  }
 else {
    if (mDeletedList.contains(getItem(position).getClass())) {
      convertView=View.inflate(mContext,getItem(position).getLayout(),null);
    }
  }
  ((GridItemView)convertView).configureView(getItem(position));
  return convertView;
}
Program: 162731
Project: 162731
Buggy source:
public void remove(Card card){
  if (mCardList != null)   mCardList.remove(card);
  notifyDataSetChanged();
}

Fixed version (ground truth):
public void remove(Card card){
  if (mCardList != null) {
    if (!mDeletedList.contains(card.getClass())) {
      mDeletedList.add(card.getClass());
      Log.d("String_Node_Str",card.getClass().toString());
    }
    mCardList.remove(card);
  }
  notifyDataSetChanged();
}
Program: 162733
Project: 162733
Buggy source:
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}
Program: 162734
Project: 162734
Buggy source:
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER_VERTICAL);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}

Fixed version (ground truth):
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}
Program: 162735
Project: 162735
Buggy source:
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}
Program: 162736
Project: 162736
Buggy source:
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}
Program: 162737
Project: 162737
Buggy source:
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER_VERTICAL);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}

Fixed version (ground truth):
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}
Program: 162738
Project: 162738
Buggy source:
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}
Program: 162739
Project: 162739
Buggy source:
@Override public Iterable<String> buildUpdates(JavaPairRDD<String,String> newData){
  return ExampleBatchLayerUpdate.countDistinctOtherWords(newData).entrySet().stream().map(entry -> {
    String word=entry.getKey();
    int count=entry.getValue();
    int newCount;
synchronized (distinctOtherWords) {
      Integer oldCount=distinctOtherWords.get(word);
      newCount=oldCount == null ? count : oldCount + count;
      distinctOtherWords.put(word,newCount);
    }
    return word + "String_Node_Str" + newCount;
  }
).collect(Collectors.toList());
}

Fixed version (ground truth):
@Override public Iterable<String> buildUpdates(JavaPairRDD<String,String> newData){
  return ExampleBatchLayerUpdate.countDistinctOtherWords(newData).entrySet().stream().map(entry -> {
    String word=entry.getKey();
    int count=entry.getValue();
    int newCount;
synchronized (distinctOtherWords) {
      newCount=count + distinctOtherWords.getOrDefault(word,0);
      distinctOtherWords.put(word,newCount);
    }
    return word + "String_Node_Str" + newCount;
  }
).collect(Collectors.toList());
}
Program: 162740
Project: 162740
Buggy source:
@Override protected String getName(){
  return NAME;
}

Fixed version (ground truth):
/** 
 * @deprecated because superclass method is deprecated
 */
@Override @Deprecated protected String getName(){
  return NAME;
}
Program: 162741
Project: 162741
Buggy source:
private void configureTomcat(Tomcat tomcat,Connector connector){
  tomcat.setBaseDir(noSuchBaseDir.toAbsolutePath().toString());
  tomcat.setConnector(connector);
  tomcat.getService().addConnector(connector);
}

Fixed version (ground truth):
private void configureTomcat(Tomcat tomcat,Connector connector){
  tomcat.setBaseDir(noSuchBaseDir.toAbsolutePath().toString());
  tomcat.setConnector(connector);
}
Program: 162742
Project: 162742
Buggy source:
@Test public void testAuthenticate() throws Exception {
  InMemoryRealm realm=new InMemoryRealm();
  StandardContext ctx=new StandardContext();
  ctx.setName("String_Node_Str");
  realm.setContainer(ctx);
  realm.start();
  realm.addUser("String_Node_Str","String_Node_Str");
  assertNotNull(realm.getName());
  Principal authPrincipal=realm.authenticate("String_Node_Str","String_Node_Str");
  assertNotNull(authPrincipal);
  assertEquals("String_Node_Str",authPrincipal.getName());
  assertNull(realm.authenticate("String_Node_Str","String_Node_Str"));
  assertNull(realm.authenticate("String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",realm.getPassword("String_Node_Str"));
  assertEquals("String_Node_Str",realm.getPrincipal("String_Node_Str").getName());
}

Fixed version (ground truth):
@Test public void testAuthenticate() throws Exception {
  InMemoryRealm realm=new InMemoryRealm();
  StandardContext ctx=new StandardContext();
  ctx.setName("String_Node_Str");
  realm.setContainer(ctx);
  realm.start();
  realm.addUser("String_Node_Str","String_Node_Str");
  Principal authPrincipal=realm.authenticate("String_Node_Str","String_Node_Str");
  assertNotNull(authPrincipal);
  assertEquals("String_Node_Str",authPrincipal.getName());
  assertNull(realm.authenticate("String_Node_Str","String_Node_Str"));
  assertNull(realm.authenticate("String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",realm.getPassword("String_Node_Str"));
  assertEquals("String_Node_Str",realm.getPrincipal("String_Node_Str").getName());
}
Program: 162743
Project: 162743
Buggy source:
public ALSUpdate(Config config){
  super(config);
  iterations=config.getInt("String_Node_Str");
  implicit=config.getBoolean("String_Node_Str");
  logStrength=config.getBoolean("String_Node_Str");
  Preconditions.checkArgument(iterations > 0);
  hyperParamValues=Arrays.asList(HyperParams.fromConfig(config,"String_Node_Str"),HyperParams.fromConfig(config,"String_Node_Str"),HyperParams.fromConfig(config,"String_Node_Str"));
  if (logStrength) {
    hyperParamValues.add(HyperParams.fromConfig(config,"String_Node_Str"));
  }
  noKnownItems=config.getBoolean("String_Node_Str");
  decayFactor=config.getDouble("String_Node_Str");
  decayZeroThreshold=config.getDouble("String_Node_Str");
  Preconditions.checkArgument(iterations > 0);
  Preconditions.checkArgument(decayFactor > 0.0 && decayFactor <= 1.0);
  Preconditions.checkArgument(decayZeroThreshold >= 0.0);
}

Fixed version (ground truth):
public ALSUpdate(Config config){
  super(config);
  iterations=config.getInt("String_Node_Str");
  implicit=config.getBoolean("String_Node_Str");
  logStrength=config.getBoolean("String_Node_Str");
  Preconditions.checkArgument(iterations > 0);
  hyperParamValues=new ArrayList<>(Arrays.asList(HyperParams.fromConfig(config,"String_Node_Str"),HyperParams.fromConfig(config,"String_Node_Str"),HyperParams.fromConfig(config,"String_Node_Str")));
  if (logStrength) {
    hyperParamValues.add(HyperParams.fromConfig(config,"String_Node_Str"));
  }
  noKnownItems=config.getBoolean("String_Node_Str");
  decayFactor=config.getDouble("String_Node_Str");
  decayZeroThreshold=config.getDouble("String_Node_Str");
  Preconditions.checkArgument(iterations > 0);
  Preconditions.checkArgument(decayFactor > 0.0 && decayFactor <= 1.0);
  Preconditions.checkArgument(decayZeroThreshold >= 0.0);
}
Program: 162744
Project: 162744
Buggy source:
private static Map<TopicAndPartition,?> getLeaderOffsets(KafkaCluster kc,Map<TopicAndPartition,Long> offsets,Predicate<Map.Entry<TopicAndPartition,Long>> predicate,boolean earliest){
  Set<TopicAndPartition> needOffset=offsets.entrySet().stream().filter(predicate).map(Map.Entry::getKey).collect(Collectors.toSet());
  @SuppressWarnings("String_Node_Str") scala.collection.immutable.Set<TopicAndPartition> needOffsetScalaSet=(scala.collection.immutable.Set<TopicAndPartition>)scala.collection.immutable.Set$.MODULE$.apply(JavaConversions.asScalaSet(needOffset).toSeq());
  return JavaConversions.mapAsJavaMap((earliest ? kc.getEarliestLeaderOffsets(needOffsetScalaSet) : kc.getLatestLeaderOffsets(needOffsetScalaSet)).right().get());
}

Fixed version (ground truth):
private static Map<TopicAndPartition,?> getLeaderOffsets(KafkaCluster kc,Map<TopicAndPartition,Long> offsets,Predicate<Map.Entry<TopicAndPartition,Long>> predicate,boolean earliest){
  Set<TopicAndPartition> needOffset=offsets.entrySet().stream().filter(predicate).map(Map.Entry::getKey).collect(Collectors.toSet());
  if (needOffset.isEmpty()) {
    return Collections.emptyMap();
  }
  @SuppressWarnings("String_Node_Str") scala.collection.immutable.Set<TopicAndPartition> needOffsetScalaSet=(scala.collection.immutable.Set<TopicAndPartition>)scala.collection.immutable.Set$.MODULE$.apply(JavaConversions.asScalaSet(needOffset).toSeq());
  return JavaConversions.mapAsJavaMap((earliest ? kc.getEarliestLeaderOffsets(needOffsetScalaSet) : kc.getLatestLeaderOffsets(needOffsetScalaSet)).right().get());
}
Program: 162745
Project: 162745
Buggy source:
private static void fillInLatestOffsets(Map<TopicAndPartition,Long> offsets,Map<String,String> kafkaParams){
  if (offsets.containsValue(null)) {
    @SuppressWarnings("String_Node_Str") scala.collection.immutable.Map<String,String> kafkaParamsScalaMap=(scala.collection.immutable.Map<String,String>)scala.collection.immutable.Map$.MODULE$.apply(JavaConversions.mapAsScalaMap(kafkaParams).toSeq());
    KafkaCluster kc=new KafkaCluster(kafkaParamsScalaMap);
    getLeaderOffsets(kc,offsets,entry -> entry.getValue() == null,false).forEach((tAndP,leaderOffsetsObj) -> {
      long latestTopicOffset=readOffset(leaderOffsetsObj);
      log.info("String_Node_Str",tAndP,latestTopicOffset);
      offsets.put(tAndP,latestTopicOffset);
    }
);
    Set<TopicAndPartition> hadOffset=offsets.entrySet().stream().filter(entry -> entry.getValue() != null).map(Map.Entry::getKey).collect(Collectors.toSet());
    getLeaderOffsets(kc,offsets,entry -> entry.getValue() != null,true).forEach((tAndP,leaderOffsetsObj) -> {
      long earliestTopicOffset=readOffset(leaderOffsetsObj);
      long currentOffset=offsets.get(tAndP);
      if (currentOffset < earliestTopicOffset) {
        log.warn("String_Node_Str",currentOffset,tAndP,earliestTopicOffset);
        offsets.put(tAndP,earliestTopicOffset);
      }
    }
);
  }
}

Fixed version (ground truth):
private static void fillInLatestOffsets(Map<TopicAndPartition,Long> offsets,Map<String,String> kafkaParams){
  @SuppressWarnings("String_Node_Str") scala.collection.immutable.Map<String,String> kafkaParamsScalaMap=(scala.collection.immutable.Map<String,String>)scala.collection.immutable.Map$.MODULE$.apply(JavaConversions.mapAsScalaMap(kafkaParams).toSeq());
  KafkaCluster kc=new KafkaCluster(kafkaParamsScalaMap);
  getLeaderOffsets(kc,offsets,entry -> entry.getValue() == null,false).forEach((tAndP,leaderOffsetsObj) -> {
    long latestTopicOffset=readOffset(leaderOffsetsObj);
    log.info("String_Node_Str",tAndP,latestTopicOffset);
    offsets.put(tAndP,latestTopicOffset);
  }
);
  getLeaderOffsets(kc,offsets,entry -> entry.getValue() != null,true).forEach((tAndP,leaderOffsetsObj) -> {
    long earliestTopicOffset=readOffset(leaderOffsetsObj);
    long currentOffset=offsets.get(tAndP);
    if (currentOffset < earliestTopicOffset) {
      log.warn("String_Node_Str",currentOffset,tAndP,earliestTopicOffset);
      offsets.put(tAndP,earliestTopicOffset);
    }
  }
);
}
Program: 162750
Project: 162750
Buggy source:
private static String abbreviatedToString(Collection<?> c){
  return c.stream().limit(16).collect(Collectors.toList()) + (c.size() > 16 ? "String_Node_Str" : "String_Node_Str");
}

Fixed version (ground truth):
private static <T>String abbreviatedToString(Collection<T> c){
  return c.size() <= 16 ? c.toString() : c.stream().limit(16).collect(Collectors.toList()) + "String_Node_Str";
}
Program: 162751
Project: 162751
Buggy source:
@Override public final String toString(){
  return id + "String_Node_Str" + getValueString();
}

Fixed version (ground truth):
@Override public final String toString(){
  return id + "String_Node_Str" + valueString();
}
Program: 162752
Project: 162752
Buggy source:
@Override public final String toCSV(){
  return id + "String_Node_Str" + getValueString();
}

Fixed version (ground truth):
@Override public final String toCSV(){
  return id + "String_Node_Str" + valueString();
}
Program: 162753
Project: 162753
Buggy source:
@Override protected final DeploymentContext configureDeployment(){
  configureProperties();
  String joinedPackages=Joiner.on(',').join(getResourcePackages());
  return ServletDeploymentContext.builder(OryxApplication.class).initParam("String_Node_Str",OryxApplication.class.getName()).contextParam(OryxApplication.class.getName() + "String_Node_Str",joinedPackages).addListener(getInitListenerClass()).build();
}

Fixed version (ground truth):
@Override protected final DeploymentContext configureDeployment(){
  configureProperties();
  String joinedPackages=Joiner.on(',').join(getResourcePackages()) + "String_Node_Str";
  return ServletDeploymentContext.builder(OryxApplication.class).initParam("String_Node_Str",OryxApplication.class.getName()).contextParam(OryxApplication.class.getName() + "String_Node_Str",joinedPackages).addListener(getInitListenerClass()).build();
}
Program: 162754
Project: 162754
Buggy source:
@Test public void testError(){
  MockHttpServletRequest mockRequest=new MockHttpServletRequest();
  mockRequest.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,500);
  mockRequest.setAttribute(RequestDispatcher.ERROR_REQUEST_URI,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_MESSAGE,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_EXCEPTION,new IllegalStateException());
  Response response=new ErrorResource().error(mockRequest);
  assertEquals(500,response.getStatus());
  String responseBody=response.getEntity().toString();
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testError(){
  MockHttpServletRequest mockRequest=new MockHttpServletRequest();
  mockRequest.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,500);
  mockRequest.setAttribute(RequestDispatcher.ERROR_REQUEST_URI,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_MESSAGE,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_EXCEPTION,new IllegalStateException());
  Response response=new ErrorResource().errorHTML(mockRequest);
  assertEquals(500,response.getStatus());
  String responseBody=response.getEntity().toString();
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
}
Program: 162755
Project: 162755
Buggy source:
/** 
 * @param zkServers Zookeeper server string: host1:port1[,host2:port2,...]
 * @param topic topic to create (if not already existing)
 * @param topicProperties optional topic config properties
 */
public static void maybeCreateTopic(String zkServers,String topic,int partitions,Properties topicProperties){
  try (AutoZkClient zkClient=new AutoZkClient(zkServers)){
    if (AdminUtils.topicExists(zkClient,topic)) {
      log.info("String_Node_Str",topic);
    }
 else {
      log.info("String_Node_Str",topic);
      try {
        AdminUtils.createTopic(zkClient,topic,partitions,1,topicProperties);
        log.info("String_Node_Str",topic);
      }
 catch (      TopicExistsException tee) {
        log.info("String_Node_Str",topic);
      }
    }
  }
 }

Fixed version (ground truth):
/** 
 * @param zkServers Zookeeper server string: host1:port1[,host2:port2,...]
 * @param topic topic to create (if not already existing)
 * @param partitions number of topic partitions
 * @param topicProperties optional topic config properties
 */
public static void maybeCreateTopic(String zkServers,String topic,int partitions,Properties topicProperties){
  try (AutoZkClient zkClient=new AutoZkClient(zkServers)){
    if (AdminUtils.topicExists(zkClient,topic)) {
      log.info("String_Node_Str",topic);
    }
 else {
      log.info("String_Node_Str",topic);
      try {
        AdminUtils.createTopic(zkClient,topic,partitions,1,topicProperties);
        log.info("String_Node_Str",topic);
      }
 catch (      TopicExistsException tee) {
        log.info("String_Node_Str",topic);
      }
    }
  }
 }
Program: 162758
Project: 162758
Buggy source:
private static void checkProbability(int majorityCount,int count,BinomialDistribution dist){
  double expected=0.9 * count;
  double probAsExtreme=majorityCount <= expected ? dist.cumulativeProbability(majorityCount) : 1.0 - dist.cumulativeProbability(majorityCount);
  assertTrue(majorityCount + "String_Node_Str" + expected+ "String_Node_Str"+ count+ "String_Node_Str",probAsExtreme >= 0.001);
}

Fixed version (ground truth):
private static void checkProbability(int majorityCount,int count,BinomialDistribution dist){
  double expected=0.9 * count;
  double probAsExtreme=majorityCount <= expected ? dist.cumulativeProbability(majorityCount) : (1.0 - dist.cumulativeProbability(majorityCount)) + dist.probability(majorityCount);
  assertTrue(majorityCount + "String_Node_Str" + expected+ "String_Node_Str"+ count+ "String_Node_Str",probAsExtreme >= 0.001);
}
Program: 162759
Project: 162759
Buggy source:
@Override public PMML buildModel(JavaSparkContext sparkContext,JavaRDD<String> trainData,List<?> hyperParameters,Path candidatePath){
  int features=(Integer)hyperParameters.get(0);
  double lambda=(Double)hyperParameters.get(1);
  double alpha=(Double)hyperParameters.get(2);
  Preconditions.checkArgument(features > 0);
  Preconditions.checkArgument(lambda >= 0.0);
  Preconditions.checkArgument(alpha > 0.0);
  JavaRDD<String[]> parsedRDD=trainData.map(MLFunctions.PARSE_FN);
  JavaRDD<Rating> trainRatingData=parsedToRatingRDD(parsedRDD);
  trainRatingData=aggregateScores(trainRatingData);
  MatrixFactorizationModel model;
  if (implicit) {
    model=ALS.trainImplicit(trainRatingData.rdd(),features,iterations,lambda,alpha);
  }
 else {
    model=ALS.train(trainRatingData.rdd(),features,iterations,lambda);
  }
  Map<Integer,String> reverseIDLookup=parsedRDD.flatMapToPair(new ToReverseLookupFn()).reduceByKey(Functions.<String>last()).collectAsMap();
  PMML pmml=mfModelToPMML(model,features,lambda,alpha,implicit,candidatePath,reverseIDLookup);
  unpersist(model);
  return pmml;
}

Fixed version (ground truth):
@Override public PMML buildModel(JavaSparkContext sparkContext,JavaRDD<String> trainData,List<?> hyperParameters,Path candidatePath){
  int features=(Integer)hyperParameters.get(0);
  double lambda=(Double)hyperParameters.get(1);
  double alpha=(Double)hyperParameters.get(2);
  Preconditions.checkArgument(features > 0);
  Preconditions.checkArgument(lambda >= 0.0);
  Preconditions.checkArgument(alpha > 0.0);
  JavaRDD<String[]> parsedRDD=trainData.map(MLFunctions.PARSE_FN);
  JavaRDD<Rating> trainRatingData=parsedToRatingRDD(parsedRDD);
  trainRatingData=aggregateScores(trainRatingData);
  MatrixFactorizationModel model;
  if (implicit) {
    model=ALS.trainImplicit(trainRatingData.rdd(),features,iterations,lambda,alpha);
  }
 else {
    model=ALS.train(trainRatingData.rdd(),features,iterations,lambda);
  }
  Map<Integer,String> reverseIDLookup=parsedRDD.flatMapToPair(new ToReverseLookupFn()).reduceByKey(Functions.<String>last()).collectAsMap();
  reverseIDLookup=new HashMap<>(reverseIDLookup);
  PMML pmml=mfModelToPMML(model,features,lambda,alpha,implicit,candidatePath,reverseIDLookup);
  unpersist(model);
  return pmml;
}
Program: 162760
Project: 162760
Buggy source:
protected static <T>void assertContainsSame(Collection<T> a,Collection<T> b){
  assertTrue((a == null && b == null) || (a.containsAll(b) && b.containsAll(a)));
}

Fixed version (ground truth):
protected static <T>void assertContainsSame(Collection<T> expected,Collection<T> actual){
  if (expected == null) {
    assertNull(actual);
  }
 else {
    assertNotNull(actual);
    assertEquals(expected.size(),actual.size());
    assertTrue(expected.containsAll(actual) && actual.containsAll(expected));
  }
}
Program: 162761
Project: 162761
Buggy source:
/** 
 * @param elements values to join by space to make one line of text
 * @return one line of text, formatted according to PMML quoting rules(\" instead of "" for escaping quotes; ignore space surrounding values
 */
public static String joinPMMLDelimited(Iterable<?> elements){
  String rawResult=doJoinDelimited(elements,formatForDelimiter(' '));
  return TWO_DOUBLE_QUOTE.matcher(rawResult).replaceAll("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param elements values to join by space to make one line of text
 * @return one line of text, formatted according to PMML quoting rules(\" instead of "" for escaping quotes; ignore space surrounding values
 */
public static String joinPMMLDelimited(Iterable<?> elements){
  String rawResult=doJoinDelimited(elements,formatForDelimiter(' '));
  return TWO_DOUBLE_QUOTE_ESC.matcher(rawResult).replaceAll(SLASH_QUOTE_ESC);
}
Program: 162762
Project: 162762
Buggy source:
public synchronized void update(double[] newPoint,long newCount){
  int length=center.length;
  Preconditions.checkArgument(length == newPoint.length);
  double[] newCenter=new double[length];
  for (int i=0; i < length; i++) {
    newCenter[i]=(newPoint[i] * newCount + center[i] * count) / (newCount + count);
  }
  this.center=newCenter;
  count+=newCount;
}

Fixed version (ground truth):
public synchronized void update(double[] newPoint,long newCount){
  int length=center.length;
  Preconditions.checkArgument(length == newPoint.length);
  double[] newCenter=new double[length];
  long newTotalCount=newCount + count;
  double newToTotal=(double)newCount / newTotalCount;
  for (int i=0; i < length; i++) {
    double centerI=center[i];
    newCenter[i]=centerI + newToTotal * (newPoint[i] - centerI);
  }
  center=newCenter;
  count=newTotalCount;
}
Program: 162763
Project: 162763
Buggy source:
@Override public String toString(){
  return id + "String_Node_Str" + Arrays.toString(center)+ "String_Node_Str"+ count;
}

Fixed version (ground truth):
@Override public synchronized String toString(){
  return id + "String_Node_Str" + Arrays.toString(center)+ "String_Node_Str"+ count;
}
Program: 162764
Project: 162764
Buggy source:
private void recompute(){
  int total=getCount();
  int maxCount=-1;
  int theMaxCategory=-1;
  for (int i=0; i < categoryCounts.length; i++) {
    int count=categoryCounts[i];
    if (count > maxCount) {
      maxCount=count;
      theMaxCategory=i;
    }
    categoryProbabilities[i]=(double)count / total;
  }
  Preconditions.checkArgument(theMaxCategory >= 0);
  maxCategory=theMaxCategory;
}

Fixed version (ground truth):
private synchronized void recompute(){
  int total=getCount();
  int maxCount=-1;
  int theMaxCategory=-1;
  double[] newCategoryProbabilities=new double[categoryCounts.length];
  for (int i=0; i < newCategoryProbabilities.length; i++) {
    int count=categoryCounts[i];
    if (count > maxCount) {
      maxCount=count;
      theMaxCategory=i;
    }
    newCategoryProbabilities[i]=(double)count / total;
  }
  categoryProbabilities=newCategoryProbabilities;
  Preconditions.checkArgument(theMaxCategory >= 0);
  maxCategory=theMaxCategory;
}
Program: 162765
Project: 162765
Buggy source:
public synchronized void update(double mean,int count){
  int oldCount=getCount();
  int newCount=oldCount + count;
  setCount(newCount);
  prediction=(oldCount / (double)newCount) * prediction + (mean * count) / newCount;
}

Fixed version (ground truth):
public synchronized void update(double newPrediction,int newCount){
  int count=getCount();
  int newTotalCount=count + newCount;
  double newToTotal=(double)newCount / newTotalCount;
  setCount(newTotalCount);
  prediction+=newToTotal * (newPrediction - prediction);
}
Program: 162766
Project: 162766
Buggy source:
@Test public void testUpdate(){
  ClusterInfo info=new ClusterInfo(0,new double[]{-1.0,2.0},2);
  assertEquals(0,info.getID());
  assertArrayEquals(new double[]{-1.0,2.0},info.getCenter());
  assertEquals(2,info.getCount());
  assertTrue("String_Node_Str".equals(info.toString()));
  info.update(new double[]{-1.0,-1.0});
  assertEquals(0,info.getID());
  assertArrayEquals(new double[]{-1.0,1.0},info.getCenter());
  assertEquals(3,info.getCount());
  assertTrue("String_Node_Str".equals(info.toString()));
  info.update(new double[]{0.0,0.0},3);
  assertEquals(0,info.getID());
  assertArrayEquals(new double[]{-0.5,0.5},info.getCenter());
  assertEquals(6,info.getCount());
  assertTrue("String_Node_Str".equals(info.toString()));
}

Fixed version (ground truth):
@Test public void testUpdate(){
  ClusterInfo info=new ClusterInfo(0,new double[]{-1.0,2.0},2);
  assertEquals(0,info.getID());
  assertArrayEquals(new double[]{-1.0,2.0},info.getCenter());
  assertEquals(2,info.getCount());
  assertEquals("String_Node_Str",info.toString());
  info.update(new double[]{-1.0,-1.0});
  assertEquals(0,info.getID());
  assertArrayEquals(new double[]{-1.0,1.0},info.getCenter());
  assertEquals(3,info.getCount());
  assertEquals("String_Node_Str",info.toString());
  info.update(new double[]{0.0,0.0},3);
  assertEquals(0,info.getID());
  assertArrayEquals(new double[]{-0.5,0.5},info.getCenter());
  assertEquals(6,info.getCount());
  assertEquals("String_Node_Str",info.toString());
}
Program: 162767
Project: 162767
Buggy source:
@GET @Path("String_Node_Str") @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public Collection<String> get(){
  return getALSServingModel().getAllItemIDs();
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public Collection<String> get() throws OryxServingException {
  return getALSServingModel().getAllItemIDs();
}
Program: 162768
Project: 162768
Buggy source:
@GET @Path("String_Node_Str") @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public Collection<String> get(){
  return getALSServingModel().getAllUserIDs();
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public Collection<String> get() throws OryxServingException {
  return getALSServingModel().getAllUserIDs();
}
Program: 162769
Project: 162769
Buggy source:
@GET @Path("String_Node_Str") @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public Collection<String> get(@PathParam("String_Node_Str") String userID){
  Collection<String> knownItems=getALSServingModel().getKnownItems(userID);
  if (knownItems == null) {
    return Collections.emptyList();
  }
 else {
synchronized (knownItems) {
      return new ArrayList<>(knownItems);
    }
  }
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public Collection<String> get(@PathParam("String_Node_Str") String userID) throws OryxServingException {
  Collection<String> knownItems=getALSServingModel().getKnownItems(userID);
  if (knownItems == null) {
    return Collections.emptyList();
  }
 else {
synchronized (knownItems) {
      return new ArrayList<>(knownItems);
    }
  }
}
Program: 162770
Project: 162770
Buggy source:
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<IDCount> get(@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int howMany,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int offset,@QueryParam("String_Node_Str") List<String> rescorerParams){
  ALSServingModel model=getALSServingModel();
  RescorerProvider rescorerProvider=model.getRescorerProvider();
  Rescorer rescorer=null;
  if (rescorerProvider != null) {
    rescorer=rescorerProvider.getMostActiveUsersRescorer(rescorerParams);
  }
  return MostPopularItems.mapTopCountsToIDCounts(model.getUserCounts(),howMany,offset,rescorer);
}

Fixed version (ground truth):
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<IDCount> get(@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int howMany,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int offset,@QueryParam("String_Node_Str") List<String> rescorerParams) throws OryxServingException {
  ALSServingModel model=getALSServingModel();
  RescorerProvider rescorerProvider=model.getRescorerProvider();
  Rescorer rescorer=null;
  if (rescorerProvider != null) {
    rescorer=rescorerProvider.getMostActiveUsersRescorer(rescorerParams);
  }
  return MostPopularItems.mapTopCountsToIDCounts(model.getUserCounts(),howMany,offset,rescorer);
}
Program: 162771
Project: 162771
Buggy source:
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<IDCount> get(@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int howMany,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int offset,@QueryParam("String_Node_Str") List<String> rescorerParams){
  ALSServingModel model=getALSServingModel();
  RescorerProvider rescorerProvider=model.getRescorerProvider();
  Rescorer rescorer=null;
  if (rescorerProvider != null) {
    rescorer=rescorerProvider.getMostPopularItemsRescorer(rescorerParams);
  }
  return mapTopCountsToIDCounts(model.getItemCounts(),howMany,offset,rescorer);
}

Fixed version (ground truth):
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<IDCount> get(@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int howMany,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") int offset,@QueryParam("String_Node_Str") List<String> rescorerParams) throws OryxServingException {
  ALSServingModel model=getALSServingModel();
  RescorerProvider rescorerProvider=model.getRescorerProvider();
  Rescorer rescorer=null;
  if (rescorerProvider != null) {
    rescorer=rescorerProvider.getMostPopularItemsRescorer(rescorerParams);
  }
  return mapTopCountsToIDCounts(model.getItemCounts(),howMany,offset,rescorer);
}
Program: 162772
Project: 162772
Buggy source:
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<String> get(){
  ALSServingModel model=getALSServingModel();
  int features=model.getFeatures();
  List<String> items=new ArrayList<>(features);
  float[] unitVector=new float[features];
  for (int i=0; i < features; i++) {
    unitVector[i]=1.0f;
    List<Pair<String,Double>> topIDDot=model.topN(new DotsFunction(unitVector),1);
    items.add(topIDDot.isEmpty() ? null : topIDDot.get(0).getFirst());
    unitVector[i]=0.0f;
  }
  return items;
}

Fixed version (ground truth):
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<String> get() throws OryxServingException {
  ALSServingModel model=getALSServingModel();
  int features=model.getFeatures();
  List<String> items=new ArrayList<>(features);
  float[] unitVector=new float[features];
  for (int i=0; i < features; i++) {
    unitVector[i]=1.0f;
    List<Pair<String,Double>> topIDDot=model.topN(new DotsFunction(unitVector),1);
    items.add(topIDDot.isEmpty() ? null : topIDDot.get(0).getFirst());
    unitVector[i]=0.0f;
  }
  return items;
}
Program: 162773
Project: 162773
Buggy source:
@HEAD public Response head(){
  return get();
}

Fixed version (ground truth):
@HEAD public Response head() throws OryxServingException {
  return get();
}
Program: 162774
Project: 162774
Buggy source:
@GET public Response get(){
  return getALSServingModel() == null ? Response.status(Response.Status.SERVICE_UNAVAILABLE).build() : Response.ok().build();
}

Fixed version (ground truth):
@GET public Response get() throws OryxServingException {
  getALSServingModel();
  return Response.ok().build();
}
Program: 162775
Project: 162775
Buggy source:
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<Double> getAllImportances(){
  RDFServingModel model=getRDFServingModel();
  double[] importances=model.getForest().getFeatureImportances();
  List<Double> result=new ArrayList<>(importances.length);
  for (  double importance : importances) {
    result.add(importance);
  }
  return result;
}

Fixed version (ground truth):
@GET @Produces({MediaType.TEXT_PLAIN,CSVMessageBodyWriter.TEXT_CSV,MediaType.APPLICATION_JSON}) public List<Double> getAllImportances() throws OryxServingException {
  RDFServingModel model=getRDFServingModel();
  double[] importances=model.getForest().getFeatureImportances();
  List<Double> result=new ArrayList<>(importances.length);
  for (  double importance : importances) {
    result.add(importance);
  }
  return result;
}