nus-yam/ex-repair huggingface dataset:
Program: 86223
Project: 86223
Buggy source:
protected SearchRequestResult executeSearch(List<SearchQuery> query,int pageIndex) throws IOException, OpacErrorException, JSONException {
  final String searchUrl;
  if (!initialised) {
    start();
  }
  try {
    searchUrl=buildSearchUrl(query,pageIndex);
  }
 catch (  URISyntaxException e) {
    throw new RuntimeException(e);
  }
  final String html=httpGet(searchUrl,getDefaultEncoding());
  final Document doc=Jsoup.parse(html);
  final String navigation=doc.select("String_Node_Str").first().text();
  final int totalResults=parseTotalResults(navigation);
  final Element ul=doc.select("String_Node_Str").first();
  final List<SearchResult> results=new ArrayList<>();
  for (  final Element li : ul.children()) {
    final SearchResult result=new SearchResult();
    final Element title=li.select("String_Node_Str").first();
    result.setId(getQueryParamsFirst(title.attr("String_Node_Str")).get("String_Node_Str"));
    result.setInnerhtml(title.text() + "String_Node_Str" + title.parent().nextElementSibling().text());
    result.setNr(results.size());
    result.setPage(pageIndex);
    result.setType(MEDIA_TYPES.get(li.select("String_Node_Str").first().text()));
    result.setCover(getCover(li));
    final String statusImg=li.select("String_Node_Str").attr("String_Node_Str");
    result.setStatus(statusImg.contains("String_Node_Str") ? SearchResult.Status.GREEN : statusImg.contains("String_Node_Str") ? SearchResult.Status.RED : null);
    results.add(result);
  }
  return new SearchRequestResult(results,totalResults,pageIndex);
}

Fixed version (ground truth):
protected SearchRequestResult executeSearch(List<SearchQuery> query,int pageIndex) throws IOException, OpacErrorException, JSONException {
  final String searchUrl;
  if (!initialised) {
    start();
  }
  try {
    searchUrl=buildSearchUrl(query,pageIndex);
  }
 catch (  URISyntaxException e) {
    throw new RuntimeException(e);
  }
  final String html=httpGet(searchUrl,getDefaultEncoding());
  final Document doc=Jsoup.parse(html);
  final Element navigation=doc.select("String_Node_Str").first();
  final int totalResults=navigation != null ? parseTotalResults(navigation.text()) : 0;
  final Element ul=doc.select("String_Node_Str").first();
  final List<SearchResult> results=new ArrayList<>();
  for (  final Element li : ul.children()) {
    final SearchResult result=new SearchResult();
    final Element title=li.select("String_Node_Str").first();
    result.setId(getQueryParamsFirst(title.attr("String_Node_Str")).get("String_Node_Str"));
    result.setInnerhtml(title.text() + "String_Node_Str" + title.parent().nextElementSibling().text());
    result.setNr(results.size());
    result.setPage(pageIndex);
    result.setType(MEDIA_TYPES.get(li.select("String_Node_Str").text()));
    result.setCover(getCover(li));
    final String statusImg=li.select("String_Node_Str").attr("String_Node_Str");
    result.setStatus(statusImg.contains("String_Node_Str") ? SearchResult.Status.GREEN : statusImg.contains("String_Node_Str") ? SearchResult.Status.RED : null);
    results.add(result);
  }
  return new SearchRequestResult(results,totalResults,pageIndex);
}
Program: 86224
Project: 86224
Buggy source:
protected void addAdvancedSearchFields(List<SearchField> fields) throws IOException, JSONException {
  final String html=httpGet(getApiUrl() + "String_Node_Str",getDefaultEncoding());
  final Document doc=Jsoup.parse(html);
  final Elements options=doc.select("String_Node_Str").first().select("String_Node_Str");
  for (  final Element option : options) {
    final SearchField field;
    if (SEARCH_FIELDS_FOR_DROPDOWN.contains(option.val())) {
      field=new DropdownSearchField();
      addDropdownValuesForField(((DropdownSearchField)field),option.val());
    }
 else {
      field=new TextSearchField();
    }
    field.setDisplayName(option.text());
    field.setId(option.val());
    field.setData(new JSONObject());
    field.getData().put("String_Node_Str",field.getDisplayName());
    fields.add(field);
  }
}

Fixed version (ground truth):
protected void addAdvancedSearchFields(List<SearchField> fields) throws IOException, JSONException {
  final String html=httpGet(getApiUrl() + "String_Node_Str",getDefaultEncoding());
  final Document doc=Jsoup.parse(html);
  final Elements options=doc.select("String_Node_Str").first().select("String_Node_Str");
  for (  final Element option : options) {
    final SearchField field;
    if (SEARCH_FIELDS_FOR_DROPDOWN.contains(option.val())) {
      field=new DropdownSearchField();
      addDropdownValuesForField(((DropdownSearchField)field),option.val());
    }
 else {
      field=new TextSearchField();
      ((TextSearchField)field).setHint("String_Node_Str");
    }
    field.setDisplayName(option.text());
    field.setId(option.val());
    field.setData(new JSONObject());
    field.getData().put("String_Node_Str",field.getId());
    fields.add(field);
  }
}
Program: 86225
Project: 86225
Buggy source:
protected void addDropdownValuesForField(DropdownSearchField field,String id) throws IOException, JSONException {
  final String url=opac_url + "String_Node_Str" + id;
  final String json=httpGet(url,getDefaultEncoding());
  final JSONArray array=new JSONArray(json);
  for (int i=0; i < array.length(); i++) {
    final JSONObject obj=array.getJSONObject(i);
    field.addDropdownValue(obj.getString("String_Node_Str"),obj.getString("String_Node_Str"));
  }
}

