nus-yam/ex-repair huggingface dataset:
Program: 86117
Project: 86117
Buggy source:
public WorkflowResponse getWorkflowModels(String workspaceId,int startOffset,int chunkSize) throws ApplicationException {
  WorkflowModelDTO response[]=getWorkflowModels(workspaceId);
  if (startOffset < response.length) {
    WorkflowModelDTO chunk[];
    if (startOffset + chunkSize <= response.length) {
      chunk=new WorkflowModelDTO[chunkSize];
      int j=0;
      for (int i=startOffset; i < startOffset + chunkSize; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
 else {
      chunk=new WorkflowModelDTO[response.length - startOffset];
      int j=0;
      for (int i=startOffset; i < response.length; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
    WorkflowResponse result=new WorkflowResponse();
    result.setChunckOffset(startOffset);
    result.setTotalSize(response.length);
    result.setData(chunk);
    return result;
  }
  return null;
}

Fixed version (ground truth):
public WorkflowResponse getWorkflowModels(String workspaceId,int startOffset,int chunkSize) throws ApplicationException {
  WorkflowModelDTO response[]=getWorkflowModels(workspaceId);
  if (startOffset < response.length) {
    WorkflowModelDTO chunk[];
    if (startOffset + chunkSize <= response.length) {
      chunk=new WorkflowModelDTO[chunkSize];
      int j=0;
      for (int i=startOffset; i < startOffset + chunkSize; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
 else {
      chunk=new WorkflowModelDTO[response.length - startOffset];
      int j=0;
      for (int i=startOffset; i < response.length; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
    WorkflowResponse result=new WorkflowResponse();
    result.setChunckOffset(startOffset);
    result.setTotalSize(response.length);
    result.setData(chunk);
    return result;
  }
  WorkflowResponse defaultResponse=new WorkflowResponse();
  defaultResponse.setChunckOffset(0);
  defaultResponse.setTotalSize(0);
  WorkflowModelDTO defaultChunk[]=new WorkflowModelDTO[0];
  defaultResponse.setData(defaultChunk);
  return defaultResponse;
}
Program: 86118
Project: 86118
Buggy source:
private MDocResponse generateMDocResponse(MasterDocumentDTO response[],int startOffset,int chunkSize){
  if (startOffset < response.length) {
    MasterDocumentDTO chunk[];
    if (startOffset + chunkSize <= response.length) {
      chunk=new MasterDocumentDTO[chunkSize];
      int j=0;
      for (int i=startOffset; i < startOffset + chunkSize; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
 else {
      chunk=new MasterDocumentDTO[response.length - startOffset];
      int j=0;
      for (int i=startOffset; i < response.length; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
    MDocResponse result=new MDocResponse();
    result.setChunckOffset(startOffset);
    result.setTotalSize(response.length);
    result.setData(chunk);
    return result;
  }
  return null;
}

Fixed version (ground truth):
private MDocResponse generateMDocResponse(MasterDocumentDTO response[],int startOffset,int chunkSize){
  if (startOffset < response.length) {
    MasterDocumentDTO chunk[];
    if (startOffset + chunkSize <= response.length) {
      chunk=new MasterDocumentDTO[chunkSize];
      int j=0;
      for (int i=startOffset; i < startOffset + chunkSize; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
 else {
      chunk=new MasterDocumentDTO[response.length - startOffset];
      int j=0;
      for (int i=startOffset; i < response.length; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
    MDocResponse result=new MDocResponse();
    result.setChunckOffset(startOffset);
    result.setTotalSize(response.length);
    result.setData(chunk);
    return result;
  }
  MDocResponse defaultResponse=new MDocResponse();
  defaultResponse.setChunckOffset(0);
  defaultResponse.setTotalSize(0);
  MasterDocumentDTO defaultChunk[]=new MasterDocumentDTO[0];
  defaultResponse.setData(defaultChunk);
  return defaultResponse;
}
Program: 86119
Project: 86119
Buggy source:
public void addExtension(Widget w){
  if (!selectionTop) {
    mainPanel.setWidget(0,1,w);
  }
 else {
    mainPanel.setWidget(1,1,w);
  }
}

Fixed version (ground truth):
public void addExtension(Widget w){
  if (!selectionTop) {
    mainPanel.setWidget(0,1,w);
    mainPanel.getCellFormatter().setHorizontalAlignment(0,1,HasHorizontalAlignment.ALIGN_RIGHT);
  }
 else {
    mainPanel.setWidget(1,1,w);
    mainPanel.getCellFormatter().setHorizontalAlignment(1,1,HasHorizontalAlignment.ALIGN_RIGHT);
  }
}
Program: 86121
Project: 86121
Buggy source:
@Override public void requestSuggestions(final Request request,final Callback callback){
  AsyncCallback<MasterDocumentDTO[]> callbackService=new AsyncCallback<MasterDocumentDTO[]>(){
    public void onFailure(    Throwable caught){
      HTMLUtil.showError(caught.getMessage());
    }
    public void onSuccess(    MasterDocumentDTO[] result){
      SortedSet<MasterDocumentDTO> sorted=new TreeSet<MasterDocumentDTO>();
      for (      MasterDocumentDTO mdoc : result) {
        sorted.add(mdoc);
      }
      List<DocOracleSuggestion> responseList=new LinkedList<DocOracleSuggestion>();
      for (      MasterDocumentDTO mdoc : sorted) {
        DocOracleSuggestion suggestion=new DocOracleSuggestionImpl(mdoc);
        responseList.add(suggestion);
      }
      callback.onSuggestionsReady(request,new Response(responseList));
    }
  }
;
  if (request.getQuery().length() >= triggerSize) {
    String realQuery=request.getQuery();
    if (realQuery.endsWith("String_Node_Str")) {
      realQuery=realQuery.substring(0,realQuery.length() - 1);
    }
    ServiceLocator.getInstance().getExplorerService().searchMDocs(workspaceId,realQuery,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new Date(DEFAULT_FROM_DATE),new Date(),null,null,"String_Node_Str",callbackService);
  }
 else {
    List<DocOracleSuggestion> responses=new LinkedList<DocOracleSuggestion>();
    callback.onSuggestionsReady(request,new Response(responses));
  }
}

Fixed version (ground truth):
@Override public void requestSuggestions(final Request request,final Callback callback){
  AsyncCallback<MDocResponse> callbackServiceNew=new AsyncCallback<MDocResponse>(){
    public void onFailure(    Throwable caught){
      HTMLUtil.showError(caught.getMessage());
    }
    public void onSuccess(    MDocResponse resultS){
      MasterDocumentDTO[] result=resultS.getData();
      SortedSet<MasterDocumentDTO> sorted=new TreeSet<MasterDocumentDTO>();
      for (      MasterDocumentDTO mdoc : result) {
        sorted.add(mdoc);
      }
      List<DocOracleSuggestion> responseList=new LinkedList<DocOracleSuggestion>();
      for (      MasterDocumentDTO mdoc : sorted) {
        DocOracleSuggestion suggestion=new DocOracleSuggestionImpl(mdoc);
        responseList.add(suggestion);
      }
      callback.onSuggestionsReady(request,new Response(responseList));
    }
  }
;
  if (request.getQuery().length() >= triggerSize) {
    String realQuery=request.getQuery();
    if (realQuery.endsWith("String_Node_Str")) {
      realQuery=realQuery.substring(0,realQuery.length() - 1);
    }
    ServiceLocator.getInstance().getExplorerService().searchMDocs(workspaceId,realQuery,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new Date(DEFAULT_FROM_DATE),new Date(),null,null,"String_Node_Str",0,REQUEST_SIZE,callbackServiceNew);
  }
 else {
    List<DocOracleSuggestion> responses=new LinkedList<DocOracleSuggestion>();
    callback.onSuggestionsReady(request,new Response(responses));
  }
}
Program: 86122
Project: 86122
Buggy source:
public DocOracle(){
  triggerSize=DEFAULT_TRIGGER_SIZE;
}

Fixed version (ground truth):
public DocOracle(){
}
Program: 86123
Project: 86123
Buggy source:
public void onSuccess(MasterDocumentDTO[] result){
  SortedSet<MasterDocumentDTO> sorted=new TreeSet<MasterDocumentDTO>();
  for (  MasterDocumentDTO mdoc : result) {
    sorted.add(mdoc);
  }
  List<DocOracleSuggestion> responseList=new LinkedList<DocOracleSuggestion>();
  for (  MasterDocumentDTO mdoc : sorted) {
    DocOracleSuggestion suggestion=new DocOracleSuggestionImpl(mdoc);
    responseList.add(suggestion);
  }
  callback.onSuggestionsReady(request,new Response(responseList));
}

Fixed version (ground truth):
public void onSuccess(MDocResponse resultS){
  MasterDocumentDTO[] result=resultS.getData();
  SortedSet<MasterDocumentDTO> sorted=new TreeSet<MasterDocumentDTO>();
  for (  MasterDocumentDTO mdoc : result) {
    sorted.add(mdoc);
  }
  List<DocOracleSuggestion> responseList=new LinkedList<DocOracleSuggestion>();
  for (  MasterDocumentDTO mdoc : sorted) {
    DocOracleSuggestion suggestion=new DocOracleSuggestionImpl(mdoc);
    responseList.add(suggestion);
  }
  callback.onSuggestionsReady(request,new Response(responseList));
}
Program: 86124
Project: 86124
Buggy source:
public ExplorerPage(String workspaceId,String login){
  m_workspaceId=workspaceId;
  m_login=login;
  m_dndController=new DocDragController(RootPanel.get(),false);
  m_dndController.setBehaviorDragProxy(true);
  ExplorerConstants.init(workspaceId);
  Window.addResizeHandler(this);
  pageManager=new PageManager();
}

Fixed version (ground truth):
public ExplorerPage(String workspaceId,String login){
  m_workspaceId=workspaceId;
  m_login=login;
  m_dndController=new DocDragController(RootPanel.get(),false);
  m_dndController.setBehaviorDragProxy(true);
  ExplorerConstants.init(workspaceId);
  Window.addResizeHandler(this);
  pageManager=new PageManager();
  pageManager.setPageSize(TABLE_PAGE_SIZE);
}
Program: 86125
Project: 86125
Buggy source:
public void onPageChanged(PageManagerEvent event){
  infos.setText(event.getStart() + "String_Node_Str" + event.getEnd()+ "String_Node_Str"+ ServiceLocator.getInstance().getExplorerI18NConstants().ofDocumentsLabel()+ "String_Node_Str"+ event.getTotal());
  first.setVisible(event.getCurrentPage() > 0);
  previous.setVisible(event.getCurrentPage() > 0);
  next.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 1);
  last.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 1);
  infos.setVisible(event.getNumberOfPages() != 1);
}

Fixed version (ground truth):
public void onPageChanged(PageManagerEvent event){
  infos.setText(event.getStart() + "String_Node_Str" + event.getEnd()+ "String_Node_Str"+ ServiceLocator.getInstance().getExplorerI18NConstants().ofDocumentsLabel()+ "String_Node_Str"+ event.getTotal());
  first.setVisible(event.getCurrentPage() > 0);
  previous.setVisible(event.getCurrentPage() > 0);
  next.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 1);
  last.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 1);
  infos.setVisible(event.getNumberOfPages() > 1);
}
Program: 86126
Project: 86126
Buggy source:
public void showCreateWorkflowModelPanel(){
  if (elementTableDecPanel != null) {
    elementTableDecPanel.removeStyleName("String_Node_Str");
  }
  showBasicSearchPanel();
  int spaceAvailable=inputPanel.getOffsetWidth();
  inputPanel.clear();
  inputPanel.setWidget(m_wfEditor);
  m_wfEditor.setWidth(spaceAvailable);
  m_wfEditor.setWorkflowModel(new WorkflowModelModel(m_workspaceId));
}

Fixed version (ground truth):
public void showCreateWorkflowModelPanel(){
  if (elementTableDecPanel != null) {
    elementTableDecPanel.removeStyleName("String_Node_Str");
  }
  showBasicSearchPanel();
  int spaceAvailable=inputPanel.getOffsetWidth() - 10;
  inputPanel.clear();
  inputPanel.setWidget(m_wfEditor);
  m_wfEditor.setWidth(spaceAvailable);
  m_wfEditor.setWorkflowModel(new WorkflowModelModel(m_workspaceId));
}
Program: 86127
Project: 86127
Buggy source:
@Override public void onChange(ChangeEvent event){
  if (inputField.getText().matches("String_Node_Str")) {
    Integer tempValue=new Integer(inputField.getText());
    if (tempValue > minValue && tempValue < maxValue) {
      value=tempValue;
    }
 else {
      value=backupValue;
    }
  }
 else {
    value=backupValue;
  }
  onValueChanged();
}

Fixed version (ground truth):
@Override public void onChange(ChangeEvent event){
  if (inputField.getText().matches("String_Node_Str")) {
    Integer tempValue=new Integer(inputField.getText());
    if (tempValue >= minValue && tempValue <= maxValue) {
      value=tempValue;
    }
 else {
      value=backupValue;
    }
  }
 else {
    value=backupValue;
  }
  onValueChanged();
}
Program: 86128
Project: 86128
Buggy source:
public void onBlur(BlurEvent event){
  removeStyleName(selectedStyle);
  hasFocus=false;
  int x=event.getNativeEvent().getClientX();
  int y=event.getNativeEvent().getClientY();
  if (x < getOffsetWidth() + getAbsoluteLeft() && x > getAbsoluteLeft() && y < getOffsetHeight() + getAbsoluteTop() && y > getAbsoluteTop()) {
    addStyleName(overStyle);
  }
}

Fixed version (ground truth):
public void onBlur(BlurEvent event){
  removeStyleName(selectedStyle);
  hasFocus=false;
}
Program: 86130
Project: 86130
Buggy source:
protected void parse_reslist(String type,List<ReservedItem> reservations,Document doc,int offset){
  Elements copytrs=doc.select("String_Node_Str");
  doc.setBaseUri(opac_url);
  int trs=copytrs.size();
  if (trs == 1) {
    return;
  }
  assert(trs > 0);
  for (int i=1; i < trs; i++) {
    Element tr=copytrs.get(i);
    ReservedItem item=new ReservedItem();
    if (tr.text().contains("String_Node_Str") || tr.children().size() == 1) {
      return;
    }
    item.setTitle(tr.child(1).select("String_Node_Str").text().trim());
    try {
      String[] rowsplit1=tr.child(1).html().split("String_Node_Str");
      String[] rowsplit2=tr.child(2).html().split("String_Node_Str");
      if (rowsplit1.length > 1)       item.setAuthor(rowsplit1[1].trim());
      if (rowsplit2.length > 2)       item.setBranch(rowsplit2[2].trim());
      if (rowsplit2.length > 2)       item.setStatus(rowsplit2[0].trim());
      if (tr.select("String_Node_Str").size() == 1) {
        item.setCancelData(type + "String_Node_Str" + offset+ "String_Node_Str"+ tr.select("String_Node_Str").attr("String_Node_Str").split("String_Node_Str")[1]);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    reservations.add(item);
  }
  assert(reservations.size() == trs - 1);
}

Fixed version (ground truth):
protected static void parse_reslist(String type,List<ReservedItem> reservations,Document doc,int offset,JSONObject data){
  Elements copytrs=doc.select("String_Node_Str");
  doc.setBaseUri(data.optString("String_Node_Str"));
  int trs=copytrs.size();
  if (trs == 1) {
    return;
  }
  assert(trs > 0);
  for (int i=1; i < trs; i++) {
    Element tr=copytrs.get(i);
    ReservedItem item=new ReservedItem();
    if (tr.text().contains("String_Node_Str") || tr.children().size() == 1) {
      return;
    }
    item.setTitle(tr.child(1).select("String_Node_Str").text().trim());
    try {
      String[] rowsplit1=tr.child(1).html().split("String_Node_Str");
      String[] rowsplit2=tr.child(2).html().split("String_Node_Str");
      if (rowsplit1.length > 1)       item.setAuthor(rowsplit1[1].trim());
      if (rowsplit2.length > 2)       item.setBranch(rowsplit2[2].trim());
      if (rowsplit2.length > 2)       item.setStatus(rowsplit2[0].trim());
      if (tr.select("String_Node_Str").size() == 1) {
        item.setCancelData(type + "String_Node_Str" + offset+ "String_Node_Str"+ tr.select("String_Node_Str").attr("String_Node_Str").split("String_Node_Str")[1]);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    reservations.add(item);
  }
  assert(reservations.size() == trs - 1);
}
Program: 86133
Project: 86133
Buggy source:
/** 
 * Creates a customized keystore
 * @param keyStore      The keystore object that should be used in addition to the environmentsdefault key store.
 * @param socketFactory The class that should be used to instantiate a new socket factory, mustbe a subclass of  {@link SSLConnectionSocketFactory}.
 * @return a new {@link SSLConnectionSocketFactory}
 */
public static SSLConnectionSocketFactory create(Class<?> socketFactory,X509TrustManager trustManager) throws NoSuchAlgorithmException, KeyManagementException {
  SSLContext sslContext=SSLContext.getInstance("String_Node_Str");
  sslContext.init(null,new TrustManager[]{trustManager},null);
  if (socketFactory != null) {
    try {
      return (SSLConnectionSocketFactory)socketFactory.getDeclaredConstructor(SSLContext.class).newInstance(sslContext);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return new SSLConnectionSocketFactory(sslContext);
}

Fixed version (ground truth):
/** 
 * Creates a customized keystore
 * @param socketFactory The class that should be used to instantiate a new socket factory, mustbe a subclass of  {@link SSLConnectionSocketFactory}.
 * @return a new {@link SSLConnectionSocketFactory}
 */
public static SSLConnectionSocketFactory create(Class<?> socketFactory,X509TrustManager trustManager) throws NoSuchAlgorithmException, KeyManagementException {
  SSLContext sslContext=SSLContext.getInstance("String_Node_Str");
  sslContext.init(null,new TrustManager[]{trustManager},null);
  if (socketFactory != null) {
    try {
      return (SSLConnectionSocketFactory)socketFactory.getDeclaredConstructor(SSLContext.class).newInstance(sslContext);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return new SSLConnectionSocketFactory(sslContext);
}
Program: 86134
Project: 86134
Buggy source:
/** 
 * Creates a customized keystore
 * @param keyStore      The keystore object that should be used in addition to the environmentsdefault key store.
 * @param socketFactory The class that should be used to instantiate a new socket factory, mustbe a subclass of  {@link SSLConnectionSocketFactory}.
 * @return a new {@link SSLConnectionSocketFactory}
 */
public static SSLSocketFactory createForOkHttp(X509TrustManager trustManager) throws NoSuchAlgorithmException, KeyManagementException {
  SSLContext sslContext=SSLContext.getInstance("String_Node_Str");
  sslContext.init(null,new TrustManager[]{trustManager},null);
  return sslContext.getSocketFactory();
}

Fixed version (ground truth):
/** 
 * Creates a customized keystore for OkHttp
 * @return a new {@link SSLConnectionSocketFactory}
 */
public static SSLSocketFactory createForOkHttp(X509TrustManager trustManager) throws NoSuchAlgorithmException, KeyManagementException {
  SSLContext sslContext=SSLContext.getInstance("String_Node_Str");
  sslContext.init(null,new TrustManager[]{trustManager},null);
  return sslContext.getSocketFactory();
}
Program: 86137
Project: 86137
Buggy source:
protected boolean login(Account acc) throws OpacErrorException {
  String html;
  List<NameValuePair> nameValuePairs=new ArrayList<>(2);
  try {
    String loginPage;
    loginPage=httpGet(opac_url + "String_Node_Str",ENCODING);
    Document loginPageDoc=Jsoup.parse(loginPage);
    if (loginPageDoc.select("String_Node_Str").size() > 0) {
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",loginPageDoc.select("String_Node_Str").first().attr("String_Node_Str")));
    }
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getName()));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getPassword()));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",CSId));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  try {
    html=handleLoginMessage(httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),ENCODING));
  }
 catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
    return false;
  }
catch (  ClientProtocolException e) {
    e.printStackTrace();
    return false;
  }
catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
  Document doc=Jsoup.parse(html);
  if (doc.getElementsByClass("String_Node_Str").size() > 0) {
    throw new OpacErrorException(doc.getElementsByClass("String_Node_Str").get(0).text());
  }
  logged_in=System.currentTimeMillis();
  logged_in_as=acc;
  return true;
}

Fixed version (ground truth):
protected boolean login(Account acc) throws OpacErrorException {
  String html;
  List<NameValuePair> nameValuePairs=new ArrayList<>(2);
  try {
    String loginPage;
    loginPage=httpGet(opac_url + "String_Node_Str",ENCODING);
    Document loginPageDoc=Jsoup.parse(loginPage);
    if (loginPageDoc.select("String_Node_Str").size() > 0) {
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",loginPageDoc.select("String_Node_Str").first().attr("String_Node_Str")));
    }
    CSId=loginPageDoc.select("String_Node_Str").val();
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getName()));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getPassword()));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",CSId));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  try {
    html=handleLoginMessage(httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),ENCODING));
  }
 catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
    return false;
  }
catch (  ClientProtocolException e) {
    e.printStackTrace();
    return false;
  }
catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
  Document doc=Jsoup.parse(html);
  if (doc.getElementsByClass("String_Node_Str").size() > 0) {
    throw new OpacErrorException(doc.getElementsByClass("String_Node_Str").get(0).text());
  }
  logged_in=System.currentTimeMillis();
  logged_in_as=acc;
  return true;
}
Program: 86141
Project: 86141
Buggy source:
@Override public DetailledItem getResult(int position) throws IOException, OpacErrorException {
  if (s_reusedoc != null) {
    return getResultById(null,null);
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public DetailedItem getResult(int position) throws IOException, OpacErrorException {
  if (s_reusedoc != null) {
    return getResultById(null,null);
  }
  throw new UnsupportedOperationException();
}
Program: 86145
Project: 86145
Buggy source:
@Override public DetailledItem getResultById(String id,String homebranch) throws IOException {
  if (!initialised) {
    start();
  }
  if (!id.contains("String_Node_Str")) {
    id="String_Node_Str" + opacSuffix + "String_Node_Str"+ id+ "String_Node_Str";
  }
  if (id.startsWith(opacUrl)) {
    id=id.substring(opacUrl.length());
  }
 else   if (!id.startsWith("String_Node_Str")) {
    id="String_Node_Str" + opacDir + "String_Node_Str"+ id;
  }
  HttpGet httpget=new HttpGet(opacUrl + id);
  HttpResponse response=http_client.execute(httpget);
  String html=convertStreamToString(response.getEntity().getContent());
  HttpUtils.consume(response.getEntity());
  return parse_result(html);
}

Fixed version (ground truth):
@Override public DetailedItem getResultById(String id,String homebranch) throws IOException {
  if (!initialised) {
    start();
  }
  if (!id.contains("String_Node_Str")) {
    id="String_Node_Str" + opacSuffix + "String_Node_Str"+ id+ "String_Node_Str";
  }
  if (id.startsWith(opacUrl)) {
    id=id.substring(opacUrl.length());
  }
 else   if (!id.startsWith("String_Node_Str")) {
    id="String_Node_Str" + opacDir + "String_Node_Str"+ id;
  }
  HttpGet httpget=new HttpGet(opacUrl + id);
  HttpResponse response=http_client.execute(httpget);
  String html=convertStreamToString(response.getEntity().getContent());
  HttpUtils.consume(response.getEntity());
  return parse_result(html);
}
Program: 86146
Project: 86146
Buggy source:
@Override public DetailledItem getResult(int position) throws IOException {
  return null;
}

Fixed version (ground truth):
@Override public DetailedItem getResult(int position) throws IOException {
  return null;
}
Program: 86147
Project: 86147
Buggy source:
@Override public DetailledItem getResultById(String a,String homebranch) throws IOException {
  if (!initialised) {
    start();
  }
  String html=httpGet(opac_url + "String_Node_Str" + a,getDefaultEncoding());
  DetailledItem result=parseResult(html,data);
  if (result.getId() == null) {
    result.setId(a);
  }
  return result;
}

Fixed version (ground truth):
@Override public DetailedItem getResultById(String a,String homebranch) throws IOException {
  if (!initialised) {
    start();
  }
  String html=httpGet(opac_url + "String_Node_Str" + a,getDefaultEncoding());
  DetailedItem result=parseResult(html,data);
  if (result.getId() == null) {
    result.setId(a);
  }
  return result;
}
Program: 86148
Project: 86148
Buggy source:
@Override public DetailledItem getResult(int nr) throws IOException {
  String html=httpGet(opac_url + "String_Node_Str" + nr,getDefaultEncoding());
  return parseResult(html,data);
}

Fixed version (ground truth):
@Override public DetailedItem getResult(int nr) throws IOException {
  String html=httpGet(opac_url + "String_Node_Str" + nr,getDefaultEncoding());
  return parseResult(html,data);
}
Program: 86151
Project: 86151
Buggy source:
/** 
 * Book an electronical item identified by booking_info to the users account. booking_info is what you returned in your DetailledItem object in your getResult hook.
 */
public BookingResult booking(DetailledItem item,Account account,int useraction,String selection) throws IOException, OpacErrorException ;

Fixed version (ground truth):
/** 
 * Book an electronical item identified by booking_info to the users account. booking_info is what you returned in your DetailedItem object in your getResult hook.
 */
public BookingResult booking(DetailedItem item,Account account,int useraction,String selection) throws IOException, OpacErrorException ;
Program: 86152
Project: 86152
Buggy source:
/** 
 * Is this a supported downloadable ebook? May not do network requests.
 */
public boolean isEbook(DetailledItem item);

Fixed version (ground truth):
/** 
 * Is this a supported downloadable ebook? May not do network requests.
 */
public boolean isEbook(DetailedItem item);
Program: 86155
Project: 86155
Buggy source:
@Override public DetailledItem getResult(int position) throws IOException {
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public DetailedItem getResult(int position) throws IOException {
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 86158
Project: 86158
Buggy source:
@Override public DetailledItem getResultById(String id,String homebranch) throws IOException {
  if (!initialised) {
    start();
  }
  if (id == null && reusehtml != null) {
    return parse_result(reusehtml);
  }
  String html=httpGet(opac_url + "String_Node_Str" + id+ "String_Node_Str",getDefaultEncoding());
  return parse_result(html);
}

Fixed version (ground truth):
@Override public DetailedItem getResultById(String id,String homebranch) throws IOException {
  if (!initialised) {
    start();
  }
  if (id == null && reusehtml != null) {
    return parse_result(reusehtml);
  }
  String html=httpGet(opac_url + "String_Node_Str" + id+ "String_Node_Str",getDefaultEncoding());
  return parse_result(html);
}
Program: 86159
Project: 86159
Buggy source:
@Override public DetailledItem getResult(int position) throws IOException {
  if (!initialised) {
    start();
  }
  int page=Double.valueOf(Math.floor(position / 10)).intValue() + 1;
  String html=httpGet(opac_url + "String_Node_Str" + page+ "String_Node_Str"+ rechnr+ "String_Node_Str"+ (position + 1)+ "String_Node_Str",getDefaultEncoding());
  return parse_result(html);
}

Fixed version (ground truth):
@Override public DetailedItem getResult(int position) throws IOException {
  if (!initialised) {
    start();
  }
  int page=Double.valueOf(Math.floor(position / 10)).intValue() + 1;
  String html=httpGet(opac_url + "String_Node_Str" + page+ "String_Node_Str"+ rechnr+ "String_Node_Str"+ (position + 1)+ "String_Node_Str",getDefaultEncoding());
  return parse_result(html);
}
Program: 86161
Project: 86161
Buggy source:
@Override public DetailledItem getResult(int position) throws IOException, OpacErrorException {
  return null;
}

Fixed version (ground truth):
@Override public DetailedItem getResult(int position) throws IOException, OpacErrorException {
  return null;
}
Program: 86164
Project: 86164
Buggy source:
public void prolong(final String a){
  long age=System.currentTimeMillis() - refreshtime;
  if (refreshing || age > MAX_CACHE_AGE) {
    Toast.makeText(getActivity(),R.string.account_no_concurrent,Toast.LENGTH_LONG).show();
    if (!refreshing) {
      refresh();
    }
    return;
  }
  final SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  OpacApi api;
  try {
    api=app.getApi();
  }
 catch (  OpacClient.LibraryRemovedException e) {
    return;
  }
  if (sp.getBoolean("String_Node_Str",false) || (api.getSupportFlags() & OpacApi.SUPPORT_FLAG_WARN_PROLONG_FEES) > 0) {
    prolongPerform(a);
  }
 else {
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    View content=getLayoutInflater(null).inflate(R.layout.dialog_prolong_confirm,null);
    final CheckBox check=(CheckBox)content.findViewById(R.id.check_box1);
    builder.setView(content).setCancelable(false).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        dialog.cancel();
      }
    }
).setPositiveButton(R.string.reservation_fee_continue,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        if (check.isChecked()) {
          sp.edit().putBoolean("String_Node_Str",true).apply();
        }
        prolongPerform(a);
      }
    }
);
    AlertDialog alert=builder.create();
    alert.show();
  }
}

Fixed version (ground truth):
public void prolong(final String a){
  long age=System.currentTimeMillis() - refreshtime;
  if (refreshing || age > MAX_CACHE_AGE) {
    Toast.makeText(getActivity(),R.string.account_no_concurrent,Toast.LENGTH_LONG).show();
    if (!refreshing) {
      refresh();
    }
    return;
  }
  final SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  OpacApi api;
  try {
    api=app.getApi();
  }
 catch (  OpacClient.LibraryRemovedException e) {
    return;
  }
  if (sp.getBoolean("String_Node_Str",false) || (api.getSupportFlags() & OpacApi.SUPPORT_FLAG_WARN_PROLONG_FEES) > 0) {
    prolongPerform(a);
  }
 else {
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    View content=getActivity().getLayoutInflater().inflate(R.layout.dialog_prolong_confirm,null);
    final CheckBox check=(CheckBox)content.findViewById(R.id.check_box1);
    builder.setView(content).setCancelable(false).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        dialog.cancel();
      }
    }
).setPositiveButton(R.string.reservation_fee_continue,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        if (check.isChecked()) {
          sp.edit().putBoolean("String_Node_Str",true).apply();
        }
        prolongPerform(a);
      }
    }
);
    AlertDialog alert=builder.create();
    alert.show();
  }
}
Program: 86165
Project: 86165
Buggy source:
@Override public void onSuccess(MultiStepResult result){
  if (getActivity() == null) {
    return;
  }
  ProlongAllResult res=(ProlongAllResult)result;
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  if (res.getResults() != null) {
    LayoutInflater inflater=getLayoutInflater(null);
    View view=inflater.inflate(R.layout.dialog_simple_list,null,false);
    ListView lv=(ListView)view.findViewById(R.id.lvBibs);
    lv.setAdapter(new ProlongAllResultAdapter(getActivity(),res.getResults()));
switch (result.getActionIdentifier()) {
case ReservationResult.ACTION_BRANCH:
      builder.setTitle(R.string.branch);
  }
  builder.setView(view).setNeutralButton(R.string.close,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      adialog.cancel();
      invalidateData();
    }
  }
);
}
 else {
  builder.setMessage(result.getMessage()).setCancelable(true).setNegativeButton(R.string.close,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface d,    int id){
      d.cancel();
    }
  }
).setOnCancelListener(new DialogInterface.OnCancelListener(){
    @Override public void onCancel(    DialogInterface d){
      if (d != null) {
        d.cancel();
      }
    }
  }
);
}
adialog=builder.create();
adialog.show();
}

