nus-yam/ex-repair huggingface dataset:
Program: 86177
Project: 86177
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()));
    }
 else {
      ivMediaType.setVisibility(View.INVISIBLE);
    }
  }
}

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);
      Drawable loading=VectorDrawableCompat.create(context.getResources(),R.drawable.ic_loading,null);
      Glide.with(context).using(new ISBNToolsUrlLoader(context)).load(item.getCover()).placeholder(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);
    }
  }
}
Program: 86180
Project: 86180
Buggy source:
public List<Library> getLibraries(ProgressCallback callback) throws IOException {
  AssetManager assets=getAssets();
  String[] files=assets.list(ASSETS_BIBSDIR);
  int num=files.length;
  List<Library> libs=new ArrayList<>();
  StringBuilder builder;
  BufferedReader reader;
  InputStream fis;
  String line;
  String json;
  for (int i=0; i < num; i++) {
    try {
      Library lib=getLibrary(files[i].substring(0,files[i].length() - "String_Node_Str".length()));
      if ((!lib.getApi().equals("String_Node_Str") || BuildConfig.DEBUG) && lib.isActive()) {
        libs.add(lib);
      }
    }
 catch (    JSONException e) {
      Log.w("String_Node_Str","String_Node_Str" + files[i]);
      e.printStackTrace();
    }
    if (callback != null && i % 10 == 0 && i > 0) {
      callback.publishProgress(((double)i) / num);
    }
  }
  return libs;
}

Fixed version (ground truth):
public List<Library> getLibraries(ProgressCallback callback) throws IOException {
  AssetManager assets=getAssets();
  String[] files=assets.list(ASSETS_BIBSDIR);
  String[] additionalFiles=getLibrariesDir().list();
  Set<String> allFiles=new HashSet<>();
  Collections.addAll(allFiles,files);
  Collections.addAll(allFiles,additionalFiles);
  int num=allFiles.size();
  List<Library> libs=new ArrayList<>();
  int i=0;
  for (  String file : allFiles) {
    try {
      Library lib=getLibrary(file.substring(0,file.length() - "String_Node_Str".length()));
      if ((!lib.getApi().equals("String_Node_Str") || BuildConfig.DEBUG) && lib.isActive()) {
        libs.add(lib);
      }
    }
 catch (    JSONException e) {
      Log.w("String_Node_Str","String_Node_Str" + file);
      e.printStackTrace();
    }
    if (callback != null && i % 10 == 0 && i > 0) {
      callback.publishProgress(((double)i) / num);
    }
    i++;
  }
  return libs;
}
Program: 86181
Project: 86181
Buggy source:
public JSONObject toJSON() throws JSONException {
  JSONObject json=new JSONObject();
  json.put("String_Node_Str",api);
  json.put("String_Node_Str",city);
  json.put("String_Node_Str",title);
  json.put("String_Node_Str",country);
  json.put("String_Node_Str",state);
  json.put("String_Node_Str",data);
  json.put("String_Node_Str",account_supported);
  json.put("String_Node_Str",nfcSupported);
  json.put("String_Node_Str",information);
  if (displayName != null)   json.put("String_Node_Str",displayName);
  json.put("String_Node_Str",replacedby);
  JSONArray geoJson=new JSONArray();
  geoJson.put(geo[0]);
  geoJson.put(geo[1]);
  json.put("String_Node_Str",geoJson);
  return json;
}

Fixed version (ground truth):
public JSONObject toJSON() throws JSONException {
  JSONObject json=new JSONObject();
  json.put("String_Node_Str",api);
  json.put("String_Node_Str",city);
  json.put("String_Node_Str",title);
  json.put("String_Node_Str",country);
  json.put("String_Node_Str",state);
  json.put("String_Node_Str",data);
  json.put("String_Node_Str",account_supported);
  json.put("String_Node_Str",nfcSupported);
  json.put("String_Node_Str",information);
  if (displayName != null)   json.put("String_Node_Str",displayName);
  json.put("String_Node_Str",replacedby);
  if (geo != null) {
    JSONArray geoJson=new JSONArray();
    geoJson.put(geo[0]);
    geoJson.put(geo[1]);
    json.put("String_Node_Str",geoJson);
  }
 else {
    json.put("String_Node_Str",(Object)null);
  }
  return json;
}
Program: 86182
Project: 86182
Buggy source:
/** 
 * Create a Library object based on a <code>JSONObject</code>.
 * @param ident identifier
 * @param input input data
 * @return new Library object
 * @throws JSONException if parsing failed or objects were missing
 * @see #getIdent()
 */