Fixed version (ground truth):
protected void addDropdownValuesForField(DropdownSearchField field,String id) throws IOException, JSONException {
  field.addDropdownValue("String_Node_Str","String_Node_Str");
  final String url=opac_url + "String_Node_Str" + id;
  final String json=httpGet(url,getDefaultEncoding());
  final JSONArray array=new JSONArray(json);
  for (int i=0; i < array.length(); i++) {
    final JSONObject obj=array.getJSONObject(i);
    field.addDropdownValue(obj.getString("String_Node_Str"),obj.getString("String_Node_Str"));
  }
}
Program: 86226
Project: 86226
Buggy source:
protected void addSortingSearchFields(List<SearchField> fields) throws IOException, JSONException {
  final String html=httpGet(getApiUrl() + "String_Node_Str",getDefaultEncoding());
  final Document doc=Jsoup.parse(html);
  for (int i=0; i < 3; i++) {
    final Element tr=doc.select("String_Node_Str" + i).first();
    final DropdownSearchField field=new DropdownSearchField();
    field.setId("String_Node_Str" + i);
    field.setDisplayName(tr.select("String_Node_Str").first().text());
    field.setAdvanced(true);
    for (    final Element option : tr.select("String_Node_Str")) {
      field.addDropdownValue(option.attr("String_Node_Str"),option.text());
    }
    fields.add(field);
  }
}

Fixed version (ground truth):
protected void addSortingSearchFields(List<SearchField> fields) throws IOException, JSONException {
  final String html=httpGet(getApiUrl() + "String_Node_Str",getDefaultEncoding());
  final Document doc=Jsoup.parse(html);
  for (int i=0; i < 3; i++) {
    final Element tr=doc.select("String_Node_Str" + i).first();
    final DropdownSearchField field=new DropdownSearchField();
    field.setMeaning(SearchField.Meaning.ORDER);
    field.setId("String_Node_Str" + i);
    field.setDisplayName(tr.select("String_Node_Str").first().text());
    field.addDropdownValue("String_Node_Str","String_Node_Str");
    for (    final Element option : tr.select("String_Node_Str")) {
      if (option.hasAttr("String_Node_Str")) {
        field.addDropdownValue(0,option.attr("String_Node_Str"),option.text());
      }
 else {
        field.addDropdownValue(option.attr("String_Node_Str"),option.text());
      }
    }
    fields.add(field);
  }
}
Program: 86227
Project: 86227
Buggy source:
static int parseTotalResults(final String navigation){
  final Matcher matcher=Pattern.compile("String_Node_Str").matcher(navigation);
  if (matcher.find()) {
    final String num1=matcher.group("String_Node_Str");
    return Integer.parseInt(num1 != null ? num1 : matcher.group("String_Node_Str"));
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
static int parseTotalResults(final String navigation){
  final Matcher matcher=Pattern.compile("String_Node_Str").matcher(navigation);
  if (matcher.find()) {
    final String num1=matcher.group(2);
    return Integer.parseInt(num1 != null ? num1 : matcher.group(3));
  }
 else {
    return 0;
  }
}
Program: 86228
Project: 86228
Buggy source:
protected String buildSearchUrl(final List<SearchQuery> query,final int page) throws IOException, JSONException, URISyntaxException {
  final URIBuilder builder=new URIBuilder(getApiUrl());
  if (query.size() == 1 && "String_Node_Str".equals(query.get(0).getSearchField().getId())) {
    builder.setParameter("String_Node_Str","String_Node_Str");
    builder.setParameter(query.get(0).getKey(),query.get(0).getValue());
  }
 else {
    int i=0;
    for (    SearchQuery q : query) {
      builder.setParameter("String_Node_Str" + i,q.getKey());
      builder.setParameter("String_Node_Str" + i,q.getValue());
      if (i > 0) {
        builder.setParameter("String_Node_Str" + i,"String_Node_Str");
      }
      i++;
    }
    builder.setParameter("String_Node_Str","String_Node_Str");
    builder.setParameter("String_Node_Str",String.valueOf(i));
  }
  builder.setParameter("String_Node_Str",String.valueOf(page));
  builder.setParameter("String_Node_Str","String_Node_Str");
  return builder.build().toString();
}

Fixed version (ground truth):
protected String buildSearchUrl(final List<SearchQuery> query,final int page) throws IOException, JSONException, URISyntaxException {
  final URIBuilder builder=new URIBuilder(getApiUrl());
  final List<SearchQuery> nonEmptyQuery=new ArrayList<>();
  for (  SearchQuery q : query) {
    if (!q.getValue().isEmpty()) {
      nonEmptyQuery.add(q);
    }
  }
  if (nonEmptyQuery.size() == 1 && "String_Node_Str".equals(nonEmptyQuery.get(0).getSearchField().getId())) {
    builder.setParameter("String_Node_Str","String_Node_Str");
    builder.setParameter(nonEmptyQuery.get(0).getKey(),nonEmptyQuery.get(0).getValue());
  }
 else {
    int i=0;
    for (    SearchQuery q : nonEmptyQuery) {
      String key=q.getKey();
      String value=q.getValue();
      if ("String_Node_Str".equals(key)) {
        key="String_Node_Str";
        value="String_Node_Str" + value + "String_Node_Str";
      }
      builder.setParameter("String_Node_Str" + i,key);
      builder.setParameter("String_Node_Str" + i,value);
      if (i > 0) {
        builder.setParameter("String_Node_Str" + i,"String_Node_Str");
      }
      i++;
    }
    builder.setParameter("String_Node_Str","String_Node_Str");
    builder.setParameter("String_Node_Str",String.valueOf(i));
  }
  builder.setParameter("String_Node_Str",String.valueOf(page));
  builder.setParameter("String_Node_Str","String_Node_Str");
  return builder.build().toString();
}
Program: 86229
Project: 86229
Buggy source:
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}
Program: 86232
Project: 86232
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  if (interceptor != null)   interceptor.onCollapseAnimationEnd();
  mainCard.setVisibility(View.VISIBLE);
  upperCard.setVisibility(View.GONE);
  lowerCard.setVisibility(View.GONE);
  expandedCard.clearAnimation();
  expandedCard.setVisibility(View.GONE);
  llUpper.removeAllViews();
  llLower.removeAllViews();
  expandedCard.removeAllViews();
  expandedPosition=-1;
  unexpandedHeight=0;
  expandedTranslationY=0;
  lowerTranslationY=0;
  heightDifference=0;
  if (listener != null)   listener.onComplete();
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  resetViews();
  if (listener != null)   listener.onComplete();
}
Program: 86235
Project: 86235
Buggy source:
private void showCoverView(boolean b){
  coverWrapper.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientBottom.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientTop.setVisibility(b ? View.VISIBLE : View.GONE);
  RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
  if (b) {
    toolbar.setBackgroundResource(R.color.transparent);
    ViewCompat.setElevation(toolbar,0);
    llDetails.setPadding(llDetails.getPaddingLeft(),0,llDetails.getPaddingRight(),llDetails.getPaddingBottom());
    params.addRule(RelativeLayout.BELOW,R.id.coverWrapper);
  }
 else {
    toolbar.setBackgroundResource(getToolbarBackgroundColor());
    ViewCompat.setElevation(toolbar,TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,4f,getResources().getDisplayMetrics()));
    params.addRule(RelativeLayout.BELOW,R.id.toolbar);
  }
  detailsLayout.setLayoutParams(params);
}