Fixed version (ground truth):
@Override public void onSuccess(MultiStepResult result){
  if (getActivity() == null) {
    return;
  }
  ProlongAllResult res=(ProlongAllResult)result;
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  if (res.getResults() != null) {
    LayoutInflater inflater=getActivity().getLayoutInflater();
    View view=inflater.inflate(R.layout.dialog_simple_list,null,false);
    ListView lv=(ListView)view.findViewById(R.id.lvBibs);
    lv.setAdapter(new ProlongAllResultAdapter(getActivity(),res.getResults()));
switch (result.getActionIdentifier()) {
case ReservationResult.ACTION_BRANCH:
      builder.setTitle(R.string.branch);
  }
  builder.setView(view).setNeutralButton(R.string.close,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      adialog.cancel();
      invalidateData();
    }
  }
);
}
 else {
  builder.setMessage(result.getMessage()).setCancelable(true).setNegativeButton(R.string.close,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface d,    int id){
      d.cancel();
    }
  }
).setOnCancelListener(new DialogInterface.OnCancelListener(){
    @Override public void onCancel(    DialogInterface d){
      if (d != null) {
        d.cancel();
      }
    }
  }
);
}
adialog=builder.create();
adialog.show();
}
Program: 86168
Project: 86168
Buggy source:
public void reservationDo(){
  final SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  OpacApi api;
  try {
    api=app.getApi();
  }
 catch (  OpacClient.LibraryRemovedException e) {
    return;
  }
  if (sp.getBoolean("String_Node_Str",false) || (api.getSupportFlags() & OpacApi.SUPPORT_FLAG_WARN_RESERVATION_FEES) > 0) {
    reservationPerform();
  }
 else {
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    View content=getLayoutInflater(null).inflate(R.layout.dialog_reservation_fees,null);
    final CheckBox check=(CheckBox)content.findViewById(R.id.check_box1);
    builder.setView(content).setCancelable(false).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        dialog.cancel();
      }
    }
).setPositiveButton(R.string.reservation_fee_continue,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        if (check.isChecked()) {
          sp.edit().putBoolean("String_Node_Str",true).apply();
        }
        reservationPerform();
      }
    }
);
    AlertDialog alert=builder.create();
    alert.show();
  }
}

