nus-yam/ex-repair huggingface dataset:
Program: 62977
Project: 62977
Buggy source:
private void drawMinutesPointer(ClockElement clockElement){
  clear(minutesRootSvg);
  minutesRootSvg.appendChild(minutesCircle);
  minutesRootSvg.appendChild(clockElement.getCircle());
  minutesRootSvg.appendChild(clockElement.getLine());
  minutesRootSvg.appendChild(clockElement.getInnerCircle());
  minutesRootSvg.appendChild(minutesCenterCircle);
}

Fixed version (ground truth):
private void drawMinutesPointer(ClockElement clockElement){
  minutesRootSvg.appendChild(minutesCenterCircle);
  minutesRootSvg.appendChild(clockElement.getCircle());
  minutesRootSvg.appendChild(clockElement.getLine());
  minutesRootSvg.appendChild(clockElement.getInnerCircle());
}
Program: 62978
Project: 62978
Buggy source:
private void selectMinute(int minute,boolean silent){
  ClockElement clockElement=minutesElements.get(minute);
  drawMinutesPointer(clockElement);
  updateMinute(minute);
  formatTime();
  if (!silent)   onTimeChanged();
  Animation.create(minutesText).transition(Transition.FLIP_IN_X).duration(600).animate();
}

Fixed version (ground truth):
private void selectMinute(int minute,boolean silent){
  ClockElement clockElement=minutesElements.get(minute);
  clear(minutesRootSvg);
  minutesRootSvg.appendChild(minutesCircle);
  drawMinutesPointer(clockElement);
  updateMinute(minute);
  formatTime();
  if (!silent)   onTimeChanged();
  Animation.create(minutesText).transition(Transition.FLIP_IN_X).duration(600).animate();
}
Program: 62979
Project: 62979
Buggy source:
public Alert appendLink(HTMLAnchorElement anchorElement){
  if (nonNull(anchorElement)) {
    anchorElement.classList.add("String_Node_Str");
    alertElement.appendChild(anchorElement);
  }
  return this;
}

Fixed version (ground truth):
public Alert appendLink(HTMLAnchorElement anchorElement){
  if (nonNull(anchorElement)) {
    anchorElement.classList.add("String_Node_Str");
    element.appendChild(anchorElement);
  }
  return this;
}
Program: 62980
Project: 62980
Buggy source:
public Alert unDismissible(){
  if (dismissible) {
    alertElement.classList.remove("String_Node_Str");
    alertElement.removeChild(closeButton);
  }
  dismissible=false;
  return this;
}

Fixed version (ground truth):
public Alert unDismissible(){
  if (dismissible) {
    element.classList.remove("String_Node_Str");
    element.removeChild(closeButton);
  }
  dismissible=false;
  return this;
}
Program: 62981
Project: 62981
Buggy source:
@Override public Alert setBackground(Background background){
  if (nonNull(style))   alertElement.classList.remove(style);
  this.style=background.getStyle();
  alertElement.classList.add(this.style);
  return this;
}

Fixed version (ground truth):
@Override public Alert setBackground(Background background){
  if (nonNull(style))   element.classList.remove(style);
  this.style=background.getStyle();
  element.classList.add(this.style);
  return this;
}
Program: 62982
Project: 62982
Buggy source:
public Alert appendStrong(String text){
  alertElement.appendChild(strong().textContent(text).asElement());
  return this;
}

Fixed version (ground truth):
public Alert appendStrong(String text){
  element.appendChild(strong().textContent(text).asElement());
  return this;
}
Program: 62983
Project: 62983
Buggy source:
public Alert dismissible(){
  if (!dismissible) {
    alertElement.classList.add("String_Node_Str");
    if (alertElement.childElementCount > 0)     alertElement.insertBefore(closeButton,alertElement.firstChild);
 else     alertElement.appendChild(closeButton);
  }
  dismissible=true;
  return this;
}

Fixed version (ground truth):
public Alert dismissible(){
  if (!dismissible) {
    element.classList.add("String_Node_Str");
    if (element.childElementCount > 0)     element.insertBefore(closeButton,element.firstChild);
 else     element.appendChild(closeButton);
  }
  dismissible=true;
  return this;
}
Program: 62984
Project: 62984
Buggy source:
@Override public HTMLDivElement asElement(){
  return alertElement;
}

Fixed version (ground truth):
@Override public HTMLDivElement asElement(){
  return element;
}
Program: 62985
Project: 62985
Buggy source:
public Alert appendText(String text){
  alertElement.appendChild(new Text(text));
  return this;
}

Fixed version (ground truth):
public Alert appendText(String text){
  element.appendChild(new Text(text));
  return this;
}
Program: 62986
Project: 62986
Buggy source:
@Override public void setValue(String value){
  if (nonNull(value) && !value.isEmpty())   focus();
  inputElement.value=value;
}

Fixed version (ground truth):
@Override public void setValue(String value){
  inputElement.value=value;
  if (nonNull(value) && !value.isEmpty())   focus();
 else   unfocus();
}
Program: 62987
Project: 62987
Buggy source:
@Override public void setValue(String value){
  if (nonNull(value) && !value.isEmpty())   focus();
  inputElement.value=value;
}

Fixed version (ground truth):
@Override public void setValue(String value){
  inputElement.value=value;
  if (nonNull(value) && !value.isEmpty()) {
    focus();
  }
 else {
    unfocus();
  }
}
Program: 62988
Project: 62988
Buggy source:
public Popover(HTMLElement target,String title,Node content){
  this.targetElement=target;
  element.appendChild(arrowElement);
  element.appendChild(headingElement);
  element.appendChild(contentElement);
  headerText=new Text(title);
  headingElement.appendChild(headerText);
  contentElement.appendChild(content);
  showListener=evt -> {
    if (nonNull(currentVisible) && closeOthers) {
      closeOthers();
    }
    evt.stopPropagation();
    open(target);
    currentVisible.add(Popover.this);
  }
;
  target.addEventListener(EventType.click.getName(),showListener);
  closeListener=evt -> closeAll();
  DomGlobal.document.addEventListener(EventType.click.getName(),closeListener);
  element.addEventListener(EventType.click.getName(),Event::stopPropagation);
}