Fixed version (ground truth):
private void showCoverView(boolean b){
  if (getActivity() == null) {
    return;
  }
  coverWrapper.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientBottom.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientTop.setVisibility(b ? View.VISIBLE : View.GONE);
  RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
  if (b) {
    toolbar.setBackgroundResource(R.color.transparent);
    ViewCompat.setElevation(toolbar,0);
    llDetails.setPadding(llDetails.getPaddingLeft(),0,llDetails.getPaddingRight(),llDetails.getPaddingBottom());
    params.addRule(RelativeLayout.BELOW,R.id.coverWrapper);
  }
 else {
    toolbar.setBackgroundResource(getToolbarBackgroundColor());
    ViewCompat.setElevation(toolbar,TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,4f,getResources().getDisplayMetrics()));
    params.addRule(RelativeLayout.BELOW,R.id.toolbar);
  }
  detailsLayout.setLayoutParams(params);
}
Program: 86238
Project: 86238
Buggy source:
private void showCoverView(boolean b){
  ivCover.setVisibility(b ? View.VISIBLE : View.GONE);
  tvTitel.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientBottom.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientTop.setVisibility(b ? View.VISIBLE : View.GONE);
  RelativeLayout.LayoutParams params=((RelativeLayout.LayoutParams)detailsLayout.getLayoutParams());
  params.removeRule(RelativeLayout.BELOW);
  if (b) {
    toolbar.setBackgroundResource(R.color.transparent);
    ViewCompat.setElevation(toolbar,0);
    llDetails.setPadding(llDetails.getPaddingLeft(),0,llDetails.getPaddingRight(),llDetails.getPaddingBottom());
    params.addRule(RelativeLayout.BELOW,R.id.ivCover);
  }
 else {
    toolbar.setBackgroundResource(getToolbarBackgroundColor());
    ViewCompat.setElevation(toolbar,TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,4f,getResources().getDisplayMetrics()));
    params.addRule(RelativeLayout.BELOW,R.id.toolbar);
  }
}

Fixed version (ground truth):
private void showCoverView(boolean b){
  ivCover.setVisibility(b ? View.VISIBLE : View.GONE);
  tvTitel.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientBottom.setVisibility(b ? View.VISIBLE : View.GONE);
  gradientTop.setVisibility(b ? View.VISIBLE : View.GONE);
  RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
  if (b) {
    toolbar.setBackgroundResource(R.color.transparent);
    ViewCompat.setElevation(toolbar,0);
    llDetails.setPadding(llDetails.getPaddingLeft(),0,llDetails.getPaddingRight(),llDetails.getPaddingBottom());
    params.addRule(RelativeLayout.BELOW,R.id.ivCover);
  }
 else {
    toolbar.setBackgroundResource(getToolbarBackgroundColor());
    ViewCompat.setElevation(toolbar,TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,4f,getResources().getDisplayMetrics()));
    params.addRule(RelativeLayout.BELOW,R.id.toolbar);
  }
  detailsLayout.setLayoutParams(params);
}
Program: 86241
Project: 86241
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  if (getArguments().containsKey(ARG_ITEM_ID) || getArguments().containsKey(ARG_ITEM_NR)) {
    load(getArguments().getInt(ARG_ITEM_NR),getArguments().getString(ARG_ITEM_ID));
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
}
Program: 86244
Project: 86244
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  if (item != null) {
    display();
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  if (item != null) {
    display();
  }
 else   if (getArguments().containsKey(ARG_ITEM_ID) || getArguments().containsKey(ARG_ITEM_NR)) {
    load(getArguments().getInt(ARG_ITEM_NR),getArguments().getString(ARG_ITEM_ID));
  }
}
Program: 86245
Project: 86245
Buggy source:
private void fixTitle(){
  if (getItem().getCoverBitmap() != null) {
    fixTitleWidth();
    tvTitel.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
      @Override public void onGlobalLayout(){
        tvTitel.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        if (tvTitel.getLayout() != null && tvTitel.getLayout().getLineCount() > 1) {
          toolbar.getLayoutParams().height=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics());
          toolbar.getParent().requestLayout();
        }
      }
    }
);
  }
 else {
    toolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
      @Override public void onGlobalLayout(){
        toolbar.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        if (toolbar.isTitleTruncated()) {
          toolbar.getLayoutParams().height=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics());
          TextView titleTextView=findTitleTextView(toolbar);
          titleTextView.setSingleLine(false);
          fixEllipsize(titleTextView);
          toolbar.getParent().requestLayout();
        }
      }
    }
);
  }
  onScrollChanged(0,0);
}