public static Library fromJSON(String ident,JSONObject input) throws JSONException {
  Library lib=new Library();
  lib.setIdent(ident);
  lib.setApi(input.getString("String_Node_Str"));
  lib.setCity(input.getString("String_Node_Str"));
  lib.setTitle(input.getString("String_Node_Str"));
  lib.setCountry(input.getString("String_Node_Str"));
  lib.setState(input.getString("String_Node_Str"));
  lib.setData(input.getJSONObject("String_Node_Str"));
  lib.setAccountSupported(input.getBoolean("String_Node_Str"));
  lib.setNfcSupported(input.optBoolean("String_Node_Str",false));
  lib.setInformation(input.getString("String_Node_Str"));
  if (lib.getInformation() == null && lib.getData().has("String_Node_Str")) {
    lib.setInformation(lib.getData().getString("String_Node_Str"));
  }
  if (input.has("String_Node_Str"))   lib.setDisplayName(input.getString("String_Node_Str"));
  if (input.has("String_Node_Str"))   lib.setReplacedBy(input.getString("String_Node_Str"));
  if (input.has("String_Node_Str")) {
    double[] geo=new double[2];
    geo[0]=input.getJSONArray("String_Node_Str").getDouble(0);
    geo[1]=input.getJSONArray("String_Node_Str").getDouble(1);
    lib.setGeo(geo);
  }
  if (lib.getTitle().equals("String_Node_Str"))   lib.setTitle(null);
  return lib;
}

Fixed version (ground truth):
/** 
 * Create a Library object based on a <code>JSONObject</code>.
 * @param ident identifier
 * @param input input data
 * @return new Library object
 * @throws JSONException if parsing failed or objects were missing
 * @see #getIdent()
 */
public static Library fromJSON(String ident,JSONObject input) throws JSONException {
  Library lib=new Library();
  lib.setIdent(ident);
  lib.setApi(input.getString("String_Node_Str"));
  lib.setCity(input.getString("String_Node_Str"));
  lib.setTitle(input.getString("String_Node_Str"));
  lib.setCountry(input.getString("String_Node_Str"));
  lib.setState(input.getString("String_Node_Str"));
  lib.setData(input.getJSONObject("String_Node_Str"));
  lib.setAccountSupported(input.getBoolean("String_Node_Str"));
  lib.setNfcSupported(input.optBoolean("String_Node_Str",false));
  lib.setInformation(input.getString("String_Node_Str"));
  if (lib.getInformation() == null && lib.getData().has("String_Node_Str")) {
    lib.setInformation(lib.getData().getString("String_Node_Str"));
  }
  if (input.has("String_Node_Str"))   lib.setDisplayName(input.getString("String_Node_Str"));
  if (input.has("String_Node_Str"))   lib.setReplacedBy(input.getString("String_Node_Str"));
  if (input.has("String_Node_Str") && !input.isNull("String_Node_Str")) {
    double[] geo=new double[2];
    geo[0]=input.getJSONArray("String_Node_Str").getDouble(0);
    geo[1]=input.getJSONArray("String_Node_Str").getDouble(1);
    lib.setGeo(geo);
  }
  if (lib.getTitle().equals("String_Node_Str"))   lib.setTitle(null);
  return lib;
}
Program: 86186
Project: 86186
Buggy source:
@Test public void testParseReservationList() throws OpacApi.OpacErrorException, JSONException, NotReachableException {
  String html=readResource("String_Node_Str" + file);
  if (html == null)   return;
  if (file.equals("String_Node_Str") || file.equals("String_Node_Str") || file.equals("String_Node_Str"))   return;
  AccountData data=Bibliotheca.parse_account(new Account(),Jsoup.parse(html),getData(file));
  assertTrue(data.getReservations().size() > 0);
  for (  ReservedItem item : data.getReservations()) {
    assertNotNull(item.getTitle());
    assertNotNull(item.getAuthor());
  }
}