Fixed version (ground truth):
public Popover(HTMLElement target,String title,Node content){
  this.targetElement=target;
  element.appendChild(arrowElement);
  element.appendChild(headingElement);
  element.appendChild(contentElement);
  headerText=new Text(title);
  headingElement.appendChild(headerText);
  contentElement.appendChild(content);
  showListener=evt -> {
    if (nonNull(currentVisible) && closeOthers) {
      closeOthers();
    }
    evt.stopPropagation();
    open(target);
    currentVisible.add(Popover.this);
  }
;
  target.addEventListener(EventType.click.getName(),showListener);
  closeListener=evt -> closeAll();
  DomGlobal.document.body.addEventListener(EventType.click.getName(),closeListener);
  element.addEventListener(EventType.click.getName(),Event::stopPropagation);
  BodyObserver.observeRemoval(targetElement,mutationRecord -> element.remove());
}
Program: 62989
Project: 62989
Buggy source:
public Tooltip(HTMLElement targetElement,Node content){
  element.appendChild(arrowElement);
  element.appendChild(innerElement);
  innerElement.appendChild(content);
  element.classList.add(popupPosition.getDirectionClass());
  targetElement.addEventListener(EventType.mouseenter.getName(),evt -> {
    evt.stopPropagation();
    DomGlobal.document.body.appendChild(element);
    element.classList.remove("String_Node_Str","String_Node_Str");
    element.classList.add("String_Node_Str","String_Node_Str");
    popupPosition.position(element,targetElement);
    position(popupPosition);
  }
);
  EventListener onRemoveListener=new EventListener(){
    @Override public void handleEvent(    Event evt){
      if (evt.target.equals(targetElement)) {
        element.remove();
        DomGlobal.document.body.removeEventListener("String_Node_Str",this);
      }
    }
  }
;
  DomGlobal.document.body.addEventListener("String_Node_Str",onRemoveListener);
  targetElement.addEventListener(EventType.mouseleave.getName(),evt1 -> element.remove());
}

Fixed version (ground truth):
public Tooltip(HTMLElement targetElement,Node content){
  element.appendChild(arrowElement);
  element.appendChild(innerElement);
  innerElement.appendChild(content);
  element.classList.add(popupPosition.getDirectionClass());
  targetElement.addEventListener(EventType.mouseenter.getName(),evt -> {
    evt.stopPropagation();
    DomGlobal.document.body.appendChild(element);
    element.classList.remove("String_Node_Str","String_Node_Str");
    element.classList.add("String_Node_Str","String_Node_Str");
    popupPosition.position(element,targetElement);
    position(popupPosition);
  }
);
  BodyObserver.observeRemoval(targetElement,mutationRecord -> element.remove());
  targetElement.addEventListener(EventType.mouseleave.getName(),evt1 -> element.remove());
}
Program: 62990
Project: 62990
Buggy source:
public Clock12(DateTimeFormatInfo dateTimeFormatInfo){
  this.dateTimeFormatInfo=dateTimeFormatInfo;
  JsDate jsDate=new JsDate();
  this.setDayPeriod(jsDate.getHours() > 11 ? PM : AM);
  this.minute=jsDate.getMinutes();
  if (jsDate.getHours() > 12) {
    this.hour=jsDate.getHours() - 12;
  }
 else   if (jsDate.getHours() == 0) {
    this.hour=12;
  }
 else {
    this.hour=jsDate.getHours();
  }
}

Fixed version (ground truth):
Clock12(JsDate jsDate){
  this.setDayPeriod(jsDate.getHours() > 11 ? PM : AM);
  this.minute=jsDate.getMinutes();
  if (jsDate.getHours() > 12) {
    this.hour=jsDate.getHours() - 12;
  }
 else   if (jsDate.getHours() == 0) {
    this.hour=12;
  }
 else {
    this.hour=jsDate.getHours();
  }
}
Program: 62991
Project: 62991
Buggy source:
public Clock24(DateTimeFormatInfo dateTimeFormatInfo){
  this.dateTimeFormatInfo=dateTimeFormatInfo;
  JsDate date=new JsDate();
  this.hour=date.getHours();
  this.minute=date.getMinutes();
}

Fixed version (ground truth):
Clock24(JsDate jsDate){
  this.hour=jsDate.getHours();
  this.minute=jsDate.getMinutes();
}
Program: 62992
Project: 62992
Buggy source:
public Time(int hour,int minute,DayPeriod dayPeriod){
  this.hour=hour;
  this.minute=minute;
  this.dayPeriod=dayPeriod;
}

Fixed version (ground truth):
public Time(int hour,int minute,DayPeriod dayPeriod){
  JsDate jsDate=new JsDate();
  jsDate.setHours(hour);
  jsDate.setMinutes(minute);
  Clock clock;
  if (NONE.equals(dayPeriod)) {
    clock=new Clock24(jsDate);
  }
 else {
    clock=new Clock12(jsDate);
  }
  this.hour=clock.getHour();
  this.minute=clock.getMinute();
  this.dayPeriod=dayPeriod;
}
Program: 62993
Project: 62993
Buggy source:
@Override public void run(){
  Callback mCallback=callback;
  FrameLayout mPublisherViewContainer=sharedState.getPublisherViewContainer();
  Publisher mPublisher=sharedState.getPublisher();
  Session mSession=sharedState.getSession();
  mPublisherViewContainer.removeAllViews();
  mPublisherViewContainer=null;
  sharedState.setPublisherViewContainer(mPublisherViewContainer);
  if (mSession != null) {
    mSession.unpublish(mPublisher);
  }
  mPublisher.destroy();
  sharedState.setPublisher(null);
  mCallback.invoke();
}

Fixed version (ground truth):
@Override public void run(){
  Callback mCallback=callback;
  FrameLayout mPublisherViewContainer=sharedState.getPublisherViewContainer();
  Publisher mPublisher=sharedState.getPublisher();
  Session mSession=sharedState.getSession();
  if (mSession != null) {
    mSession.unpublish(mPublisher);
  }
  mPublisher.destroy();
  mPublisherViewContainer.removeAllViews();
  mPublisherViewContainer=null;
  sharedState.setPublisherViewContainer(mPublisherViewContainer);
  sharedState.setPublisher(null);
  mCallback.invoke();
}
Program: 62994
Project: 62994
Buggy source:
@ReactMethod public void destroyPublisher(final Callback callback){
  UiThreadUtil.runOnUiThread(new Runnable(){
    @Override public void run(){
      Callback mCallback=callback;
      FrameLayout mPublisherViewContainer=sharedState.getPublisherViewContainer();
      Publisher mPublisher=sharedState.getPublisher();
      Session mSession=sharedState.getSession();
      mPublisherViewContainer.removeAllViews();
      mPublisherViewContainer=null;
      sharedState.setPublisherViewContainer(mPublisherViewContainer);
      if (mSession != null) {
        mSession.unpublish(mPublisher);
      }
      mPublisher.destroy();
      sharedState.setPublisher(null);
      mCallback.invoke();
    }
  }
);
}