Fixed version (ground truth):
private void fixTitle(){
  if (getItem().getCoverBitmap() != null || getArguments().containsKey(ARG_ITEM_COVER_BITMAP)) {
    fixTitleWidth();
    tvTitel.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
      @Override public void onGlobalLayout(){
        tvTitel.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        if (tvTitel.getLayout() != null && tvTitel.getLayout().getLineCount() > 1) {
          toolbar.getLayoutParams().height=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics());
          toolbar.getParent().requestLayout();
        }
      }
    }
);
  }
 else {
    toolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
      @Override public void onGlobalLayout(){
        toolbar.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        if (toolbar.isTitleTruncated()) {
          toolbar.getLayoutParams().height=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics());
          TextView titleTextView=findTitleTextView(toolbar);
          titleTextView.setSingleLine(false);
          fixEllipsize(titleTextView);
          toolbar.getParent().requestLayout();
        }
      }
    }
);
  }
  onScrollChanged(0,0);
}
Program: 86246
Project: 86246
Buggy source:
/** 
 * Get all languages supported by this library. This will be a Set of language codes defined in ISO-639-1 (two-letter codes in lower case, see <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">this list</a>). We don't need to use this function in the app because the API will automatically fall back if the language set is not supported, but it is used in the MeaningDetector tool to get search fields for all supported languages. This function may use blocking network operations and may return null if the API doesn't support different languages.
 * @throws OpacErrorException
 * @throws IOException
 */
public Set<String> getSupportedLanguages() throws IOException ;

Fixed version (ground truth):
/** 
 * Get all languages supported by this library. This will be a Set of language codes defined in ISO-639-1 (two-letter codes in lower case, see <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">this list</a>). We don't need to use this function in the app because the API will automatically fall back if the language set is not supported, but it is used in the MeaningDetector tool to get search fields for all supported languages. This function may use blocking network operations and may return null if the API doesn't support different languages.
 * @throws IOException
 */
public Set<String> getSupportedLanguages() throws IOException ;
Program: 86248
Project: 86248
Buggy source:
/** 
 * Set a warning which is shown to the user above the account data in a yellow bar.
 * @param warning
 */
public void setWarning(String warning){
  this.warning=warning;
}

Fixed version (ground truth):
/** 
 * Set a warning which is shown to the user above the account data in a yellow bar.
 * @param warning The warning message
 */
public void setWarning(String warning){
  this.warning=warning;
}
Program: 86249
Project: 86249
Buggy source:
public static DefaultHttpClient getNewHttpClient(boolean customssl){
  DefaultHttpClient hc=null;
  if (customssl) {
    try {
      if (trustStore == null) {
        trustStore=KeyStore.getInstance("String_Node_Str");
        final InputStream in=OpacClient.context.getResources().openRawResource(R.raw.ssl_trust_store);
        try {
          trustStore.load(in,"String_Node_Str".toCharArray());
        }
  finally {
          in.close();
        }
      }
      SSLSocketFactory sf=new AdditionalKeyStoresSSLSocketFactory(trustStore);
      HttpParams params=new BasicHttpParams();
      HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1);
      HttpProtocolParams.setContentCharset(params,HTTP.UTF_8);
      SchemeRegistry registry=new SchemeRegistry();
      registry.register(new Scheme("String_Node_Str",PlainSocketFactory.getSocketFactory(),80));
      registry.register(new Scheme("String_Node_Str",sf,443));
      ClientConnectionManager ccm=new ThreadSafeClientConnManager(params,registry);
      hc=new DefaultHttpClient(ccm,params);
    }
 catch (    Exception e) {
      e.printStackTrace();
      hc=new DefaultHttpClient();
    }
  }
 else {
    hc=new DefaultHttpClient();
  }
  RedirectHandler customRedirectHandler=new HTTPClient.CustomRedirectHandler();
  hc.setRedirectHandler(customRedirectHandler);
  HttpProtocolParams.setUserAgent(hc.getParams(),"String_Node_Str" + OpacClient.versionName);
  return hc;
}