Fixed version (ground truth):
@Test public void testParseReservationList() throws OpacApi.OpacErrorException, JSONException, NotReachableException {
  String html=readResource("String_Node_Str" + file);
  if (html == null)   return;
  if (file.equals("String_Node_Str") || file.equals("String_Node_Str") || file.equals("String_Node_Str")|| file.equals("String_Node_Str"))   return;
  AccountData data=Bibliotheca.parse_account(new Account(),Jsoup.parse(html),getData(file));
  assertTrue(data.getReservations().size() > 0);
  for (  ReservedItem item : data.getReservations()) {
    assertNotNull(item.getTitle());
    assertNotNull(item.getAuthor());
  }
}
Program: 86188
Project: 86188
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")) {
    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) {
    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: 86189
Project: 86189
Buggy source:
public void urlintent(){
  Uri d=getIntent().getData();
  if (d.getHost().equals("String_Node_Str")) {
    String[] split=d.getPath().split("String_Node_Str");
    String bib;
    try {
      bib=URLDecoder.decode(split[1],"String_Node_Str");
    }
 catch (    UnsupportedEncodingException e) {
      throw new AssertionError("String_Node_Str");
    }
    if (!app.getLibrary().getIdent().equals(bib)) {
      AccountDataSource adata=new AccountDataSource(this);
      adata.open();
      List<Account> accounts=adata.getAllAccounts(bib);
      adata.close();
      if (accounts.size() > 0) {
        app.setAccount(accounts.get(0).getId());
      }
 else {
        Intent i=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str" + d.getPath()));
        startActivity(i);
        return;
      }
    }
    String medianr=split[2];
    if (medianr.length() > 1) {
      Intent intent=new Intent(MainActivity.this,SearchResultDetailActivity.class);
      intent.putExtra(SearchResultDetailFragment.ARG_ITEM_ID,medianr);
      startActivity(intent);
    }
 else {
      String title;
      try {
        title=URLDecoder.decode(split[3],"String_Node_Str");
      }
 catch (      UnsupportedEncodingException e) {
        throw new AssertionError("String_Node_Str");
      }
      Bundle query=new Bundle();
      query.putString("String_Node_Str",title);
      Intent intent=new Intent(MainActivity.this,SearchResultListActivity.class);
      intent.putExtra("String_Node_Str",query);
      startActivity(intent);
    }
    finish();
  }
}

Fixed version (ground truth):
public void urlintent(){
  Uri d=getIntent().getData();
  if (d.getHost().equals("String_Node_Str")) {
    String[] split=d.getPath().split("String_Node_Str");
    String bib;
    try {
      bib=URLDecoder.decode(split[1],"String_Node_Str");
    }
 catch (    UnsupportedEncodingException e) {
      throw new AssertionError("String_Node_Str");
    }
    if (app.getLibrary() == null || !app.getLibrary().getIdent().equals(bib)) {
      AccountDataSource adata=new AccountDataSource(this);
      adata.open();
      List<Account> accounts=adata.getAllAccounts(bib);
      adata.close();
      if (accounts.size() > 0) {
        app.setAccount(accounts.get(0).getId());
      }
 else {
        Intent i=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str" + d.getPath()));
        startActivity(i);
        return;
      }
    }
    String medianr=split[2];
    if (medianr.length() > 1) {
      Intent intent=new Intent(MainActivity.this,SearchResultDetailActivity.class);
      intent.putExtra(SearchResultDetailFragment.ARG_ITEM_ID,medianr);
      startActivity(intent);
    }
 else {
      String title;
      try {
        title=URLDecoder.decode(split[3],"String_Node_Str");
      }
 catch (      UnsupportedEncodingException e) {
        throw new AssertionError("String_Node_Str");
      }
      Bundle query=new Bundle();
      query.putString("String_Node_Str",title);
      Intent intent=new Intent(MainActivity.this,SearchResultListActivity.class);
      intent.putExtra("String_Node_Str",query);
      startActivity(intent);
    }
    finish();
  }
}
Program: 86191
Project: 86191
Buggy source:
static LocalDate parseCopyReturn(String str){
  DateTimeFormatter fmt=DateTimeFormat.forPattern("String_Node_Str").withLocale(Locale.GERMAN);
  final Matcher matcher=Pattern.compile("String_Node_Str").matcher(str);
  if (matcher.find()) {
    return fmt.parseLocalDate(matcher.group());
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
static LocalDate parseCopyReturn(String str){
  if (str == null)   return null;
  DateTimeFormatter fmt=DateTimeFormat.forPattern("String_Node_Str").withLocale(Locale.GERMAN);
  final Matcher matcher=Pattern.compile("String_Node_Str").matcher(str);
  if (matcher.find()) {
    return fmt.parseLocalDate(matcher.group());
  }
 else {
    return null;
  }
}
Program: 86193
Project: 86193
Buggy source:
protected void refreshMenu(Menu menu){
  if (item != null) {
    if (item.isReservable()) {
      menu.findItem(R.id.action_reservation).setVisible(true);
    }
 else {
      menu.findItem(R.id.action_reservation).setVisible(false);
    }
    if (item.isBookable() && app.getApi() instanceof EbookServiceApi) {
      if (((EbookServiceApi)app.getApi()).isEbook(item)) {
        menu.findItem(R.id.action_lendebook).setVisible(true);
      }
 else {
        menu.findItem(R.id.action_lendebook).setVisible(false);
      }
    }
 else {
      menu.findItem(R.id.action_lendebook).setVisible(false);
    }
    menu.findItem(R.id.action_tocollection).setVisible(item.getCollectionId() != null);
  }
 else {
    menu.findItem(R.id.action_reservation).setVisible(false);
    menu.findItem(R.id.action_lendebook).setVisible(false);
    menu.findItem(R.id.action_tocollection).setVisible(false);
  }
  String bib=app.getLibrary().getIdent();
  StarDataSource data=new StarDataSource(getActivity());
  if ((id == null || id.equals("String_Node_Str")) && item != null) {
    if (data.isStarredTitle(bib,item.getTitle())) {
      menu.findItem(R.id.action_star).setIcon(R.drawable.ic_star_1_white_24dp);
    }
  }
 else {
    if (data.isStarred(bib,id)) {
      menu.findItem(R.id.action_star).setIcon(R.drawable.ic_star_1_white_24dp);
    }
  }
}

Fixed version (ground truth):
protected void refreshMenu(Menu menu){
  if (item != null) {
    if (item.isReservable()) {
      menu.findItem(R.id.action_reservation).setVisible(true);
    }
 else {
      menu.findItem(R.id.action_reservation).setVisible(false);
    }
    if (item.isBookable() && app.getApi() instanceof EbookServiceApi) {
      if (((EbookServiceApi)app.getApi()).isEbook(item)) {
        menu.findItem(R.id.action_lendebook).setVisible(true);
      }
 else {
        menu.findItem(R.id.action_lendebook).setVisible(false);
      }
    }
 else {
      menu.findItem(R.id.action_lendebook).setVisible(false);
    }
    menu.findItem(R.id.action_tocollection).setVisible(item.getCollectionId() != null);
  }
 else {
    menu.findItem(R.id.action_reservation).setVisible(false);
    menu.findItem(R.id.action_lendebook).setVisible(false);
    menu.findItem(R.id.action_tocollection).setVisible(false);
  }
  String bib=app.getLibrary().getIdent();
  StarDataSource data=new StarDataSource(getActivity());
  String _id=id;
  if (item != null) {
    _id=item.getId();
  }
  if ((_id == null || _id.equals("String_Node_Str")) && item != null) {
    if (data.isStarredTitle(bib,item.getTitle())) {
      menu.findItem(R.id.action_star).setIcon(R.drawable.ic_star_1_white_24dp);
    }
  }
 else {
    if (data.isStarred(bib,_id)) {
      menu.findItem(R.id.action_star).setIcon(R.drawable.ic_star_1_white_24dp);
    }
  }
}
Program: 86194
Project: 86194
Buggy source:
public void setIcon(int id){
  Drawable drawable=DrawableCompat.wrap(ContextCompat.getDrawable(context,id));
  DrawableCompat.setTint(drawable,Color.argb(138,0,0,0));
  icon.setImageDrawable(drawable);
}

Fixed version (ground truth):
public void setIcon(int id){
  Drawable drawable=DrawableCompat.wrap(VectorDrawableCompat.create(context.getResources(),id,context.getTheme()));
  DrawableCompat.setTint(drawable,Color.argb(138,0,0,0));
  icon.setImageDrawable(drawable);
}
Program: 86195
Project: 86195
Buggy source:
protected Class<?> getSocketFactoryClass(){
  return null;
}

Fixed version (ground truth):
protected Class<?> getSocketFactoryClass(boolean tls_only){
  return null;
}
Program: 86196
Project: 86196
Buggy source:
/** 
 * Create a new HttpClient.
 * @param tls_only If this is true, only TLS v1 and newer will be used, SSLv3 will be disabled.We highly recommend to set this to true, if possible. This is currently a no-op on the default implementation and only used in the Android implementation!
 */
public HttpClient getNewApacheHttpClient(boolean customssl,boolean tls_only,boolean disguise_app){
  HttpClientBuilder builder=HttpClientBuilder.create();
  builder.setRedirectStrategy(new CustomRedirectStrategy());
  if (disguise_app) {
    builder.setUserAgent("String_Node_Str" + "String_Node_Str");
  }
 else {
    builder.setUserAgent(user_agent);
  }
  if (customssl) {
    try {
      if (trust_store == null) {
        trust_store=getKeyStore();
      }
      SSLConnectionSocketFactory sf=AdditionalKeyStoresSSLSocketFactory.create(trust_store,getSocketFactoryClass());
      Registry<ConnectionSocketFactory> registry=RegistryBuilder.<ConnectionSocketFactory>create().register("String_Node_Str",PlainConnectionSocketFactory.getSocketFactory()).register("String_Node_Str",sf).build();
      HttpClientConnectionManager ccm=new PoolingHttpClientConnectionManager(registry);
      builder.setConnectionManager(ccm);
      return builder.build();
    }
 catch (    Exception e) {
      e.printStackTrace();
      return builder.build();
    }
  }
 else {
    return builder.build();
  }
}

Fixed version (ground truth):
/** 
 * Create a new HttpClient.
 * @param tls_only If this is true, only TLS v1 and newer will be used, SSLv3 will be disabled.We highly recommend to set this to true, if possible. This is currently a no-op on the default implementation and only used in the Android implementation!
 */
public HttpClient getNewApacheHttpClient(boolean customssl,boolean tls_only,boolean disguise_app){
  HttpClientBuilder builder=HttpClientBuilder.create();
  builder.setRedirectStrategy(new CustomRedirectStrategy());
  if (disguise_app) {
    builder.setUserAgent("String_Node_Str" + "String_Node_Str");
  }
 else {
    builder.setUserAgent(user_agent);
  }
  if (customssl) {
    try {
      if (trust_store == null) {
        trust_store=getKeyStore();
      }
      SSLConnectionSocketFactory sf=AdditionalKeyStoresSSLSocketFactory.create(trust_store,true,getSocketFactoryClass(tls_only));
      Registry<ConnectionSocketFactory> registry=RegistryBuilder.<ConnectionSocketFactory>create().register("String_Node_Str",PlainConnectionSocketFactory.getSocketFactory()).register("String_Node_Str",sf).build();
      HttpClientConnectionManager ccm=new PoolingHttpClientConnectionManager(registry);
      builder.setConnectionManager(ccm);
      return builder.build();
    }
 catch (    Exception e) {
      e.printStackTrace();
      return builder.build();
    }
  }
 else {
    return builder.build();
  }
}
Program: 86197
Project: 86197
Buggy source:
public HttpClient getNewApacheHttpClient(boolean customssl,boolean tls_only,boolean disguise_app){
  HttpClientBuilder builder=HttpClientBuilder.create();
  builder.setRedirectStrategy(new CustomRedirectStrategy());
  if (disguise_app) {
    builder.setUserAgent("String_Node_Str" + "String_Node_Str");
  }
 else {
    builder.setUserAgent(user_agent);
  }
  if (customssl) {
    try {
      if (trust_store == null) {
        trust_store=getKeyStore();
      }
      SSLConnectionSocketFactory sf=AdditionalKeyStoresSSLSocketFactory.create(trust_store,tls_only,getSocketFactoryClass());
      Registry<ConnectionSocketFactory> registry=RegistryBuilder.<ConnectionSocketFactory>create().register("String_Node_Str",PlainConnectionSocketFactory.getSocketFactory()).register("String_Node_Str",sf).build();
      HttpClientConnectionManager ccm=new PoolingHttpClientConnectionManager(registry);
      builder.setConnectionManager(ccm);
      return builder.build();
    }
 catch (    Exception e) {
      e.printStackTrace();
      return builder.build();
    }
  }
 else {
    return builder.build();
  }
}

Fixed version (ground truth):
public HttpClient getNewApacheHttpClient(boolean customssl,boolean tls_only,boolean disguise_app){
  HttpClientBuilder builder=HttpClientBuilder.create();
  builder.setRedirectStrategy(new CustomRedirectStrategy());
  if (disguise_app) {
    builder.setUserAgent("String_Node_Str" + "String_Node_Str");
  }
 else {
    builder.setUserAgent(user_agent);
  }
  if (customssl) {
    try {
      if (trust_store == null) {
        trust_store=getKeyStore();
      }
      SSLConnectionSocketFactory sf=AdditionalKeyStoresSSLSocketFactory.create(trust_store,getSocketFactoryClass());
      Registry<ConnectionSocketFactory> registry=RegistryBuilder.<ConnectionSocketFactory>create().register("String_Node_Str",PlainConnectionSocketFactory.getSocketFactory()).register("String_Node_Str",sf).build();
      HttpClientConnectionManager ccm=new PoolingHttpClientConnectionManager(registry);
      builder.setConnectionManager(ccm);
      return builder.build();
    }
 catch (    Exception e) {
      e.printStackTrace();
      return builder.build();
    }
  }
 else {
    return builder.build();
  }
}
Program: 86198
Project: 86198
Buggy source:
protected Class<?> getSocketFactoryClass(){
  return TlsSniSocketFactory.class;
}

Fixed version (ground truth):
protected Class<?> getSocketFactoryClass(boolean tls_only){
  if (tls_only)   return TlsSniSocketFactory.class;
 else   return TlsSniSocketFactoryWithSSL3.class;
}
Program: 86199
Project: 86199
Buggy source:
public TlsSniSocketFactory(final SSLContext sslContext,boolean tls_only){
  super(sslContext,BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  this.tls_only=tls_only;
  socketfactory=sslContext.getSocketFactory();
  hostnameVerifier=BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
}

Fixed version (ground truth):
public TlsSniSocketFactory(final SSLContext sslContext){
  super(sslContext,BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  socketfactory=sslContext.getSocketFactory();
  hostnameVerifier=BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
}
Program: 86200
Project: 86200
Buggy source:
private void setAccountSwitcherVisible(boolean accountSwitcherVisible){
  if (accountSwitcherVisible == this.accountSwitcherVisible)   return;
  this.accountSwitcherVisible=accountSwitcherVisible;
  drawer.setAccountsVisible(accountSwitcherVisible);
  accountExpand.setActivated(accountSwitcherVisible);
  if (!accountSwitcherVisible) {
    fixNavigationSelection();
  }
}

Fixed version (ground truth):
private void setAccountSwitcherVisible(boolean accountSwitcherVisible){
  if (accountSwitcherVisible == this.accountSwitcherVisible)   return;
  this.accountSwitcherVisible=accountSwitcherVisible;
  drawer.setAccountsVisible(accountSwitcherVisible);
  if (Build.VERSION.SDK_INT >= 11)   accountExpand.setActivated(accountSwitcherVisible);
  if (!accountSwitcherVisible) {
    fixNavigationSelection();
  }
}
Program: 86201
Project: 86201
Buggy source:
private void init(){
  accountsList=new RecyclerView(getContext());
  accountsList.setLayoutManager(new LinearLayoutManager(getContext()));
  addView(accountsList);
  LayoutParams params=(FrameLayout.LayoutParams)accountsList.getLayoutParams();
  params.setMargins(0,getResources().getDimensionPixelSize(R.dimen.navigation_drawer_header_height),0,0);
  accountsList.setBackgroundResource(R.color.background_material_light);
  accountsList.setVisibility(View.GONE);
}

Fixed version (ground truth):
private void init(){
  accountsList=new RecyclerView(getContext());
  accountsList.setLayoutManager(new LinearLayoutManager(getContext()));
  addView(accountsList);
  LayoutParams params=(FrameLayout.LayoutParams)accountsList.getLayoutParams();
  params.setMargins(0,getResources().getDimensionPixelSize(R.dimen.navigation_drawer_header_height),0,0);
  params.gravity=Gravity.BOTTOM;
  accountsList.setBackgroundResource(R.color.background_material_light);
  accountsList.setVisibility(View.GONE);
}
Program: 86202
Project: 86202
Buggy source:
public void setAccountsVisible(boolean visible){
  if (visible == accountsVisible)   return;
  accountsVisible=visible;
  if (accountsVisible) {
    accountsList.setVisibility(View.VISIBLE);
    accountsList.setAlpha(0.0f);
    ViewPropertyAnimator.animate(accountsList).alpha(1.0f).setListener(null);
  }
 else {
    ViewPropertyAnimator.animate(accountsList).alpha(0.0f).setListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        if (accountsList != null) {
          accountsList.setVisibility(View.GONE);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void setAccountsVisible(boolean visible){
  if (visible == accountsVisible)   return;
  accountsVisible=visible;
  if (accountsVisible) {
    accountsList.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 12) {
      accountsList.setAlpha(0);
      accountsList.animate().alpha(1.0f).setListener(null);
    }
  }
 else {
    if (Build.VERSION.SDK_INT >= 12) {
      accountsList.animate().alpha(0.0f).setListener(new AnimatorListenerAdapter(){
        @Override public void onAnimationEnd(        Animator animation){
          if (accountsList != null) {
            accountsList.clearAnimation();
            accountsList.setVisibility(View.GONE);
          }
        }
      }
);
    }
 else {
      accountsList.setVisibility(View.GONE);
    }
  }
}
Program: 86203
Project: 86203
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  if (accountsList != null) {
    accountsList.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  if (accountsList != null) {
    accountsList.clearAnimation();
    accountsList.setVisibility(View.GONE);
  }
}
Program: 86204
Project: 86204
Buggy source:
@Override public int getItemCount(){
  return accountsWithoutCurrent.size() + 1 + FOOTER_COUNT;
}

Fixed version (ground truth):
@Override public int getItemCount(){
  return accountsWithoutCurrent.size() + (accountsWithoutCurrent.size() > 0 ? 1 : 0) + FOOTER_COUNT;
}
Program: 86205
Project: 86205
Buggy source:
@Override public int getItemViewType(int position){
  if (position < accountsWithoutCurrent.size()) {
    return TYPE_ACCOUNT;
  }
 else   if (position == accountsWithoutCurrent.size()) {
    return TYPE_SEPARATOR;
  }
 else {
    return TYPE_FOOTER;
  }
}

Fixed version (ground truth):
@Override public int getItemViewType(int position){
  if (position < accountsWithoutCurrent.size()) {
    return TYPE_ACCOUNT;
  }
 else   if (position == accountsWithoutCurrent.size() && accountsWithoutCurrent.size() > 0) {
    return TYPE_SEPARATOR;
  }
 else {
    return TYPE_FOOTER;
  }
}
Program: 86206
Project: 86206
Buggy source:
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder,int position){
  if (holder instanceof AccountViewHolder) {
    Account account=accountsWithoutCurrent.get(position);
    ((AccountViewHolder)holder).setData(account,expiring.get(account));
  }
 else   if (holder instanceof FooterViewHolder) {
    FooterViewHolder footer=(FooterViewHolder)holder;
    if (position == accountsWithoutCurrent.size() + 1) {
      footer.setTitle(R.string.account_add);
      footer.setIcon(R.drawable.ic_add_24dp);
      footer.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View view){
          if (listener != null)           listener.onAddAccountClicked();
        }
      }
);
    }
 else     if (position == accountsWithoutCurrent.size() + 2) {
      footer.setTitle(R.string.accounts);
      footer.setIcon(R.drawable.ic_settings_24dp);
      footer.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View view){
          if (listener != null)           listener.onManageAccountsClicked();
        }
      }
);
    }
  }
}