Fixed version (ground truth):
@ReactMethod public void destroyPublisher(final Callback callback){
  UiThreadUtil.runOnUiThread(new Runnable(){
    @Override public void run(){
      Callback mCallback=callback;
      FrameLayout mPublisherViewContainer=sharedState.getPublisherViewContainer();
      Publisher mPublisher=sharedState.getPublisher();
      Session mSession=sharedState.getSession();
      if (mSession != null) {
        mSession.unpublish(mPublisher);
      }
      mPublisher.destroy();
      mPublisherViewContainer.removeAllViews();
      mPublisherViewContainer=null;
      sharedState.setPublisherViewContainer(mPublisherViewContainer);
      sharedState.setPublisher(null);
      mCallback.invoke();
    }
  }
);
}
Program: 62995
Project: 62995
Buggy source:
@Override public void onStreamReceived(Session session,Stream stream){
  if (contains(jsEvents,sessionPreface + "String_Node_Str")) {
    ConcurrentHashMap<String,Stream> mSubscriberStreams=sharedState.getSubscriberStreams();
    mSubscriberStreams.put(stream.getStreamId(),stream);
    WritableMap streamInfo=prepareStreamMap(stream);
    sendEventMap(this.getReactApplicationContext(),sessionPreface + "String_Node_Str",streamInfo);
  }
  Log.i(TAG,"String_Node_Str" + stream.getStreamId() + "String_Node_Str"+ session.getSessionId());
}

Fixed version (ground truth):
@Override public void onStreamReceived(Session session,Stream stream){
  if (contains(jsEvents,sessionPreface + "String_Node_Str") || contains(componentEvents,sessionPreface + "String_Node_Str")) {
    ConcurrentHashMap<String,Stream> mSubscriberStreams=sharedState.getSubscriberStreams();
    mSubscriberStreams.put(stream.getStreamId(),stream);
    WritableMap streamInfo=prepareStreamMap(stream);
    sendEventMap(this.getReactApplicationContext(),sessionPreface + "String_Node_Str",streamInfo);
  }
  Log.i(TAG,"String_Node_Str" + stream.getStreamId() + "String_Node_Str"+ session.getSessionId());
}
Program: 62996
Project: 62996
Buggy source:
@Override public void onStreamDropped(Session session,Stream stream){
  if (contains(jsEvents,sessionPreface + "String_Node_Str")) {
    WritableMap streamInfo=prepareStreamMap(stream);
    sendEventMap(this.getReactApplicationContext(),sessionPreface + "String_Node_Str",streamInfo);
  }
  Log.i(TAG,"String_Node_Str" + stream.getStreamId() + "String_Node_Str"+ session.getSessionId());
}

Fixed version (ground truth):
@Override public void onStreamDropped(Session session,Stream stream){
  if (contains(jsEvents,sessionPreface + "String_Node_Str") || contains(componentEvents,sessionPreface + "String_Node_Str")) {
    WritableMap streamInfo=prepareStreamMap(stream);
    sendEventMap(this.getReactApplicationContext(),sessionPreface + "String_Node_Str",streamInfo);
  }
  Log.i(TAG,"String_Node_Str" + stream.getStreamId() + "String_Node_Str"+ session.getSessionId());
}
Program: 62997
Project: 62997
Buggy source:
@Override public void onDropViewInstance(PDFView pdfView){
  pdfView.onDrop();
}

Fixed version (ground truth):
@Override public void onDropViewInstance(PDFView pdfView){
  pdfView.onDrop();
  this.pdfView=null;
}
Program: 62998
Project: 62998
Buggy source:
@Override public void onAfterUpdateTransaction(ViewPdf viewPdf){
  super.onAfterUpdateTransaction(viewPdf);
  viewPdf.renderPdf();
}

Fixed version (ground truth):
@Override public void onAfterUpdateTransaction(ViewPdf viewPdf){
  super.onAfterUpdateTransaction(viewPdf);
  viewPdf.render();
}
Program: 62999
Project: 62999
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_detail);
  headKanji=(TextView)findViewById(R.id.header_kanji);
  headHiragana=(TextView)findViewById(R.id.header_hiragana);
  meaning=(TextView)findViewById(R.id.detail_meaning);
  meaningMn=(TextView)findViewById(R.id.detail_meaning_mn);
  partOfSpeech=(TextView)findViewById(R.id.detail_part_of);
  level=(TextView)findViewById(R.id.detail_level);
  kanji=(TextView)findViewById(R.id.detail_kanji);
  setDetails();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_detail);
  Intent intent=getIntent();
  wordTable=new WordTable();
  word=wordTable.select(intent.getStringExtra("String_Node_Str"));
  TextView headKanji=(TextView)findViewById(R.id.header_kanji);
  TextView headHiragana=(TextView)findViewById(R.id.header_hiragana);
  TextView meaning=(TextView)findViewById(R.id.detail_meaning);
  TextView meaningMn=(TextView)findViewById(R.id.detail_meaning_mn);
  TextView partOfSpeech=(TextView)findViewById(R.id.detail_part_of);
  TextView level=(TextView)findViewById(R.id.detail_level);
  TextView kanji=(TextView)findViewById(R.id.detail_kanji);
  ImageButton backBtn=findViewById(R.id.back);
  favBtn=findViewById(R.id.btnFav);
  headKanji.setText(word.getKanji());
  headHiragana.setText(word.getCharacter());
  meaning.setText(word.getMeaning());
  meaningMn.setText(word.getMeaningMon());
  partOfSpeech.setText(word.getPartOfSpeech());
  level.setText(word.getLevel());
  kanji.setText(word.getKanji());
  Logger.e(word.toString());
  if (word.getIsFavorite().equals("String_Node_Str"))   favBtn.setImageResource(R.drawable.ic_favorite_full);
  backBtn.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      finish();
    }
  }
);
  favBtn.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (word.getIsFavorite().equals("String_Node_Str")) {
        word.setIsFavorite("String_Node_Str");
        wordTable.update(word);
        favBtn.setImageResource(R.drawable.ic_favorite_full);
      }
 else {
        word.setIsFavorite("String_Node_Str");
        wordTable.update(word);
        favBtn.setImageResource(R.drawable.ic_favorite);
      }
    }
  }
);
}
Program: 63000
Project: 63000
Buggy source:
public WordListAdapter(Context context,List<Words> words){
  this.context=context;
  this.words=words;
  kanaSpeech=new TextToSpeech(AppMain.getContext(),new TextToSpeech.OnInitListener(){
    @Override public void onInit(    int status){
      if (status != TextToSpeech.ERROR) {
        kanaSpeech.setLanguage(Locale.JAPAN);
      }
    }
  }
);
}