Fixed version (ground truth):
public static DefaultHttpClient getNewHttpClient(boolean customssl){
  DefaultHttpClient hc=null;
  HttpParams params=new BasicHttpParams();
  HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1);
  HttpProtocolParams.setContentCharset(params,HTTP.UTF_8);
  SchemeRegistry registry=new SchemeRegistry();
  registry.register(new Scheme("String_Node_Str",PlainSocketFactory.getSocketFactory(),80));
  ClientConnectionManager ccm=new ThreadSafeClientConnManager(params,registry);
  if (customssl) {
    try {
      if (trustStore == null) {
        trustStore=KeyStore.getInstance("String_Node_Str");
        final InputStream in=OpacClient.context.getResources().openRawResource(R.raw.ssl_trust_store);
        try {
          trustStore.load(in,"String_Node_Str".toCharArray());
        }
  finally {
          in.close();
        }
      }
      SSLSocketFactory sf=new AdditionalKeyStoresSSLSocketFactory(trustStore);
      registry.register(new Scheme("String_Node_Str",sf,443));
      hc=new DefaultHttpClient(ccm,params);
    }
 catch (    Exception e) {
      e.printStackTrace();
      registry.register(new Scheme("String_Node_Str",SSLSocketFactory.getSocketFactory(),443));
      hc=new DefaultHttpClient(ccm,params);
    }
  }
 else {
    registry.register(new Scheme("String_Node_Str",SSLSocketFactory.getSocketFactory(),443));
    hc=new DefaultHttpClient(ccm,params);
  }
  RedirectHandler customRedirectHandler=new HTTPClient.CustomRedirectHandler();
  hc.setRedirectHandler(customRedirectHandler);
  HttpProtocolParams.setUserAgent(hc.getParams(),"String_Node_Str" + OpacClient.versionName);
  return hc;
}
Program: 86250
Project: 86250
Buggy source:
private ActionMenuView findActionMenuView(Toolbar toolbar){
  for (int i=0; i < toolbar.getChildCount(); i++) {
    View view=toolbar.getChildAt(i);
    if (view instanceof ActionMenuView)     return (ActionMenuView)view;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Hacky way to find the   {@link android.support.v7.widget.ActionMenuView} inside a {@link android.support.v7.widget.Toolbar}. Will return null if none is found
 * @param toolbar a Toolbar
 * @return the ActionMenuView inside this toolbar, or null if none is found
 */
private ActionMenuView findActionMenuView(Toolbar toolbar){
  for (int i=0; i < toolbar.getChildCount(); i++) {
    View view=toolbar.getChildAt(i);
    if (view instanceof ActionMenuView)     return (ActionMenuView)view;
  }
  return null;
}
Program: 86251
Project: 86251
Buggy source:
@Override public void onGlobalLayout(){
  tvTitel.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  if (tvTitel.getLayout().getLineCount() > 1) {
    toolbar.setMinimumHeight((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics()));
  }
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  toolbar.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  if (toolbar.isTitleTruncated()) {
    toolbar.getLayoutParams().height=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics());
    TextView titleTextView=findTitleTextView(toolbar);
    titleTextView.setSingleLine(false);
    fixEllipsize(titleTextView);
    toolbar.getParent().requestLayout();
  }
}
Program: 86255
Project: 86255
Buggy source:
private void fixTitle(){
  toolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      findActionMenuView(toolbar).getViewTreeObserver().removeGlobalOnLayoutListener(this);
      fixTitleWidth();
      tvTitel.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
        @Override public void onGlobalLayout(){
          tvTitel.getViewTreeObserver().removeGlobalOnLayoutListener(this);
          if (tvTitel.getLayout().getLineCount() > 1) {
            toolbar.setMinimumHeight((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics()));
          }
        }
      }
);
      onScrollChanged(0,0);
    }
  }
);
}

Fixed version (ground truth):
private void fixTitle(){
  if (getItem().getCoverBitmap() != null) {
    fixTitleWidth();
    tvTitel.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
      @Override public void onGlobalLayout(){
        tvTitel.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        if (tvTitel.getLayout().getLineCount() > 1) {
          toolbar.getLayoutParams().height=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics());
          toolbar.getParent().requestLayout();
        }
      }
    }
);
  }
 else {
    toolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
      @Override public void onGlobalLayout(){
        toolbar.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        if (toolbar.isTitleTruncated()) {
          toolbar.getLayoutParams().height=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,84f,getResources().getDisplayMetrics());
          TextView titleTextView=findTitleTextView(toolbar);
          titleTextView.setSingleLine(false);
          fixEllipsize(titleTextView);
          toolbar.getParent().requestLayout();
        }
      }
    }
);
  }
  onScrollChanged(0,0);
}
Program: 86258
Project: 86258
Buggy source:
public void showConnectivityError(){
  ProgressBar progress=(ProgressBar)view.findViewById(R.id.progress);
  final FrameLayout errorView=(FrameLayout)view.findViewById(R.id.error_view);
  errorView.removeAllViews();
  View connError=getActivity().getLayoutInflater().inflate(R.layout.error_connectivity,errorView);
  ((Button)connError.findViewById(R.id.btRetry)).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      errorView.removeAllViews();
      reload();
    }
  }
);
  progress.startAnimation(AnimationUtils.loadAnimation(getActivity(),android.R.anim.fade_out));
  connError.startAnimation(AnimationUtils.loadAnimation(getActivity(),android.R.anim.fade_in));
  progress.setVisibility(View.GONE);
  connError.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