Fixed version (ground truth):
public void reservationDo(){
  final SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  OpacApi api;
  try {
    api=app.getApi();
  }
 catch (  OpacClient.LibraryRemovedException e) {
    return;
  }
  if (sp.getBoolean("String_Node_Str",false) || (api.getSupportFlags() & OpacApi.SUPPORT_FLAG_WARN_RESERVATION_FEES) > 0) {
    reservationPerform();
  }
 else {
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    View content=getActivity().getLayoutInflater().inflate(R.layout.dialog_reservation_fees,null);
    final CheckBox check=(CheckBox)content.findViewById(R.id.check_box1);
    builder.setView(content).setCancelable(false).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        dialog.cancel();
      }
    }
).setPositiveButton(R.string.reservation_fee_continue,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        if (check.isChecked()) {
          sp.edit().putBoolean("String_Node_Str",true).apply();
        }
        reservationPerform();
      }
    }
);
    AlertDialog alert=builder.create();
    alert.show();
  }
}
Program: 86169
Project: 86169
Buggy source:
protected void bookingStart(){
  AccountDataSource data=new AccountDataSource(getActivity());
  final List<Account> accounts=data.getAccountsWithPassword(app.getLibrary().getIdent());
  if (accounts.size() == 0) {
    dialog_no_credentials();
  }
 else   if (accounts.size() > 1) {
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    LayoutInflater inflater=getLayoutInflater(null);
    View view=inflater.inflate(R.layout.dialog_simple_list,null,false);
    ListView lv=(ListView)view.findViewById(R.id.lvBibs);
    AccountListAdapter adapter=new AccountListAdapter(getActivity(),accounts);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener(){
      @Override public void onItemClick(      AdapterView<?> parent,      View view,      int position,      long id){
        if (app.getAccount().getId() != accounts.get(position).getId()) {
          app.setAccount(accounts.get(position).getId());
        }
        bookingDo();
        adialog.dismiss();
      }
    }
);
    builder.setTitle(R.string.account_select).setView(view).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        adialog.cancel();
      }
    }
);
    adialog=builder.create();
    adialog.show();
  }
 else {
    bookingDo();
  }
}