Fixed version (ground truth):
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder,int position){
  if (holder instanceof AccountViewHolder) {
    Account account=accountsWithoutCurrent.get(position);
    ((AccountViewHolder)holder).setData(account,expiring.get(account));
  }
 else   if (holder instanceof FooterViewHolder) {
    FooterViewHolder footer=(FooterViewHolder)holder;
    if (position == accountsWithoutCurrent.size() + (accountsWithoutCurrent.size() > 0 ? 1 : 0)) {
      footer.setTitle(R.string.account_add);
      footer.setIcon(R.drawable.ic_add_24dp);
      footer.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View view){
          if (listener != null)           listener.onAddAccountClicked();
        }
      }
);
    }
 else     if (position == accountsWithoutCurrent.size() + (accountsWithoutCurrent.size() > 0 ? 2 : 1)) {
      footer.setTitle(R.string.accounts);
      footer.setIcon(R.drawable.ic_settings_24dp);
      footer.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View view){
          if (listener != null)           listener.onManageAccountsClicked();
        }
      }
);
    }
  }
}
Program: 86207
Project: 86207
Buggy source:
private void init(){
  accountsList=new RecyclerView(getContext());
  accountsList.setLayoutManager(new LinearLayoutManager(getContext()));
  addView(accountsList);
  LayoutParams params=(FrameLayout.LayoutParams)accountsList.getLayoutParams();
  params.setMargins(0,getResources().getDimensionPixelSize(R.dimen.navigation_drawer_header_height),0,0);
  params.gravity=Gravity.BOTTOM;
  TypedArray a=getContext().obtainStyledAttributes(new int[]{android.R.attr.windowBackground});
  accountsList.setBackgroundResource(a.getResourceId(0,0));
  a.recycle();
  accountsList.setVisibility(View.GONE);
}