Fixed version (ground truth):
public WordListAdapter(Context context,List<Words> words){
  this.context=context;
  this.words=words;
}
Program: 63001
Project: 63001
Buggy source:
public Words select(String id){
  SQLiteDatabase db=DatabaseManager.getInstance().openDatabase();
  if (db == null) {
    return null;
  }
  Cursor cursor=db.query(Words.TABLE_WORDS,new String[]{Words.WORDS_ID,Words.WORDS_CHARACTER,Words.WORDS_MEANING,Words.WORDS_MEANING_MN,Words.WORDS_KANJI,Words.WORDS_PART_OF_SPEECH,Words.WORDS_LEVEL,Words.WORDS_IS_MEMORIZE,Words.WORDS_IS_FAVORITE,Words.WORDS_CREATED},Words.WORDS_ID + "String_Node_Str",new String[]{String.valueOf(id)},null,null,null,null);
  if (!cursor.moveToFirst()) {
    return null;
  }
  Words word=new Words();
  word.setId(cursor.getString(Words.WORDS_ID_INDEX));
  word.setCharacter(cursor.getString(Words.WORDS_CHARACTER_INDEX));
  word.setMeaning(cursor.getString(Words.WORDS_MEANING_INDEX));
  word.setMeaningMon(cursor.getString(Words.WORDS_MEANING_MN_INDEX));
  word.setKanji(cursor.getString(Words.WORDS_KANJI_INDEX));
  word.setPartOfSpeech(cursor.getString(Words.WORDS_PART_OF_SPEECH_INDEX));
  word.setLevel(cursor.getString(Words.WORDS_LEVEL_INDEX));
  word.setIsMemorize(cursor.getString(Words.WORDS_IS_MEMORIZE_INDEX));
  cursor.close();
  DatabaseManager.getInstance().closeDatabase();
  return word;
}

Fixed version (ground truth):
public Words select(String id){
  SQLiteDatabase db=DatabaseManager.getInstance().openDatabase();
  if (db == null) {
    return null;
  }
  Cursor cursor=db.query(Words.TABLE_WORDS,new String[]{Words.WORDS_ID,Words.WORDS_CHARACTER,Words.WORDS_MEANING,Words.WORDS_MEANING_MN,Words.WORDS_KANJI,Words.WORDS_PART_OF_SPEECH,Words.WORDS_LEVEL,Words.WORDS_IS_MEMORIZE,Words.WORDS_IS_FAVORITE,Words.WORDS_CREATED},Words.WORDS_ID + "String_Node_Str",new String[]{String.valueOf(id)},null,null,null,null);
  if (!cursor.moveToFirst()) {
    return null;
  }
  Words word=new Words();
  word.setId(cursor.getString(Words.WORDS_ID_INDEX));
  word.setCharacter(cursor.getString(Words.WORDS_CHARACTER_INDEX));
  word.setMeaning(cursor.getString(Words.WORDS_MEANING_INDEX));
  word.setMeaningMon(cursor.getString(Words.WORDS_MEANING_MN_INDEX));
  word.setKanji(cursor.getString(Words.WORDS_KANJI_INDEX));
  word.setPartOfSpeech(cursor.getString(Words.WORDS_PART_OF_SPEECH_INDEX));
  word.setLevel(cursor.getString(Words.WORDS_LEVEL_INDEX));
  word.setIsMemorize(cursor.getString(Words.WORDS_IS_MEMORIZE_INDEX));
  word.setIsFavorite(cursor.getString(Words.WORDS_IS_FAVORITE_INDEX));
  word.setCreated(cursor.getString(Words.WORDS_CREATED_INDEX));
  cursor.close();
  DatabaseManager.getInstance().closeDatabase();
  return word;
}
Program: 63002
Project: 63002
Buggy source:
@Override public List<KBHandle> listRootConcepts(KnowledgeBase kb,boolean aAll) throws QueryEvaluationException {
  List<KBHandle> resultList=new ArrayList<>();
  if (!kb.getExplicitlyDefinedRootConcepts().isEmpty()) {
    for (    IRI conceptIRI : kb.getExplicitlyDefinedRootConcepts()) {
      KBConcept concept=readConcept(kb,conceptIRI.stringValue()).get();
      KBHandle conceptHandle=new KBHandle(concept.getIdentifier(),concept.getName(),concept.getDescription());
      resultList.add(conceptHandle);
    }
  }
 else {
    resultList=read(kb,(conn) -> {
      String QUERY=String.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      TupleQuery tupleQuery=conn.prepareTupleQuery(QueryLanguage.SPARQL,QUERY);
      tupleQuery.setBinding("String_Node_Str",kb.getTypeIri());
      tupleQuery.setBinding("String_Node_Str",kb.getClassIri());
      tupleQuery.setBinding("String_Node_Str",kb.getSubclassIri());
      tupleQuery.setBinding("String_Node_Str",kb.getLabelIri());
      tupleQuery.setIncludeInferred(false);
      return evaluateListQuery(tupleQuery,aAll);
    }
);
  }
  resultList.sort(Comparator.comparing(KBObject::getUiLabel));
  return resultList;
}