public void showConnectivityError(){
  ProgressBar progress=(ProgressBar)view.findViewById(R.id.progress);
  final FrameLayout errorView=(FrameLayout)view.findViewById(R.id.error_view);
  errorView.removeAllViews();
  View connError=getActivity().getLayoutInflater().inflate(R.layout.error_connectivity,errorView);
  ((Button)connError.findViewById(R.id.btRetry)).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      errorView.removeAllViews();
      reload();
    }
  }
);
  progress.startAnimation(AnimationUtils.loadAnimation(getActivity(),android.R.anim.fade_out));
  scrollView.startAnimation(AnimationUtils.loadAnimation(getActivity(),android.R.anim.fade_out));
  connError.startAnimation(AnimationUtils.loadAnimation(getActivity(),android.R.anim.fade_in));
  progress.setVisibility(View.GONE);
  scrollView.setVisibility(View.GONE);
  connError.setVisibility(View.VISIBLE);
}
Program: 86260
Project: 86260
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(android.view.Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  setContentView(getContentView());
  app=(OpacClient)getApplication();
  aData=new AccountDataSource(this);
  toolbar=(Toolbar)findViewById(R.id.toolbar);
  if (toolbar != null)   setSupportActionBar(toolbar);
  fab=(FloatingActionButton)findViewById(R.id.search_fab);
  setupDrawer();
  if (savedInstanceState != null) {
    setTwoPane(savedInstanceState.getBoolean("String_Node_Str"));
    setFabVisible(savedInstanceState.getBoolean("String_Node_Str"));
    if (savedInstanceState.containsKey("String_Node_Str")) {
      setTitle(savedInstanceState.getCharSequence("String_Node_Str"));
    }
    if (savedInstanceState.containsKey("String_Node_Str")) {
      fragment=(Fragment)getSupportFragmentManager().getFragment(savedInstanceState,"String_Node_Str");
      getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,fragment).commit();
    }
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(android.view.Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  setContentView(getContentView());
  app=(OpacClient)getApplication();
  aData=new AccountDataSource(this);
  toolbar=(Toolbar)findViewById(R.id.toolbar);
  if (toolbar != null)   setSupportActionBar(toolbar);
  fab=(FloatingActionButton)findViewById(R.id.search_fab);
  setupDrawer();
  if (savedInstanceState != null) {
    setTwoPane(savedInstanceState.getBoolean("String_Node_Str"));
    setFabVisible(savedInstanceState.getBoolean("String_Node_Str"));
    selectedItemTag=savedInstanceState.getString("String_Node_Str");
    setFabOnClickListener(selectedItemTag);
    if (savedInstanceState.containsKey("String_Node_Str")) {
      setTitle(savedInstanceState.getCharSequence("String_Node_Str"));
    }
    if (savedInstanceState.containsKey("String_Node_Str")) {
      fragment=(Fragment)getSupportFragmentManager().getFragment(savedInstanceState,"String_Node_Str");
      getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,fragment).commit();
    }
  }
}
Program: 86262
Project: 86262
Buggy source:
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putBoolean("String_Node_Str",twoPane);
  outState.putBoolean("String_Node_Str",fabVisible);
  if (fragment != null)   getSupportFragmentManager().putFragment(outState,"String_Node_Str",fragment);
  if (mTitle != null)   outState.putCharSequence("String_Node_Str",mTitle);
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putBoolean("String_Node_Str",twoPane);
  outState.putBoolean("String_Node_Str",fabVisible);
  outState.putString("String_Node_Str",selectedItemTag);
  if (fragment != null)   getSupportFragmentManager().putFragment(outState,"String_Node_Str",fragment);
  if (mTitle != null)   outState.putCharSequence("String_Node_Str",mTitle);
}
Program: 86263
Project: 86263
Buggy source:
protected void setFabVisible(boolean visible,View.OnClickListener onClickListener){
  fabVisible=visible;
  if (isTablet()) {
    fab.setVisibility(visible ? View.VISIBLE : View.GONE);
    if (visible) {
      fab.setOnClickListener(onClickListener);
      DisplayMetrics displayMetrics=getResources().getDisplayMetrics();
      float density=getResources().getDisplayMetrics().density;
      float dpWidth=displayMetrics.widthPixels / density;
      RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(Math.round(72 * density),Math.round(72 * density));
      if (dpWidth >= 864) {
        params.addRule(RelativeLayout.BELOW,R.id.toolbar);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.setMargins(0,Math.round(-36 * density),Math.round(36 * density),0);
        ViewCompat.setElevation(fab,4 * density);
      }
 else {
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        params.setMargins(0,0,Math.round(36 * density),Math.round(36 * density));
        ViewCompat.setElevation(fab,12 * density);
      }
      fab.setLayoutParams(params);
    }
 else {
      fab.setOnClickListener(null);
    }
  }
}

Fixed version (ground truth):
protected void setFabVisible(boolean visible){
  fabVisible=visible;
  if (isTablet()) {
    fab.setVisibility(visible ? View.VISIBLE : View.GONE);
    if (visible) {
      DisplayMetrics displayMetrics=getResources().getDisplayMetrics();
      float density=getResources().getDisplayMetrics().density;
      float dpWidth=displayMetrics.widthPixels / density;
      RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(Math.round(72 * density),Math.round(72 * density));
      if (dpWidth >= 864) {
        params.addRule(RelativeLayout.BELOW,R.id.toolbar);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.setMargins(0,Math.round(-36 * density),Math.round(36 * density),0);
        ViewCompat.setElevation(fab,4 * density);
      }
 else {
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        params.setMargins(0,0,Math.round(36 * density),Math.round(36 * density));
        ViewCompat.setElevation(fab,12 * density);
      }
      fab.setLayoutParams(params);
    }
  }
}
Program: 86265
Project: 86265
Buggy source:
@Override protected Exception doInBackground(Account... params){
  try {
    OpacApi api=((OpacClient)getApplication()).getNewApi(lib);
    api.checkAccountData(account);
  }
 catch (  IOException e) {
    return e;
  }
catch (  JSONException e) {
    return e;
  }
catch (  OpacErrorException e) {
    return e;
  }
  return null;
}