Fixed version (ground truth):
private void init(){
  accountsList=new RecyclerView(getContext());
  accountsList.setLayoutManager(new LinearLayoutManager(getContext()));
  addView(accountsList);
  LayoutParams params=(FrameLayout.LayoutParams)accountsList.getLayoutParams();
  params.setMargins(0,getResources().getDimensionPixelSize(R.dimen.navigation_drawer_header_height),0,0);
  params.gravity=Gravity.BOTTOM;
  TypedArray a=getContext().obtainStyledAttributes(new int[]{android.R.attr.windowBackground});
  accountsList.setBackgroundResource(a.getResourceId(0,0));
  a.recycle();
  accountsList.setPadding(0,getResources().getDimensionPixelSize(R.dimen.list_top_padding),0,0);
  accountsList.setClipToPadding(false);
  accountsList.setVisibility(View.GONE);
}
Program: 86208
Project: 86208
Buggy source:
@Override public ProlongResult prolong(String media,Account account,int useraction,String Selection) throws IOException {
  if (accountobj == null) {
    try {
      login(account);
    }
 catch (    OpacErrorException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR,e.getMessage());
    }
  }
  String html=httpGet(opac_url + "String_Node_Str" + media,getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if ((html.contains("String_Node_Str") || html.contains("String_Node_Str")) && useraction == 0) {
    try {
      login(account);
    }
 catch (    OpacErrorException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR,e.getMessage());
    }
    prolong(media,account,1,null);
  }
  String dialog=doc.select("String_Node_Str").text();
  if (dialog.contains("String_Node_Str")) {
    return new ProlongResult(MultiStepResult.Status.OK,dialog);
  }
 else {
    return new ProlongResult(MultiStepResult.Status.ERROR,dialog);
  }
}