Fixed version (ground truth):
@Override public List<KBHandle> listRootConcepts(KnowledgeBase kb,boolean aAll) throws QueryEvaluationException {
  List<KBHandle> resultList=new ArrayList<>();
  if (!kb.getExplicitlyDefinedRootConcepts().isEmpty()) {
    for (    IRI conceptIRI : kb.getExplicitlyDefinedRootConcepts()) {
      KBConcept concept=readConcept(kb,conceptIRI.stringValue()).get();
      KBHandle conceptHandle=new KBHandle(concept.getIdentifier(),concept.getName(),concept.getDescription());
      resultList.add(conceptHandle);
    }
  }
 else {
    resultList=read(kb,(conn) -> {
      String QUERY=String.join("String_Node_Str",SPARQLQueryStore.SPARQL_PREFIX,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      TupleQuery tupleQuery=conn.prepareTupleQuery(QueryLanguage.SPARQL,QUERY);
      tupleQuery.setBinding("String_Node_Str",kb.getTypeIri());
      tupleQuery.setBinding("String_Node_Str",kb.getClassIri());
      tupleQuery.setBinding("String_Node_Str",kb.getSubclassIri());
      tupleQuery.setBinding("String_Node_Str",kb.getLabelIri());
      tupleQuery.setIncludeInferred(false);
      return evaluateListQuery(tupleQuery,aAll);
    }
);
  }
  resultList.sort(Comparator.comparing(KBObject::getUiLabel));
  return resultList;
}
Program: 63003
Project: 63003
Buggy source:
@Override public List<KBHandle> listChildConcepts(KnowledgeBase aKB,String aParentIdentifier,boolean aAll,int aLimit) throws QueryEvaluationException {
  List<KBHandle> resultList=read(aKB,(conn) -> {
    String QUERY=String.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + aLimit);
    ValueFactory vf=SimpleValueFactory.getInstance();
    TupleQuery tupleQuery=conn.prepareTupleQuery(QueryLanguage.SPARQL,QUERY);
    tupleQuery.setBinding("String_Node_Str",vf.createIRI(aParentIdentifier));
    tupleQuery.setBinding("String_Node_Str",aKB.getTypeIri());
    tupleQuery.setBinding("String_Node_Str",aKB.getClassIri());
    tupleQuery.setBinding("String_Node_Str",aKB.getSubclassIri());
    tupleQuery.setBinding("String_Node_Str",aKB.getLabelIri());
    tupleQuery.setIncludeInferred(false);
    return evaluateListQuery(tupleQuery,aAll);
  }
);
  if (resultList.size() > 1) {
    resultList.sort(Comparator.comparing(KBObject::getUiLabel));
  }
  return resultList;
}

Fixed version (ground truth):
@Override public List<KBHandle> listChildConcepts(KnowledgeBase aKB,String aParentIdentifier,boolean aAll,int aLimit) throws QueryEvaluationException {
  List<KBHandle> resultList=read(aKB,(conn) -> {
    String QUERY=String.join("String_Node_Str",SPARQLQueryStore.SPARQL_PREFIX,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + aLimit);
    ValueFactory vf=SimpleValueFactory.getInstance();
    TupleQuery tupleQuery=conn.prepareTupleQuery(QueryLanguage.SPARQL,QUERY);
    tupleQuery.setBinding("String_Node_Str",vf.createIRI(aParentIdentifier));
    tupleQuery.setBinding("String_Node_Str",aKB.getTypeIri());
    tupleQuery.setBinding("String_Node_Str",aKB.getClassIri());
    tupleQuery.setBinding("String_Node_Str",aKB.getSubclassIri());
    tupleQuery.setBinding("String_Node_Str",aKB.getLabelIri());
    tupleQuery.setIncludeInferred(false);
    return evaluateListQuery(tupleQuery,aAll);
  }
);
  if (resultList.size() > 1) {
    resultList.sort(Comparator.comparing(KBObject::getUiLabel));
  }
  return resultList;
}
Program: 63004
Project: 63004
Buggy source:
public MtasDocumentIndex(Project aProject,AnnotationSchemaService aAnnotationSchemaService,DocumentService aDocumentService,ProjectService aProjectService,String aDir) throws IOException {
  annotationSchemaService=aAnnotationSchemaService;
  documentService=aDocumentService;
  projectService=aProjectService;
  project=aProject;
  List<AnnotationLayer> layers=annotationSchemaService.listAnnotationLayer(project);
  annotationShortNames=new ArrayList<String>();
  for (  AnnotationLayer layer : layers) {
    if (layer.isEnabled()) {
      annotationShortNames.add(getShortName(layer.getName()));
    }
  }
  resourceDir=new File(aDir);
  log.info("String_Node_Str");
}

Fixed version (ground truth):
public MtasDocumentIndex(Project aProject,AnnotationSchemaService aAnnotationSchemaService,DocumentService aDocumentService,ProjectService aProjectService,String aDir) throws IOException {
  annotationSchemaService=aAnnotationSchemaService;
  documentService=aDocumentService;
  projectService=aProjectService;
  project=aProject;
  List<AnnotationLayer> layers=annotationSchemaService.listAnnotationLayer(project);
  annotationShortNames=new ArrayList<String>();
  for (  AnnotationLayer layer : layers) {
    if (layer.isEnabled()) {
      annotationShortNames.add(getShortName(layer.getName()));
    }
  }
  resourceDir=new File(aDir);
  createPhysicalIndex();
  log.info("String_Node_Str");
}
Program: 63005
Project: 63005
Buggy source:
@OnEvent public void actionInstanceSelection(AjaxInstanceSelectionEvent event){
  selectedInstanceHandle.setObject(event.getSelection());
  Component replacementPanel;
  Component replacementSearch;
  if (selectedInstanceHandle.getObject() != null) {
    String identifier=selectedInstanceHandle.getObject().getIdentifier();
    try {
      replacementPanel=kbService.readInstance(kbModel.getObject(),identifier).<Component>map(instance -> {
        Model<KBInstance> model=Model.of(instance);
        return new InstanceInfoPanel(INSTANCE_INFO_MARKUP_ID,kbModel,selectedInstanceHandle,model);
      }
).orElse(emptyPanel());
      replacementSearch=new AnnotatedListIdentifiers("String_Node_Str",kbModel,selectedConceptHandle,selectedInstanceHandle);
    }
 catch (    QueryEvaluationException e) {
      replacementPanel=emptyPanel();
      replacementSearch=emptyPanel();
      error("String_Node_Str" + e.getLocalizedMessage());
      LOG.error("String_Node_Str",e);
      event.getTarget().addChildren(getPage(),IFeedback.class);
    }
  }
 else {
    replacementPanel=emptyPanel();
    replacementSearch=emptyPanel();
  }
  annotatedSearchPanel=annotatedSearchPanel.replaceWith(replacementSearch);
  instanceInfoPanel=instanceInfoPanel.replaceWith(replacementPanel);
  event.getTarget().add(this);
}