Fixed version (ground truth):
protected void bookingStart(){
  AccountDataSource data=new AccountDataSource(getActivity());
  final List<Account> accounts=data.getAccountsWithPassword(app.getLibrary().getIdent());
  if (accounts.size() == 0) {
    dialog_no_credentials();
  }
 else   if (accounts.size() > 1) {
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    LayoutInflater inflater=getActivity().getLayoutInflater();
    View view=inflater.inflate(R.layout.dialog_simple_list,null,false);
    ListView lv=(ListView)view.findViewById(R.id.lvBibs);
    AccountListAdapter adapter=new AccountListAdapter(getActivity(),accounts);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener(){
      @Override public void onItemClick(      AdapterView<?> parent,      View view,      int position,      long id){
        if (app.getAccount().getId() != accounts.get(position).getId()) {
          app.setAccount(accounts.get(position).getId());
        }
        bookingDo();
        adialog.dismiss();
      }
    }
);
    builder.setTitle(R.string.account_select).setView(view).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        adialog.cancel();
      }
    }
);
    adialog=builder.create();
    adialog.show();
  }
 else {
    bookingDo();
  }
}
Program: 86170
Project: 86170
Buggy source:
@Override public String getShareUrl(String id,String title){
  try {
    return "String_Node_Str" + library.getIdent() + "String_Node_Str"+ id+ "String_Node_Str"+ URLEncoder.encode(title,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    return "String_Node_Str" + library.getIdent() + "String_Node_Str"+ id+ "String_Node_Str"+ title;
  }
}

Fixed version (ground truth):
@Override public String getShareUrl(String id,String title){
  try {
    return "String_Node_Str" + URLEncoder.encode(library.getIdent(),"String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str"+ id+ "String_Node_Str"+ URLEncoder.encode(title,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException ignored) {
    return null;
  }
}
Program: 86171
Project: 86171
Buggy source:
private Document accountHttpPost(Account account,String func) throws IOException, OpacErrorException {
  List<NameValuePair> nameValuePairs=new ArrayList<>(2);
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",func));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",account.getPassword()));
  String html=httpPost(opacUrl + "String_Node_Str" + opacDir+ "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if (doc.title().contains("String_Node_Str") || (doc.select("String_Node_Str").size() > 0 && doc.select("String_Node_Str").text().contains("String_Node_Str"))) {
    String errText="String_Node_Str";
    Elements elTable=doc.select("String_Node_Str");
    if (elTable.size() > 0) {
      errText=elTable.get(0).text();
    }
    throw new OpacErrorException(errText);
  }
  if (doc.select("String_Node_Str").size() == 1) {
    throw new OpacErrorException(doc.select("String_Node_Str").text());
  }
  if (doc.text().contains("String_Node_Str") || doc.text().contains("String_Node_Str") || doc.text().contains("String_Node_Str")) {
    throw new OpacErrorException(stringProvider.getString(StringProvider.WRONG_LOGIN_DATA));
  }
  return doc;
}

Fixed version (ground truth):
private Document accountHttpPost(Account account,String func) throws IOException, OpacErrorException {
  List<NameValuePair> nameValuePairs=new ArrayList<>(2);
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",func));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  nameValuePairs.add(new BasicNameValuePair("String_Node_Str",account.getPassword()));
  String html=httpPost(opacUrl + "String_Node_Str" + opacDir+ "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if (doc.title().contains("String_Node_Str") || (doc.select("String_Node_Str").size() > 0 && doc.select("String_Node_Str").text().contains("String_Node_Str"))) {
    String errText="String_Node_Str";
    Elements elTable=doc.select("String_Node_Str");
    if (elTable.size() > 0) {
      errText=elTable.get(0).text();
    }
    throw new OpacErrorException(errText);
  }
  if (doc.select("String_Node_Str").size() == 1) {
    if (!doc.select("String_Node_Str").text().contains("String_Node_Str")) {
      throw new OpacErrorException(doc.select("String_Node_Str").text());
    }
  }
  if (doc.text().contains("String_Node_Str") || doc.text().contains("String_Node_Str") || doc.text().contains("String_Node_Str")) {
    throw new OpacErrorException(stringProvider.getString(StringProvider.WRONG_LOGIN_DATA));
  }
  return doc;
}
Program: 86173
Project: 86173
Buggy source:
@Override public void accountSelected(Account account){
  errorView.removeAllViews();
  progress(false);
  if (!app.getLibrary().isActive()) {
    showConnectivityError(getString(R.string.library_removed_error),false);
    return;
  }
  SearchFieldDataSource dataSource=new JsonSearchFieldDataSource(app);
  int versionCode=BuildConfig.VERSION_CODE;
  String language=getActivity().getResources().getConfiguration().locale.getLanguage();
  if (dataSource.hasSearchFields(app.getLibrary().getIdent()) && dataSource.getLastSearchFieldUpdateVersion(app.getLibrary().getIdent()) == versionCode && language.equals(dataSource.getSearchFieldLanguage(app.getLibrary().getIdent()))) {
    if (task != null && !task.isCancelled()) {
      task.cancel(true);
    }
    fields=dataSource.getSearchFields(app.getLibrary().getIdent());
    buildSearchForm(savedState != null ? OpacClient.bundleToMap(savedState) : saveQuery());
    savedState=null;
  }
 else {
    executeNewLoadSearchFieldsTask();
  }
  setAdvanced(false);
}

Fixed version (ground truth):
@Override public void accountSelected(Account account){
  errorView.removeAllViews();
  progress(false);
  if (!app.getLibrary().isActive()) {
    showConnectivityError(getString(R.string.library_removed_error),false);
    return;
  }
  SearchFieldDataSource dataSource=new JsonSearchFieldDataSource(app);
  int versionCode=0;
  try {
    versionCode=getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(),0).versionCode;
  }
 catch (  NameNotFoundException e) {
  }
  String language=getActivity().getResources().getConfiguration().locale.getLanguage();
  if (dataSource.hasSearchFields(app.getLibrary().getIdent()) && dataSource.getLastSearchFieldUpdateVersion(app.getLibrary().getIdent()) == versionCode && language.equals(dataSource.getSearchFieldLanguage(app.getLibrary().getIdent()))) {
    if (task != null && !task.isCancelled()) {
      task.cancel(true);
    }
    fields=dataSource.getSearchFields(app.getLibrary().getIdent());
    buildSearchForm(savedState != null ? OpacClient.bundleToMap(savedState) : saveQuery());
    savedState=null;
  }
 else {
    executeNewLoadSearchFieldsTask();
  }
  setAdvanced(false);
}
Program: 86174
Project: 86174
Buggy source:
protected static void setTextOrHide(CharSequence value,TextView tv){
  if (!TextUtils.isEmpty(value)) {
    tv.setText(value);
  }
 else {
    tv.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
protected static void setTextOrHide(CharSequence value,TextView tv){
  if (!TextUtils.isEmpty(value)) {
    tv.setVisibility(View.VISIBLE);
    tv.setText(value);
  }
 else {
    tv.setVisibility(View.GONE);
  }
}
Program: 86176
Project: 86176
Buggy source:
public void setItem(I item){
  if (item.getTitle() != null && item.getAuthor() != null) {
    tvTitleAndAuthor.setText(item.getTitle() + "String_Node_Str" + item.getAuthor());
  }
 else   if (item.getTitle() != null) {
    tvTitleAndAuthor.setText(item.getTitle());
  }
 else {
    setTextOrHide(item.getAuthor(),tvTitleAndAuthor);
  }
  if (coversHidden) {
    ivMediaType.setVisibility(View.GONE);
    ivCover.setVisibility(View.GONE);
  }
 else {
    if (item.getCover() != null) {
      ivCover.setVisibility(View.VISIBLE);
      ivMediaType.setVisibility(View.GONE);
      Glide.with(context).using(new ISBNToolsUrlLoader(context)).load(item.getCover()).placeholder(ContextCompat.getDrawable(context,R.drawable.ic_loading)).crossFade().into(ivCover);
    }
 else {
      ivCover.setVisibility(View.GONE);
      ivMediaType.setVisibility(View.VISIBLE);
      Glide.clear(ivCover);
    }
    if (item.getMediaType() != null) {
      ivMediaType.setImageResource(ResultsAdapter.getResourceByMediaType(item.getMediaType()));
      ivMediaType.setContentDescription(sp.getMediaTypeName(item.getMediaType()));
    }
  }
}

Fixed version (ground truth):
public void setItem(I item){
  if (item.getTitle() != null && item.getAuthor() != null) {
    tvTitleAndAuthor.setText(item.getTitle() + "String_Node_Str" + item.getAuthor());
  }
 else   if (item.getTitle() != null) {
    tvTitleAndAuthor.setText(item.getTitle());
  }
 else {
    setTextOrHide(item.getAuthor(),tvTitleAndAuthor);
  }
  if (coversHidden) {
    ivMediaType.setVisibility(View.GONE);
    ivCover.setVisibility(View.GONE);
  }
 else {
    if (item.getCover() != null) {
      ivCover.setVisibility(View.VISIBLE);
      ivMediaType.setVisibility(View.GONE);
      Glide.with(context).using(new ISBNToolsUrlLoader(context)).load(item.getCover()).placeholder(ContextCompat.getDrawable(context,R.drawable.ic_loading)).crossFade().into(ivCover);
    }
 else {
      ivCover.setVisibility(View.GONE);
      ivMediaType.setVisibility(View.VISIBLE);
      Glide.clear(ivCover);
    }
    if (item.getMediaType() != null) {
      ivMediaType.setImageResource(ResultsAdapter.getResourceByMediaType(item.getMediaType()));
      ivMediaType.setContentDescription(sp.getMediaTypeName(item.getMediaType()));
    }
 else {
      ivMediaType.setVisibility(View.INVISIBLE);
    }
  }
}