Fixed version (ground truth):
@Override public ProlongResult prolong(String media,Account account,int useraction,String Selection) throws IOException {
  if (media.startsWith("String_Node_Str")) {
    String message=media.split("String_Node_Str")[1];
    return new ProlongResult(MultiStepResult.Status.ERROR,message);
  }
  if (accountobj == null) {
    try {
      login(account);
    }
 catch (    OpacErrorException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR,e.getMessage());
    }
  }
  String html=httpGet(opac_url + "String_Node_Str" + media,getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if ((html.contains("String_Node_Str") || html.contains("String_Node_Str")) && useraction == 0) {
    try {
      login(account);
    }
 catch (    OpacErrorException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR,e.getMessage());
    }
    prolong(media,account,1,null);
  }
  String dialog=doc.select("String_Node_Str").text();
  if (dialog.contains("String_Node_Str")) {
    return new ProlongResult(MultiStepResult.Status.OK,dialog);
  }
 else {
    return new ProlongResult(MultiStepResult.Status.ERROR,dialog);
  }
}
Program: 86213
Project: 86213
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.context=getActivity();
  addPreferencesFromResource(R.xml.settings);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH || !context.getPackageManager().hasSystemFeature("String_Node_Str")) {
    findPreference("String_Node_Str").setEnabled(false);
  }
  Preference assistant=findPreference("String_Node_Str");
  assistant.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference arg0){
      ((OpacClient)context.getApplication()).openAccountList(context);
      return false;
    }
  }
);
  if (!ebooksSupported()) {
    ((PreferenceCategory)findPreference("String_Node_Str")).removePreference(findPreference("String_Node_Str"));
  }
  Preference meta=findPreference("String_Node_Str");
  meta.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference arg0){
      AccountDataSource adata=new AccountDataSource(context);
      adata.open();
      adata.invalidateCachedData();
      adata.notificationClearCache(true);
      adata.close();
      SearchFieldDataSource sfdata=new JsonSearchFieldDataSource(context);
      sfdata.clearAll();
      Intent i=new Intent(context,ReminderCheckService.class);
      context.startService(i);
      return false;
    }
  }
);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.context=getActivity();
  addPreferencesFromResource(R.xml.settings);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH || !context.getPackageManager().hasSystemFeature("String_Node_Str")) {
    if (findPreference("String_Node_Str") != null) {
      findPreference("String_Node_Str").setEnabled(false);
    }
  }
  Preference assistant=findPreference("String_Node_Str");
  assistant.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference arg0){
      ((OpacClient)context.getApplication()).openAccountList(context);
      return false;
    }
  }
);
  if (!ebooksSupported()) {
    ((PreferenceCategory)findPreference("String_Node_Str")).removePreference(findPreference("String_Node_Str"));
  }
  Preference meta=findPreference("String_Node_Str");
  meta.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference arg0){
      AccountDataSource adata=new AccountDataSource(context);
      adata.open();
      adata.invalidateCachedData();
      adata.notificationClearCache(true);
      adata.close();
      SearchFieldDataSource sfdata=new JsonSearchFieldDataSource(context);
      sfdata.clearAll();
      Intent i=new Intent(context,ReminderCheckService.class);
      context.startService(i);
      return false;
    }
  }
);
}
Program: 86215
Project: 86215
Buggy source:
private String matchJSVariable(String js,String varName){
  Pattern pattern=Pattern.compile("String_Node_Str" + varName + "String_Node_Str");
  Matcher matcher=pattern.matcher(js);
  if (matcher.find()) {
    return matcher.group(1);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private String matchJSVariable(String js,String varName){
  Pattern patternVar=Pattern.compile("String_Node_Str" + varName + "String_Node_Str");
  Matcher matcher=patternVar.matcher(js);
  if (matcher.find()) {
    return matcher.group(1);
  }
 else {
    return null;
  }
}
Program: 86217
Project: 86217
Buggy source:
@Override protected void onPostExecute(List<SearchField> fields){
  if (getActivity() == null) {
    return;
  }
  progress(false);
  if (fields != null) {
    SearchFragment.this.fields=fields;
    buildSearchForm();
    if (savedState != null) {
      loadQuery(savedState);
    }
  }
 else {
    if (exception != null && exception instanceof OpacErrorException) {
      showConnectivityError(exception.getMessage());
    }
 else     if (exception != null && exception instanceof SSLSecurityException) {
      showConnectivityError(getString(R.string.connection_error_detail_security));
    }
 else {
      showConnectivityError();
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(List<SearchField> fields){
  if (getActivity() == null) {
    return;
  }
  progress(false);
  if (fields != null) {
    SearchFragment.this.fields=fields;
    buildSearchForm(savedState != null ? OpacClient.bundleToMap(savedState) : saveQuery());
    savedState=null;
  }
 else {
    if (exception != null && exception instanceof OpacErrorException) {
      showConnectivityError(exception.getMessage());
    }
 else     if (exception != null && exception instanceof SSLSecurityException) {
      showConnectivityError(getString(R.string.connection_error_detail_security));
    }
 else {
      showConnectivityError();
    }
  }
}
Program: 86218
Project: 86218
Buggy source:
public void barcodeScanned(ScanResult scanResult){
  this.scanResult=scanResult;
  if (barcodeScanningField != null) {
    ViewGroup v=(ViewGroup)view.findViewWithTag(barcodeScanningField);
    EditText text=(EditText)v.findViewById(R.id.edittext);
    text.setText(scanResult.getContents());
    barcodeScanningField=null;
    this.scanResult=null;
  }
}

Fixed version (ground truth):
public void barcodeScanned(ScanResult scanResult){
  this.scanResult=scanResult;
}
Program: 86219
Project: 86219
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (savedInstanceState != null && savedInstanceState.containsKey("String_Node_Str")) {
    savedState=savedInstanceState.getBundle("String_Node_Str");
  }
  if (savedInstanceState != null && savedInstanceState.containsKey("String_Node_Str")) {
    barcodeScanningField=savedInstanceState.getString("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (savedInstanceState != null && savedInstanceState.containsKey("String_Node_Str")) {
    savedState=savedInstanceState.getBundle("String_Node_Str");
  }
  buildSearchForm(OpacClient.bundleToMap(savedState));
  if (savedInstanceState != null && savedInstanceState.containsKey("String_Node_Str")) {
    barcodeScanningField=savedInstanceState.getString("String_Node_Str");
  }
}
Program: 86220
Project: 86220
Buggy source:
@Override public void accountSelected(Account account){
  errorView.removeAllViews();
  progress(false);
  SearchFieldDataSource dataSource=new JsonSearchFieldDataSource(app);
  int versionCode=0;
  try {
    versionCode=app.getPackageManager().getPackageInfo(app.getPackageName(),0).versionCode;
  }
 catch (  NameNotFoundException e) {
    e.printStackTrace();
  }
  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();
    if (savedState != null) {
      loadQuery(savedState);
    }
  }
 else {
    executeNewLoadSearchFieldsTask();
  }
  setAdvanced(false);
}

Fixed version (ground truth):
@Override public void accountSelected(Account account){
  errorView.removeAllViews();
  progress(false);
  SearchFieldDataSource dataSource=new JsonSearchFieldDataSource(app);
  int versionCode=0;
  try {
    versionCode=app.getPackageManager().getPackageInfo(app.getPackageName(),0).versionCode;
  }
 catch (  NameNotFoundException e) {
    e.printStackTrace();
  }
  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);
}