Fixed version (ground truth):
@OnEvent public void actionInstanceSelection(AjaxInstanceSelectionEvent event){
  selectedInstanceHandle.setObject(event.getSelection());
  Component replacementPanel;
  Component replacementSearch;
  if (selectedInstanceHandle.getObject() != null) {
    String identifier=selectedInstanceHandle.getObject().getIdentifier();
    try {
      replacementPanel=kbService.readInstance(kbModel.getObject(),identifier).<Component>map(instance -> {
        Model<KBInstance> model=Model.of(instance);
        return new InstanceInfoPanel(INSTANCE_INFO_MARKUP_ID,kbModel,selectedInstanceHandle,model);
      }
).orElse(emptyPanel());
      replacementSearch=new AnnotatedListIdentifiers("String_Node_Str",kbModel,selectedConceptHandle,selectedInstanceHandle);
    }
 catch (    QueryEvaluationException e) {
      replacementPanel=emptyPanel();
      replacementSearch=emptyPanel();
      error("String_Node_Str" + e.getLocalizedMessage());
      LOG.error("String_Node_Str",e);
      event.getTarget().addChildren(getPage(),IFeedback.class);
    }
  }
 else {
    replacementPanel=emptyPanel();
    replacementSearch=new AnnotatedListIdentifiers("String_Node_Str",kbModel,selectedConceptHandle,selectedInstanceHandle);
  }
  annotatedSearchPanel=annotatedSearchPanel.replaceWith(replacementSearch);
  instanceInfoPanel=instanceInfoPanel.replaceWith(replacementPanel);
  event.getTarget().add(this);
}
Program: 63006
Project: 63006
Buggy source:
public AnnotatedListIdentifiers(String aId,IModel<KnowledgeBase> aKbModel,IModel<KBHandle> aConcept,IModel<KBHandle> aInstance){
  super(aId,aConcept);
  setOutputMarkupId(true);
  kbModel=aKbModel;
  conceptModel=aConcept;
  currentUser=userRepository.getCurrentUser();
  String queryHead="String_Node_Str";
  String queryEnd="String_Node_Str";
  StringBuffer query=new StringBuffer();
  if (aInstance.getObject() == null) {
    String concept=aConcept.getObject().getUiLabel();
    targetQuery=Model.of(query.append(queryHead).append(concept).append(queryEnd).toString());
  }
 else {
    String instance=aInstance.getObject().getUiLabel();
    targetQuery=Model.of(query.append(queryHead).append(instance).append(queryEnd).toString());
  }
  LambdaModel<List<SearchResult>> searchResults=LambdaModel.of(this::getSearchResults);
  LOG.debug("String_Node_Str",searchResults.getObject().size());
  OverviewListChoice<String> overviewList=new OverviewListChoice<String>("String_Node_Str"){
    private static final long serialVersionUID=-122960232588575731L;
    @Override protected void onConfigure(){
      super.onConfigure();
      setVisible(!searchResults.getObject().isEmpty());
    }
  }
;
  overviewList.setChoices(getSearchResultsFormatted(searchResults));
  add(overviewList);
  add(new Label("String_Node_Str",LambdaModel.of(() -> overviewList.getChoices().size())));
}

Fixed version (ground truth):
public AnnotatedListIdentifiers(String aId,IModel<KnowledgeBase> aKbModel,IModel<KBHandle> aConcept,IModel<KBHandle> aInstance){
  super(aId,aConcept);
  setOutputMarkupId(true);
  kbModel=aKbModel;
  conceptModel=aConcept;
  currentUser=userRepository.getCurrentUser();
  String queryHead="String_Node_Str";
  String queryEnd="String_Node_Str";
  StringBuffer query=new StringBuffer();
  if (aInstance.getObject() == null) {
    String concept=aConcept.getObject().getUiLabel();
    targetQuery=Model.of(query.append(queryHead).append(concept).append(queryEnd).toString());
  }
 else {
    String instance=aInstance.getObject().getUiLabel();
    targetQuery=Model.of(query.append(queryHead).append(instance).append(queryEnd).toString());
  }
  LambdaModel<List<SearchResult>> searchResults=LambdaModel.of(this::getSearchResults);
  LOG.trace("String_Node_Str",searchResults.getObject().size());
  OverviewListChoice<String> overviewList=new OverviewListChoice<String>("String_Node_Str"){
    private static final long serialVersionUID=-122960232588575731L;
    @Override protected void onConfigure(){
      super.onConfigure();
      setVisible(!searchResults.getObject().isEmpty());
    }
  }
;
  overviewList.setChoices(getSearchResultsFormatted(searchResults));
  add(overviewList);
  add(new Label("String_Node_Str",LambdaModel.of(() -> overviewList.getChoices().size())));
}
Program: 63007
Project: 63007
Buggy source:
@OnEvent public void actionInstanceSelection(AjaxInstanceSelectionEvent event){
  selectedInstanceHandle.setObject(event.getSelection());
  Component replacementPanel;
  Component replacementSearch;
  if (selectedInstanceHandle.getObject() != null) {
    String identifier=selectedInstanceHandle.getObject().getIdentifier();
    try {
      replacementPanel=kbService.readInstance(kbModel.getObject(),identifier).<Component>map(instance -> {
        Model<KBInstance> model=Model.of(instance);
        return new InstanceInfoPanel(INSTANCE_INFO_MARKUP_ID,kbModel,selectedInstanceHandle,model);
      }
).orElse(emptyPanel());
      replacementSearch=new AnnotatedListIdentifiers("String_Node_Str",kbModel,selectedConceptHandle,selectedInstanceHandle);
    }
 catch (    QueryEvaluationException e) {
      replacementPanel=emptyPanel();
      replacementSearch=emptyPanel();
      error("String_Node_Str" + e.getLocalizedMessage());
      LOG.error("String_Node_Str",e);
      event.getTarget().addChildren(getPage(),IFeedback.class);
    }
  }
 else {
    replacementPanel=emptyPanel();
    replacementSearch=emptyPanel();
  }
  annotatedSearchPanel=annotatedSearchPanel.replaceWith(replacementSearch);
  instanceInfoPanel=instanceInfoPanel.replaceWith(replacementPanel);
  event.getTarget().add(this);
}