Fixed version (ground truth):
@Override protected Exception doInBackground(Account... params){
  try {
    OpacApi api=((OpacClient)getApplication()).getNewApi(lib);
    api.start();
    api.checkAccountData(account);
  }
 catch (  IOException e) {
    return e;
  }
catch (  JSONException e) {
    return e;
  }
catch (  OpacErrorException e) {
    return e;
  }
  return null;
}
Program: 86267
Project: 86267
Buggy source:
@Override public void onResume(){
  super.onResume();
  accountSelected(account);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  account=app.getAccount();
  accountSelected(account);
}
Program: 86268
Project: 86268
Buggy source:
protected void parse_reslist(List<Map<String,String>> medien,Document doc,int offset) throws ClientProtocolException, IOException {
  Elements copytrs=doc.select("String_Node_Str").first().select("String_Node_Str");
  doc.setBaseUri(opac_url);
  int trs=copytrs.size();
  if (trs < 2)   return;
  assert(trs > 0);
  for (int i=1; i < trs; i++) {
    Element tr=copytrs.get(i);
    Map<String,String> e=new HashMap<String,String>();
    e.put(AccountData.KEY_RESERVATION_TITLE,tr.child(0).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_RESERVATION_AUTHOR,tr.child(1).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_RESERVATION_READY,tr.child(4).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_RESERVATION_CANCEL,tr.select("String_Node_Str").last().attr("String_Node_Str"));
    medien.add(e);
  }
  assert(medien.size() == trs - 1);
}

Fixed version (ground truth):
protected void parse_reslist(List<Map<String,String>> medien,Document doc,int offset) throws ClientProtocolException, IOException {
  Elements copytrs=doc.select("String_Node_Str").first().select("String_Node_Str");
  doc.setBaseUri(opac_url);
  int trs=copytrs.size();
  if (trs < 2)   return;
  assert(trs > 0);
  for (int i=1; i < trs; i++) {
    Element tr=copytrs.get(i);
    Map<String,String> e=new HashMap<String,String>();
    e.put(AccountData.KEY_RESERVATION_TITLE,tr.child(0).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_RESERVATION_AUTHOR,tr.child(1).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_RESERVATION_READY,tr.child(4).text().trim().replace("String_Node_Str","String_Node_Str"));
    if (tr.select("String_Node_Str").size() > 0)     e.put(AccountData.KEY_RESERVATION_CANCEL,tr.select("String_Node_Str").last().attr("String_Node_Str"));
    medien.add(e);
  }
  assert(medien.size() == trs - 1);
}
Program: 86271
Project: 86271
Buggy source:
public List<SearchQuery> saveSearchQuery(){
  List<SearchQuery> query=new ArrayList<SearchQuery>();
  for (  SearchField field : fields) {
    ViewGroup v=(ViewGroup)view.findViewWithTag(field.getId());
    if (field instanceof TextSearchField) {
      EditText text;
      if (((TextSearchField)field).isFreeSearch()) {
        text=(EditText)view.findViewById(R.id.etSimpleSearch);
      }
 else {
        text=(EditText)v.findViewById(R.id.edittext);
      }
      query.add(new SearchQuery(field,text.getEditableText().toString()));
    }
 else     if (field instanceof BarcodeSearchField) {
      EditText text=(EditText)v.findViewById(R.id.edittext);
      query.add(new SearchQuery(field,text.getEditableText().toString()));
    }
 else     if (field instanceof DropdownSearchField) {
      Spinner spinner=(Spinner)v.findViewById(R.id.spinner);
      String key=((DropdownSearchField)field).getDropdownValues().get(spinner.getSelectedItemPosition()).get("String_Node_Str");
      if (!key.equals("String_Node_Str"))       query.add(new SearchQuery(field,key));
    }
 else     if (field instanceof CheckboxSearchField) {
      CheckBox checkbox=(CheckBox)v.findViewById(R.id.checkbox);
      query.add(new SearchQuery(field,String.valueOf(checkbox.isChecked())));
    }
  }
  return query;
}

Fixed version (ground truth):
public List<SearchQuery> saveSearchQuery(){
  List<SearchQuery> query=new ArrayList<SearchQuery>();
  for (  SearchField field : fields) {
    ViewGroup v=(ViewGroup)view.findViewWithTag(field.getId());
    if (field instanceof TextSearchField) {
      EditText text;
      if (((TextSearchField)field).isFreeSearch()) {
        text=(EditText)view.findViewById(R.id.etSimpleSearch);
      }
 else {
        text=(EditText)v.findViewById(R.id.edittext);
      }
      query.add(new SearchQuery(field,text.getEditableText().toString()));
    }
 else     if (field instanceof BarcodeSearchField) {
      EditText text=(EditText)v.findViewById(R.id.edittext);
      query.add(new SearchQuery(field,text.getEditableText().toString()));
    }
 else     if (field instanceof DropdownSearchField) {
      Spinner spinner=(Spinner)v.findViewById(R.id.spinner);
      if (spinner.getSelectedItemPosition() != -1) {
        String key=((DropdownSearchField)field).getDropdownValues().get(spinner.getSelectedItemPosition()).get("String_Node_Str");
        if (!key.equals("String_Node_Str"))         query.add(new SearchQuery(field,key));
      }
    }
 else     if (field instanceof CheckboxSearchField) {
      CheckBox checkbox=(CheckBox)v.findViewById(R.id.checkbox);
      query.add(new SearchQuery(field,String.valueOf(checkbox.isChecked())));
    }
  }
  return query;
}
Program: 86274
Project: 86274
Buggy source:
private SearchField processMeaning(SearchField field,String meaningName){
  Meaning meaning=Meaning.valueOf(meaningName);
  if (field instanceof TextSearchField && meaning == Meaning.FREE) {
    ((TextSearchField)field).setFreeSearch(true);
    ((TextSearchField)field).setHint(field.getDisplayName());
  }
 else   if (field instanceof TextSearchField && (meaning == Meaning.BARCODE || meaning == Meaning.ISBN)) {
    field=new BarcodeSearchField(field.getId(),field.getDisplayName(),field.isAdvanced(),((TextSearchField)field).isHalfWidth(),((TextSearchField)field).getHint());
  }
 else   if (meaning == Meaning.AUDIENCE || meaning == Meaning.SYSTEM || meaning == Meaning.KEYWORD || meaning == Meaning.PUBLISHER) {
    field.setAdvanced(true);
  }
  field.setMeaning(meaning);
  return field;
}