Fixed version (ground truth):
@OnEvent public void actionInstanceSelection(AjaxInstanceSelectionEvent event){
  selectedInstanceHandle.setObject(event.getSelection());
  Component replacementPanel;
  Component replacementSearch;
  if (selectedInstanceHandle.getObject() != null) {
    String identifier=selectedInstanceHandle.getObject().getIdentifier();
    try {
      replacementPanel=kbService.readInstance(kbModel.getObject(),identifier).<Component>map(instance -> {
        Model<KBInstance> model=Model.of(instance);
        return new InstanceInfoPanel(INSTANCE_INFO_MARKUP_ID,kbModel,selectedInstanceHandle,model);
      }
).orElse(emptyPanel());
      replacementSearch=new AnnotatedListIdentifiers("String_Node_Str",kbModel,selectedConceptHandle,selectedInstanceHandle);
    }
 catch (    QueryEvaluationException e) {
      replacementPanel=emptyPanel();
      replacementSearch=emptyPanel();
      error("String_Node_Str" + e.getLocalizedMessage());
      LOG.error("String_Node_Str",e);
      event.getTarget().addChildren(getPage(),IFeedback.class);
    }
  }
 else {
    replacementPanel=emptyPanel();
    replacementSearch=new AnnotatedListIdentifiers("String_Node_Str",kbModel,selectedConceptHandle,selectedInstanceHandle);
  }
  annotatedSearchPanel=annotatedSearchPanel.replaceWith(replacementSearch);
  instanceInfoPanel=instanceInfoPanel.replaceWith(replacementPanel);
  event.getTarget().add(this);
}
Program: 63008
Project: 63008
Buggy source:
/** 
 * Inserts a new statement. If the statement has an original statement, that one is deleted before inserting the new one. If the statement is an inferred statement, then no deletion attempt will be made, but the statement will be added as a new explicit statement. Does nothing if the knowledge base is read only.
 */
void upsertStatement(KnowledgeBase kb,KBStatement aStatement) throws RepositoryException ;

Fixed version (ground truth):
/** 
 * Inserts a new statement. If the statement has an original statement, that one is deleted before inserting the new one. If the statement is an inferred statement, then no deletion attempt will be made, but the statement will be added as a new explicit statement. Does nothing if the knowledge base is read only.
 * @param kb The knowledge base the statement will be use in
 * @param aStatement The statement itself
 */
void upsertStatement(KnowledgeBase kb,KBStatement aStatement) throws RepositoryException ;
Program: 63009
Project: 63009
Buggy source:
/** 
 * Writes the contents of a knowledge base of type   {@link RepositoryType#LOCAL} to a given{@link OutputStream} in a specificable format.<br>No action will be taken if the given knowledge base is not of type {@link RepositoryType#LOCAL} (nothing will be written to the output stream).
 * @param kb
 * @param format
 * @param os
 */
void exportData(KnowledgeBase kb,RDFFormat format,OutputStream os);

Fixed version (ground truth):
/** 
 * Writes the contents of a knowledge base of type   {@link RepositoryType#LOCAL} to a given{@link OutputStream} in a specificable format.<br>No action will be taken if the given knowledge base is not of type {@link RepositoryType#LOCAL} (nothing will be written to the output stream).
 * @param kb The knowledge base to export
 * @param format Format of the data
 * @param os The {@link OutputStream} variable
 */
void exportData(KnowledgeBase kb,RDFFormat format,OutputStream os);
Program: 63010
Project: 63010
Buggy source:
/** 
 * Creates a new instance in the given knowledge base. Does nothing if the knowledge base is read only.
 * @param kb The knowledge base to which the new instance will be added
 * @param aInstance The instance to add
 */
KBHandle createInstance(KnowledgeBase kb,KBInstance aInstance);

Fixed version (ground truth):
/** 
 * Creates a new instance in the given knowledge base. Does nothing if the knowledge base is read only.
 * @param kb The knowledge base to which the new instance will be added
 * @param aInstance The instance to add
 * @return the instance {@link KBHandle}
 */
KBHandle createInstance(KnowledgeBase kb,KBInstance aInstance);
Program: 63011
Project: 63011
Buggy source:
List<KBHandle> listProperties(KnowledgeBase kb,boolean aIncludeInferred,boolean aAll);

Fixed version (ground truth):
List<KBHandle> listProperties(KnowledgeBase kb,IRI aType,boolean aIncludeInferred,boolean aAll);
Program: 63012
Project: 63012
Buggy source:
/** 
 * Creates a new property in the given knowledge base. Does nothing if the knowledge base is read only.
 * @param kb The knowledge base to which the new property will be added
 * @param aProperty The property to add
 */
KBHandle createProperty(KnowledgeBase kb,KBProperty aProperty);

Fixed version (ground truth):
/** 
 * Creates a new property in the given knowledge base. Does nothing if the knowledge base is read only.
 * @param kb The knowledge base to which the new property will be added
 * @param aProperty The property to add
 * @return the KBHandle for the created concept 
 */
KBHandle createProperty(KnowledgeBase kb,KBProperty aProperty);
Program: 63013
Project: 63013
Buggy source:
/** 
 * Delete the given instance. Also deletes all statements about that instance (i.e. where the instance is the subject), but not statements pointing to the instance (i.e. where the instance is the object). Does nothing if the knowledge base is read only.
 */
void deleteInstance(KnowledgeBase kb,KBInstance aInstance);

Fixed version (ground truth):
/** 
 * Delete the given instance. Also deletes all statements about that instance (i.e. where the instance is the subject), but not statements pointing to the instance (i.e. where the instance is the object). Does nothing if the knowledge base is read only.
 * @param kb The knowledge base to which the instance will be deleted
 * @param aInstance The instance to delete
 */
void deleteInstance(KnowledgeBase kb,KBInstance aInstance);
Program: 63014
Project: 63014
Buggy source:
/** 
 * Creates a new concept in the given knowledge base. Does nothing  if the knowledge base is read only.
 * @param kb The knowledge base to which the new concept will be added
 * @param aType The concept to add
 */
KBHandle createConcept(KnowledgeBase kb,KBConcept aType);

Fixed version (ground truth):
/** 
 * Creates a new concept in the given knowledge base. Does nothing  if the knowledge base is read only.
 * @param kb The knowledge base to which the new concept will be added
 * @param aType The concept to add
 * @return the KBHandle for the created concept 
 */
KBHandle createConcept(KnowledgeBase kb,KBConcept aType);
Program: 63015
Project: 63015
Buggy source:
/** 
 * {@code False} if a knowledge base does not contain any statements.
 * @param kb a {@link KnowledgeBase}
 */
boolean isEmpty(KnowledgeBase kb);

Fixed version (ground truth):
/** 
 * {@code False} if a knowledge base does not contain any statements.
 * @param kb a {@link KnowledgeBase}
 * @return a {@link Boolean} value
 */
boolean isEmpty(KnowledgeBase kb);
Program: 63016
Project: 63016
Buggy source:
/** 
 * Update the configuration of a knowledge base. The given knowledge base must have been added before.
 */
void updateKnowledgeBase(KnowledgeBase kb,RepositoryImplConfig cfg) throws RepositoryException, RepositoryConfigException ;

Fixed version (ground truth):
/** 
 * Update the configuration of a knowledge base. The given knowledge base must have been added before.
 * @param kb the {@link KnowledgeBase} to update
 * @param cfg the {@link RepositoryImplConfig} variable
 */
void updateKnowledgeBase(KnowledgeBase kb,RepositoryImplConfig cfg) throws RepositoryException, RepositoryConfigException ;
Program: 63017
Project: 63017
Buggy source:
@Override public List<KBHandle> listProperties(KnowledgeBase kb,boolean aIncludeInferred,boolean aAll) throws QueryEvaluationException {
  List<KBHandle> resultList=read(kb,(conn) -> {
    String QUERY=getPropertyListQuery(kb);
    TupleQuery tupleQuery=conn.prepareTupleQuery(QueryLanguage.SPARQL,QUERY);
    tupleQuery.setBinding("String_Node_Str",kb.getTypeIri());
    tupleQuery.setBinding("String_Node_Str",kb.getPropertyTypeIri());
    tupleQuery.setBinding("String_Node_Str",kb.getLabelIri());
    tupleQuery.setIncludeInferred(aIncludeInferred);
    return evaluateListQuery(tupleQuery,aAll);
  }
);
  resultList.sort(Comparator.comparing(KBObject::getUiLabel));
  return resultList;
}

Fixed version (ground truth):
@Override public List<KBHandle> listProperties(KnowledgeBase kb,IRI aType,boolean aIncludeInferred,boolean aAll) throws QueryEvaluationException {
  List<KBHandle> resultList=read(kb,(conn) -> {
    String QUERY=getPropertyListQuery(kb);
    TupleQuery tupleQuery=conn.prepareTupleQuery(QueryLanguage.SPARQL,QUERY);
    tupleQuery.setBinding("String_Node_Str",kb.getTypeIri());
    tupleQuery.setBinding("String_Node_Str",aType);
    tupleQuery.setBinding("String_Node_Str",kb.getLabelIri());
    tupleQuery.setIncludeInferred(aIncludeInferred);
    return evaluateListQuery(tupleQuery,aAll);
  }
);
  resultList.sort(Comparator.comparing(KBObject::getUiLabel));
  return resultList;
}
Program: 63018
Project: 63018
Buggy source:
@Override public void deleteConcept(KnowledgeBase kb,KBConcept aConcept){
  delete(kb,aConcept.getIdentifier());
}

Fixed version (ground truth):
@Override public void deleteConcept(KnowledgeBase kb,KBConcept aConcept){
  getReificationStrategy(kb).deleteConcept(kb,aConcept);
}
Program: 63019
Project: 63019
Buggy source:
@Override public void deleteProperty(KnowledgeBase kb,KBProperty aType){
  delete(kb,aType.getIdentifier());
}

Fixed version (ground truth):
@Override public void deleteProperty(KnowledgeBase kb,KBProperty aType){
  getReificationStrategy(kb).deleteProperty(kb,aType);
}
Program: 63020
Project: 63020
Buggy source:
@Override public void deleteInstance(KnowledgeBase kb,KBInstance aInstance){
  delete(kb,aInstance.getIdentifier());
}

Fixed version (ground truth):
@Override public void deleteInstance(KnowledgeBase kb,KBInstance aInstance){
  getReificationStrategy(kb).deleteInstance(kb,aInstance);
}
Program: 63021
Project: 63021
Buggy source:
/** 
 * Whether a class can have instances or not. E.g. classes that just serve as headings in a hierarchical resource should not have instances.
 */
public String getDescription(){
  return description;
}

Fixed version (ground truth):
/** 
 * @return Gives description for the concept
 */
public String getDescription(){
  return description;
}
Program: 63022
Project: 63022
Buggy source:
/** 
 * Sets the label of this element.
 */
void setName(String label);

Fixed version (ground truth):
/** 
 * Sets the label of this element.
 * @param label the label of this element
 */
void setName(String label);
Program: 63023
Project: 63023
Buggy source:
/** 
 * Returns the label of this element.
 */
String getName();

Fixed version (ground truth):
/** 
 * @return the label of this element.
 */
String getName();
Program: 63025
Project: 63025
Buggy source:
private static <A extends Annotation>List<AnnotationObject> getTokenAnnotationsFromFS(List<AnnotationFS> annotations,List<TokenObject> sentence,String documentURI,String documentName,Feature feature,long aRecommenderId){
  List<AnnotationObject> result=new ArrayList<>();
  int id=0;
  for (  AnnotationFS a : annotations) {
    String annotationLabel=a.getFeatureValueAsString(feature);
    List<Token> tokens=selectCovered(Token.class,a);
    if (tokens == null || tokens.isEmpty()) {
      continue;
    }
    for (int i=0; i < tokens.size(); i++) {
      Token token=tokens.get(i);
      Offset offset=getTokenOffset(token,sentence);
      TokenObject tObj=new TokenObject(offset,token.getCoveredText(),documentURI,documentName,id);
      AnnotationObject ao=new AnnotationObject(tObj,id,feature.getName(),aRecommenderId);
      ao.setLabel(annotationLabel);
      id++;
    }
  }
  Collections.sort(result,(ao1,ao2) -> ao1.getOffset().compareTo(ao2.getOffset()));
  return result;
}

Fixed version (ground truth):
private static <A extends Annotation>List<AnnotationObject> getTokenAnnotationsFromFS(List<AnnotationFS> annotations,List<TokenObject> sentence,String documentURI,String documentName,Feature feature,long aRecommenderId){
  List<AnnotationObject> result=new ArrayList<>();
  int id=0;
  for (  AnnotationFS a : annotations) {
    String annotationLabel=a.getFeatureValueAsString(feature);
    List<Token> tokens=selectCovered(Token.class,a);
    if (tokens == null || tokens.isEmpty()) {
      continue;
    }
    for (int i=0; i < tokens.size(); i++) {
      Token token=tokens.get(i);
      Offset offset=getTokenOffset(token,sentence);
      TokenObject tObj=new TokenObject(offset,token.getCoveredText(),documentURI,documentName,id);
      AnnotationObject ao=new AnnotationObject(tObj,id,feature.getName(),aRecommenderId);
      ao.setLabel(annotationLabel);
      result.add(ao);
      id++;
    }
  }
  Collections.sort(result,(ao1,ao2) -> ao1.getOffset().compareTo(ao2.getOffset()));
  return result;
}