Fixed version (ground truth):
private SearchField processMeaning(SearchField field,String meaningName){
  Meaning meaning=Meaning.valueOf(meaningName);
  if (field instanceof TextSearchField && meaning == Meaning.FREE) {
    ((TextSearchField)field).setFreeSearch(true);
    ((TextSearchField)field).setHint(field.getDisplayName());
  }
 else   if (field instanceof TextSearchField && (meaning == Meaning.BARCODE || meaning == Meaning.ISBN)) {
    JSONObject data=field.getData();
    field=new BarcodeSearchField(field.getId(),field.getDisplayName(),field.isAdvanced(),((TextSearchField)field).isHalfWidth(),((TextSearchField)field).getHint());
    field.setData(data);
  }
 else   if (meaning == Meaning.AUDIENCE || meaning == Meaning.SYSTEM || meaning == Meaning.KEYWORD || meaning == Meaning.PUBLISHER) {
    field.setAdvanced(true);
  }
  field.setMeaning(meaning);
  return field;
}
Program: 86277
Project: 86277
Buggy source:
@Override public JSONObject toJSON() throws JSONException {
  JSONObject json=super.toJSON();
  json.put("String_Node_Str","String_Node_Str");
  JSONArray values=new JSONArray();
  for (  Map<String,String> map : dropdownValues) {
    JSONObject value=new JSONObject();
    value.put("String_Node_Str",map.get("String_Node_Str"));
    value.put("String_Node_Str",map.get("String_Node_Str"));
  }
  json.put("String_Node_Str",values);
  return json;
}

Fixed version (ground truth):
@Override public JSONObject toJSON() throws JSONException {
  JSONObject json=super.toJSON();
  json.put("String_Node_Str","String_Node_Str");
  JSONArray values=new JSONArray();
  for (  Map<String,String> map : dropdownValues) {
    JSONObject value=new JSONObject();
    value.put("String_Node_Str",map.get("String_Node_Str"));
    value.put("String_Node_Str",map.get("String_Node_Str"));
    values.put(value);
  }
  json.put("String_Node_Str",values);
  return json;
}
Program: 86279
Project: 86279
Buggy source:
public Map<String,String> saveQuery(){
  Map<String,String> query=new HashMap<String,String>();
  for (  SearchField field : fields) {
    if (field.isAdvanced() && !advanced)     continue;
    ViewGroup v=(ViewGroup)view.findViewWithTag(field.getId());
    if (field instanceof TextSearchField) {
      EditText text;
      if (((TextSearchField)field).isFreeSearch()) {
        text=(EditText)view.findViewById(R.id.etSimpleSearch);
      }
 else {
        text=(EditText)v.findViewById(R.id.edittext);
      }
      query.put(field.getId(),text.getEditableText().toString());
    }
 else     if (field instanceof BarcodeSearchField) {
      EditText text=(EditText)v.findViewById(R.id.edittext);
      query.put(field.getId(),text.getEditableText().toString());
    }
 else     if (field instanceof DropdownSearchField) {
      Spinner spinner=(Spinner)v.findViewById(R.id.spinner);
      query.put(field.getId(),((DropdownSearchField)field).getDropdownValues().get(spinner.getSelectedItemPosition()).get("String_Node_Str"));
    }
 else     if (field instanceof CheckboxSearchField) {
      CheckBox checkbox=(CheckBox)v.findViewById(R.id.checkbox);
      query.put(field.getId(),String.valueOf(checkbox.isChecked()));
    }
  }
  return query;
}

Fixed version (ground truth):
public Map<String,String> saveQuery(){
  Map<String,String> query=new HashMap<String,String>();
  for (  SearchField field : fields) {
    if (field.isAdvanced() && !advanced)     continue;
    ViewGroup v=(ViewGroup)view.findViewWithTag(field.getId());
    if (field instanceof TextSearchField) {
      EditText text;
      if (((TextSearchField)field).isFreeSearch()) {
        text=(EditText)view.findViewById(R.id.etSimpleSearch);
      }
 else {
        text=(EditText)v.findViewById(R.id.edittext);
      }
      query.put(field.getId(),text.getEditableText().toString());
    }
 else     if (field instanceof BarcodeSearchField) {
      EditText text=(EditText)v.findViewById(R.id.edittext);
      query.put(field.getId(),text.getEditableText().toString());
    }
 else     if (field instanceof DropdownSearchField) {
      Spinner spinner=(Spinner)v.findViewById(R.id.spinner);
      if (spinner.getSelectedItemPosition() > 0)       query.put(field.getId(),((DropdownSearchField)field).getDropdownValues().get(spinner.getSelectedItemPosition()).get("String_Node_Str"));
    }
 else     if (field instanceof CheckboxSearchField) {
      CheckBox checkbox=(CheckBox)v.findViewById(R.id.checkbox);
      query.put(field.getId(),String.valueOf(checkbox.isChecked()));
    }
  }
  return query;
}