nus-yam/ex-repair huggingface dataset:
Program: 15415
Project: 15415
Buggy source:
/** 
 * Sets the indentation for the View
 * @param indent comment indentation number
 */
public void setIndentation(int indent){
  this.getLayoutParams().width=(mPixelsPerIndent * indent);
  this.mIndent=indent;
  this.invalidate();
}

Fixed version (ground truth):
/** 
 * Sets the indentation for the View
 * @param indent comment indentation number
 */
public void setIndentation(int indent){
  this.getLayoutParams().width=(mPixelsPerIndent * indent);
  this.mIndent=indent;
  this.invalidate();
  this.requestLayout();
}
Program: 15416
Project: 15416
Buggy source:
public void reset(RedditCommentListItem item){
  mItem=item;
  mTitleView.setText(String.format("String_Node_Str",mItem.asLoadMore().getCount()));
  mIndentView.setIndentation(mItem.getIndent());
}

Fixed version (ground truth):
public void reset(final RedditCommentListItem item){
  mItem=item;
  if (item.asLoadMore().getCount() > 0) {
    mTitleView.setText(String.format("String_Node_Str",item.asLoadMore().getCount()));
  }
 else {
    mTitleView.setText("String_Node_Str");
  }
  mIndentView.setIndentation(item.getIndent());
}
Program: 15420
Project: 15420
Buggy source:
public void onClick(DialogInterface dialog,int which){
  final String query=editText.getText().toString().toLowerCase().trim();
  final RedditURLParser.SearchPostListURL url;
  if (controller != null && controller.isSubreddit()) {
    url=RedditURLParser.SearchPostListURL.build(controller.subredditCanonicalName(),query);
  }
 else {
    url=RedditURLParser.SearchPostListURL.build(null,query);
  }
  final Intent intent=new Intent(activity,activity.getClass());
  intent.setData(url.generateJsonUri());
  activity.startActivity(intent);
}

Fixed version (ground truth):
public void onClick(DialogInterface dialog,int which){
  final String query=editText.getText().toString().toLowerCase().trim();
  final RedditURLParser.SearchPostListURL url;
  if (controller != null && controller.isSubreddit()) {
    url=RedditURLParser.SearchPostListURL.build(controller.subredditCanonicalName(),query);
  }
 else {
    url=RedditURLParser.SearchPostListURL.build(null,query);
  }
  final Intent intent=new Intent(activity,PostListingActivity.class);
  intent.setData(url.generateJsonUri());
  activity.startActivity(intent);
}
Program: 15421
Project: 15421
Buggy source:
public static void onSearchPosts(final PostListingController controller,final Activity activity){
  final AlertDialog.Builder alertBuilder=new AlertDialog.Builder(activity);
  final LinearLayout layout=(LinearLayout)activity.getLayoutInflater().inflate(R.layout.dialog_editbox);
  final EditText editText=(EditText)layout.findViewById(R.id.dialog_editbox_edittext);
  editText.requestFocus();
  alertBuilder.setView(layout);
  alertBuilder.setTitle(R.string.action_search);
  alertBuilder.setPositiveButton(R.string.action_search,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      final String query=editText.getText().toString().toLowerCase().trim();
      final RedditURLParser.SearchPostListURL url;
      if (controller != null && controller.isSubreddit()) {
        url=RedditURLParser.SearchPostListURL.build(controller.subredditCanonicalName(),query);
      }
 else {
        url=RedditURLParser.SearchPostListURL.build(null,query);
      }
      final Intent intent=new Intent(activity,activity.getClass());
      intent.setData(url.generateJsonUri());
      activity.startActivity(intent);
    }
  }
);
  alertBuilder.setNegativeButton(R.string.dialog_cancel,null);
  final AlertDialog alertDialog=alertBuilder.create();
  alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
  alertDialog.show();
}

Fixed version (ground truth):
public static void onSearchPosts(final PostListingController controller,final Activity activity){
  final AlertDialog.Builder alertBuilder=new AlertDialog.Builder(activity);
  final LinearLayout layout=(LinearLayout)activity.getLayoutInflater().inflate(R.layout.dialog_editbox);
  final EditText editText=(EditText)layout.findViewById(R.id.dialog_editbox_edittext);
  editText.requestFocus();
  alertBuilder.setView(layout);
  alertBuilder.setTitle(R.string.action_search);
  alertBuilder.setPositiveButton(R.string.action_search,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      final String query=editText.getText().toString().toLowerCase().trim();
      final RedditURLParser.SearchPostListURL url;
      if (controller != null && controller.isSubreddit()) {
        url=RedditURLParser.SearchPostListURL.build(controller.subredditCanonicalName(),query);
      }
 else {
        url=RedditURLParser.SearchPostListURL.build(null,query);
      }
      final Intent intent=new Intent(activity,PostListingActivity.class);
      intent.setData(url.generateJsonUri());
      activity.startActivity(intent);
    }
  }
);
  alertBuilder.setNegativeButton(R.string.dialog_cancel,null);
  final AlertDialog alertDialog=alertBuilder.create();
  alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
  alertDialog.show();
}
Program: 15422
Project: 15422
Buggy source:
public void onSubscribe(){
  try {
    RedditSubredditSubscriptionManager.getSingleton(getSupportActivity(),RedditAccountManager.getInstance(getSupportActivity()).getDefaultAccount()).subscribe(subreddit.getCanonicalName(),getSupportActivity());
  }
 catch (  RedditSubreddit.InvalidSubredditNameException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void onSubscribe(){
  if (postListingURL.pathType() != RedditURLParser.PathType.SubredditPostListingURL)   return;
  try {
    RedditSubredditSubscriptionManager.getSingleton(getSupportActivity(),RedditAccountManager.getInstance(getSupportActivity()).getDefaultAccount()).subscribe(RedditSubreddit.getCanonicalName(postListingURL.asSubredditPostListURL().subreddit),getSupportActivity());
  }
 catch (  RedditSubreddit.InvalidSubredditNameException e) {
    throw new RuntimeException(e);
  }
}
Program: 15425
Project: 15425
Buggy source:
@Override public boolean onCreateOptionsMenu(final Menu menu){
  final boolean postsVisible=postListingFragment != null;
  final boolean commentsVisible=commentListingFragment != null;
  final boolean postsSortable=postListingController != null && postListingController.isSortable();
  final boolean commentsSortable=commentListingController != null && commentListingController.isSortable();
  final RedditSubredditSubscriptionManager.SubredditSubscriptionState subredditSubscriptionState;
  final RedditSubredditSubscriptionManager subredditSubscriptionManager=RedditSubredditSubscriptionManager.getSingleton(this,RedditAccountManager.getInstance(this).getDefaultAccount());
  if (postsVisible && postListingController.getSubreddit().isSubscribable() && subredditSubscriptionManager.areSubscriptionsReady()) {
    try {
      subredditSubscriptionState=subredditSubscriptionManager.getSubscriptionState(postListingController.getSubreddit().getCanonicalName());
    }
 catch (    RedditSubreddit.InvalidSubredditNameException e) {
      throw new UnexpectedInternalStateException("String_Node_Str");
    }
  }
 else {
    subredditSubscriptionState=null;
  }
  OptionsMenuUtility.prepare(this,menu,isMenuShown,postsVisible,commentsVisible,postsSortable,commentsSortable,subredditSubscriptionState);
  getSupportActionBar().setHomeButtonEnabled(!isMenuShown);
  getSupportActionBar().setDisplayHomeAsUpEnabled(!isMenuShown);
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(final Menu menu){
  final boolean postsVisible=postListingFragment != null;
  final boolean commentsVisible=commentListingFragment != null;
  final boolean postsSortable=postListingController != null && postListingController.isSortable();
  final boolean commentsSortable=commentListingController != null && commentListingController.isSortable();
  final RedditAccount user=RedditAccountManager.getInstance(this).getDefaultAccount();
  final RedditSubredditSubscriptionManager.SubredditSubscriptionState subredditSubscriptionState;
  final RedditSubredditSubscriptionManager subredditSubscriptionManager=RedditSubredditSubscriptionManager.getSingleton(this,user);
  if (postsVisible && !user.isAnonymous() && postListingController.getSubreddit().isSubscribable()&& subredditSubscriptionManager.areSubscriptionsReady()) {
    try {
      subredditSubscriptionState=subredditSubscriptionManager.getSubscriptionState(postListingController.getSubreddit().getCanonicalName());
    }
 catch (    RedditSubreddit.InvalidSubredditNameException e) {
      throw new UnexpectedInternalStateException("String_Node_Str");
    }
  }
 else {
    subredditSubscriptionState=null;
  }
  OptionsMenuUtility.prepare(this,menu,isMenuShown,postsVisible,commentsVisible,postsSortable,commentsSortable,subredditSubscriptionState);
  getSupportActionBar().setHomeButtonEnabled(!isMenuShown);
  getSupportActionBar().setDisplayHomeAsUpEnabled(!isMenuShown);
  return true;
}
Program: 15426
Project: 15426
Buggy source:
@Override public boolean onCreateOptionsMenu(final Menu menu){
  final RedditSubredditSubscriptionManager.SubredditSubscriptionState subredditSubscriptionState;
  final RedditSubredditSubscriptionManager subredditSubscriptionManager=RedditSubredditSubscriptionManager.getSingleton(this,RedditAccountManager.getInstance(this).getDefaultAccount());
  if (subreddit.isSubscribable() && subredditSubscriptionManager.areSubscriptionsReady()) {
    try {
      subredditSubscriptionState=subredditSubscriptionManager.getSubscriptionState(subreddit.getCanonicalName());
    }
 catch (    RedditSubreddit.InvalidSubredditNameException e) {
      throw new UnexpectedInternalStateException("String_Node_Str");
    }
  }
 else {
    subredditSubscriptionState=null;
  }
  OptionsMenuUtility.prepare(this,menu,false,true,false,subreddit.isSortable(),false,subredditSubscriptionState);
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(final Menu menu){
  final RedditAccount user=RedditAccountManager.getInstance(this).getDefaultAccount();
  final RedditSubredditSubscriptionManager.SubredditSubscriptionState subredditSubscriptionState;
  final RedditSubredditSubscriptionManager subredditSubscriptionManager=RedditSubredditSubscriptionManager.getSingleton(this,user);
  if (!user.isAnonymous() && subreddit.isSubscribable() && subredditSubscriptionManager.areSubscriptionsReady()) {
    try {
      subredditSubscriptionState=subredditSubscriptionManager.getSubscriptionState(subreddit.getCanonicalName());
    }
 catch (    RedditSubreddit.InvalidSubredditNameException e) {
      throw new UnexpectedInternalStateException("String_Node_Str");
    }
  }
 else {
    subredditSubscriptionState=null;
  }
  OptionsMenuUtility.prepare(this,menu,false,true,false,subreddit.isSortable(),false,subredditSubscriptionState);
  return true;
}
Program: 15429
Project: 15429
Buggy source:
public void onSubscriptionsChanged(final Collection<String> subscriptions){
  RedditSubredditManager.getInstance(context,user).getSubreddits(subscriptions,TimestampBound.notOlderThan(1000 * 60 * 60* 24),new RequestResponseHandler<HashMap<String,RedditSubreddit>,SubredditRequestFailure>(){
    @Override public void onRequestFailed(    SubredditRequestFailure failureReason){
      onError(failureReason.asError(context));
    }
    @Override public void onRequestSuccess(    HashMap<String,RedditSubreddit> result,    long timeCached){
      adapter.setSubreddits(result.values());
    }
  }
);
  if (loadingView != null)   loadingView.setDone(R.string.download_done);
}

Fixed version (ground truth):
public void onSubscriptionsChanged(final Collection<String> subscriptions){
  RedditSubredditManager.getInstance(context,user).getSubreddits(subscriptions,TimestampBound.ANY,new RequestResponseHandler<HashMap<String,RedditSubreddit>,SubredditRequestFailure>(){
    @Override public void onRequestFailed(    SubredditRequestFailure failureReason){
      onError(failureReason.asError(context));
    }
    @Override public void onRequestSuccess(    HashMap<String,RedditSubreddit> result,    long timeCached){
      adapter.setSubreddits(result.values());
    }
  }
);
  if (loadingView != null)   loadingView.setDone(R.string.download_done);
}
Program: 15432
Project: 15432
Buggy source:
public MarkdownLine rejoin(MarkdownLine toAppend){
  return new MarkdownLine(src.rejoin(toAppend.src),type,spacesAtStart,toAppend.spacesAtEnd,prefixLength,level,number);
}

Fixed version (ground truth):
public MarkdownLine rejoin(MarkdownLine toAppend){
  src.arr[src.start + src.length]=' ';
  return new MarkdownLine(src.rejoin(toAppend.src),type,spacesAtStart,toAppend.spacesAtEnd,prefixLength,level,number);
}
Program: 15433
Project: 15433
Buggy source:
public static MarkdownParagraphGroup parse(final char[] raw){
  final CharArrSubstring[] rawLines=CharArrSubstring.generateFromLines(raw);
  final MarkdownLine[] lines=new MarkdownLine[rawLines.length];
  for (int i=0; i < rawLines.length; i++) {
    lines[i]=MarkdownLine.generate(rawLines[i]);
  }
  final ArrayList<MarkdownLine> mergedLines=new ArrayList<MarkdownLine>(rawLines.length);
  MarkdownLine currentLine=null;
  for (int i=0; i < lines.length; i++) {
    if (currentLine != null) {
switch (lines[i].type) {
case BULLET:
case NUMBERED:
case HEADER:
case CODE:
case HLINE:
case QUOTE:
        mergedLines.add(currentLine);
      currentLine=lines[i];
    break;
case EMPTY:
  mergedLines.add(currentLine);
currentLine=null;
break;
case TEXT:
if (i > 0) {
switch (lines[i - 1].type) {
case QUOTE:
case BULLET:
case NUMBERED:
case TEXT:
if (lines[i - 1].spacesAtEnd >= 2) {
  mergedLines.add(currentLine);
  currentLine=lines[i];
}
 else {
  currentLine=currentLine.rejoin(lines[i]);
}
break;
case CODE:
case HEADER:
case HLINE:
mergedLines.add(currentLine);
currentLine=lines[i];
break;
}
}
 else {
throw new RuntimeException("String_Node_Str");
}
break;
}
}
 else if (lines[i].type != MarkdownParagraphType.EMPTY) {
currentLine=lines[i];
}
}
if (currentLine != null) {
mergedLines.add(currentLine);
}
final MarkdownParagraph[] paragraphs=new MarkdownParagraph[mergedLines.size()];
for (int i=0; i < paragraphs.length; i++) {
paragraphs[i]=mergedLines.get(i).tokenize(i > 0 ? paragraphs[i - 1] : null);
}
return new MarkdownParagraphGroup(paragraphs);
}

Fixed version (ground truth):
public static MarkdownParagraphGroup parse(final char[] raw){
  final CharArrSubstring[] rawLines=CharArrSubstring.generateFromLines(raw);
  final MarkdownLine[] lines=new MarkdownLine[rawLines.length];
  for (int i=0; i < rawLines.length; i++) {
    lines[i]=MarkdownLine.generate(rawLines[i]);
  }
  final ArrayList<MarkdownLine> mergedLines=new ArrayList<MarkdownLine>(rawLines.length);
  MarkdownLine currentLine=null;
  for (int i=0; i < lines.length; i++) {
    if (currentLine != null) {
switch (lines[i].type) {
case BULLET:
case NUMBERED:
case HEADER:
case CODE:
case HLINE:
case QUOTE:
        mergedLines.add(currentLine);
      currentLine=lines[i];
    break;
case EMPTY:
  mergedLines.add(currentLine);
currentLine=null;
break;
case TEXT:
if (i < 1) {
throw new RuntimeException("String_Node_Str");
}
switch (lines[i - 1].type) {
case QUOTE:
case BULLET:
case NUMBERED:
case TEXT:
if (lines[i - 1].spacesAtEnd >= 2) {
mergedLines.add(currentLine);
currentLine=lines[i];
}
 else {
currentLine=currentLine.rejoin(lines[i]);
}
break;
case CODE:
case HEADER:
case HLINE:
mergedLines.add(currentLine);
currentLine=lines[i];
break;
}
break;
}
}
 else if (lines[i].type != MarkdownParagraphType.EMPTY) {
currentLine=lines[i];
}
}
if (currentLine != null) {
mergedLines.add(currentLine);
}
final MarkdownParagraph[] paragraphs=new MarkdownParagraph[mergedLines.size()];
for (int i=0; i < paragraphs.length; i++) {
paragraphs[i]=mergedLines.get(i).tokenize(i > 0 ? paragraphs[i - 1] : null);
}
return new MarkdownParagraphGroup(paragraphs);
}
Program: 15434
Project: 15434
Buggy source:
public void reset(final Activity activity,final CommentListingFragment fragment,final RedditPreparedComment comment,final ActiveTextView.OnLinkClickedListener listener){
  if (this.comment != null)   this.comment.unbind(this);
  this.comment=comment;
  comment.bind(this);
  final int paddingPixelsPerIndent=General.dpToPixels(activity,10.0f);
  leftIndent.getLayoutParams().width=paddingPixelsPerIndent * comment.indentation;
  leftDividerLine.setVisibility(comment.indentation == 0 ? GONE : VISIBLE);
  if (!comment.isCollapsed()) {
    header.setText(comment.header);
  }
 else {
    header.setText("String_Node_Str" + comment.header);
  }
  bodyHolder.removeAllViews();
  final ViewGroup commentBody=comment.getBody(activity,13.0f * fontScale,bodyCol);
  bodyHolder.addView(commentBody);
  commentBody.getLayoutParams().width=ViewGroup.LayoutParams.MATCH_PARENT;
  ((MarginLayoutParams)commentBody.getLayoutParams()).topMargin=General.dpToPixels(activity,2);
  updateVisibility(activity);
}

Fixed version (ground truth):
public void reset(final Activity activity,final CommentListingFragment fragment,final RedditPreparedComment comment,final ActiveTextView.OnLinkClickedListener listener){
  if (this.comment != null)   this.comment.unbind(this);
  this.comment=comment;
  comment.bind(this);
  final int paddingPixelsPerIndent=General.dpToPixels(activity,10.0f);
  leftIndent.getLayoutParams().width=paddingPixelsPerIndent * comment.indentation;
  leftDividerLine.setVisibility(comment.indentation == 0 ? GONE : VISIBLE);
  if (!comment.isCollapsed()) {
    header.setText(comment.header);
  }
 else {
    header.setText("String_Node_Str" + comment.header);
  }
  bodyHolder.removeAllViews();
  final ViewGroup commentBody=comment.getBody(activity,13.0f * fontScale,bodyCol);
  bodyHolder.addView(commentBody);
  commentBody.getLayoutParams().width=ViewGroup.LayoutParams.MATCH_PARENT;
  ((MarginLayoutParams)commentBody.getLayoutParams()).topMargin=General.dpToPixels(activity,1);
  updateVisibility(activity);
}
Program: 15437
Project: 15437
Buggy source:
public synchronized void cancel(){
  cancelled=true;
  if (httpGet != null)   httpGet.abort();
  queue.exterminateDownload(this);
  notifyAllOnFailure(RequestFailureType.CANCELLED,null,null,"String_Node_Str");
}

Fixed version (ground truth):
public synchronized void cancel(){
  cancelled=true;
  new Thread(){
    public void run(){
      if (httpGet != null)       httpGet.abort();
      queue.exterminateDownload(CacheDownload.this);
      notifyAllOnFailure(RequestFailureType.CANCELLED,null,null,"String_Node_Str");
    }
  }
.start();
}
Program: 15438
Project: 15438
Buggy source:
@Override public URI getUri(){
  if (!subreddit.isSortable()) {
    if (subreddit.url.contains("String_Node_Str"))     return Constants.Reddit.getUri(subreddit.url.replaceFirst("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str"));
 else     return Constants.Reddit.getUri(subreddit.url + "String_Node_Str");
  }
switch (getSort()) {
case HOT:
case NEW:
case CONTROVERSIAL:
case RISING:
    return Constants.Reddit.getUri(subreddit.url + "String_Node_Str" + getSort().name().toLowerCase()+ "String_Node_Str");
case TOP_HOUR:
case TOP_DAY:
case TOP_WEEK:
case TOP_MONTH:
case TOP_YEAR:
case TOP_ALL:
  return Constants.Reddit.getUri(subreddit.url + "String_Node_Str" + getSort().name().split("String_Node_Str")[1].toLowerCase());
}
throw new RuntimeException("String_Node_Str" + getSort().name());
}

Fixed version (ground truth):
@Override public URI getUri(){
  if (!subreddit.isSortable()) {
    if (subreddit.url.contains("String_Node_Str"))     return Constants.Reddit.getUri(subreddit.url.replaceFirst("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str"));
 else     return Constants.Reddit.getUri(subreddit.url + "String_Node_Str");
  }
switch (getSort()) {
case HOT:
case NEW:
case CONTROVERSIAL:
case RISING:
    return Constants.Reddit.getUri(subreddit.url + getSort().name().toLowerCase() + "String_Node_Str");
case TOP_HOUR:
case TOP_DAY:
case TOP_WEEK:
case TOP_MONTH:
case TOP_YEAR:
case TOP_ALL:
  return Constants.Reddit.getUri(subreddit.url + "String_Node_Str" + getSort().name().split("String_Node_Str")[1].toLowerCase());
}
throw new RuntimeException("String_Node_Str" + getSort().name());
}
Program: 15442
Project: 15442
Buggy source:
public void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  final String url=intent.getStringExtra("String_Node_Str");
  if (url == null) {
    BugReportActivity.handleGlobalError(this,"String_Node_Str");
  }
  webView=WebViewFragment.newInstance(url);
  setContentView(View.inflate(this,R.layout.main_single,null));
  getSupportFragmentManager().beginTransaction().add(R.id.main_single_frame,webView).commit();
}

Fixed version (ground truth):
public void onCreate(final Bundle savedInstanceState){
  PrefsUtility.applyTheme(this);
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  final String url=intent.getStringExtra("String_Node_Str");
  if (url == null) {
    BugReportActivity.handleGlobalError(this,"String_Node_Str");
  }
  webView=WebViewFragment.newInstance(url);
  setContentView(View.inflate(this,R.layout.main_single,null));
  getSupportFragmentManager().beginTransaction().add(R.id.main_single_frame,webView).commit();
}
Program: 15444
Project: 15444
Buggy source:
public CommentListingFragment get(final boolean force){
  return CommentListingFragment.newInstance("String_Node_Str" + postId,getUri(),session,force ? CacheRequest.DownloadType.FORCE : CacheRequest.DownloadType.IF_NECESSARY);
}

Fixed version (ground truth):
public CommentListingFragment get(final boolean force){
  if (force)   session=null;
  return CommentListingFragment.newInstance("String_Node_Str" + postId,getUri(),session,force ? CacheRequest.DownloadType.FORCE : CacheRequest.DownloadType.IF_NECESSARY);
}
Program: 15445
Project: 15445
Buggy source:
public final PostListingFragment get(final boolean force){
  return PostListingFragment.newInstance(getSubreddit(),getUri(),session,force ? CacheRequest.DownloadType.FORCE : CacheRequest.DownloadType.IF_NECESSARY);
}

Fixed version (ground truth):
public final PostListingFragment get(final boolean force){
  if (force)   session=null;
  return PostListingFragment.newInstance(getSubreddit(),getUri(),session,force ? CacheRequest.DownloadType.FORCE : CacheRequest.DownloadType.IF_NECESSARY);
}
Program: 15447
Project: 15447
Buggy source:
@Override public View onCreateView(final LayoutInflater inflater,final ViewGroup container,final Bundle savedInstanceState){
  webView=new WebViewFixed(container.getContext());
  final WebSettings settings=webView.getSettings();
  settings.setBuiltInZoomControls(true);
  settings.setJavaScriptEnabled(true);
  settings.setJavaScriptCanOpenWindowsAutomatically(false);
  settings.setUseWideViewPort(true);
  settings.setLoadWithOverviewMode(true);
  try {
    settings.setDisplayZoomControls(false);
  }
 catch (  NoSuchMethodError e) {
  }
  webView.setWebViewClient(new WebViewClient(){
    @Override public boolean shouldOverrideUrlLoading(    final WebView view,    final String url){
      webView.loadUrl(url);
      return true;
    }
  }
);
  webView.loadUrl(url);
  return webView;
}

Fixed version (ground truth):
@Override public View onCreateView(final LayoutInflater inflater,final ViewGroup container,final Bundle savedInstanceState){
  webView=new WebViewFixed(container.getContext());
  final WebSettings settings=webView.getSettings();
  settings.setBuiltInZoomControls(true);
  settings.setJavaScriptEnabled(true);
  settings.setJavaScriptCanOpenWindowsAutomatically(false);
  settings.setUseWideViewPort(true);
  settings.setLoadWithOverviewMode(true);
  try {
    settings.setDisplayZoomControls(false);
  }
 catch (  NoSuchMethodError e) {
  }
  webView.setWebViewClient(new WebViewClient(){
    @Override public boolean shouldOverrideUrlLoading(    final WebView view,    final String url){
      webView.loadUrl(url);
      return true;
    }
  }
);
  webView.setWebChromeClient(new WebChromeClient());
  webView.loadUrl(url);
  return webView;
}
Program: 15448
Project: 15448
Buggy source:
private synchronized void notifyAllOnJsonParseStarted(final JsonValue value,final long timestamp,final UUID session){
  new Thread(){
    @Override public void run(){
      android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
      initiator.notifyJsonParseStarted(value,timestamp,session,false);
    }
  }
.start();
  for (  final CacheRequest req : lateJoiners) {
    new Thread(){
      @Override public void run(){
        android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
        req.notifyJsonParseStarted(value,timestamp,session,false);
      }
    }
.start();
  }
}

Fixed version (ground truth):
private synchronized void notifyAllOnJsonParseStarted(final JsonValue value,final long timestamp,final UUID session){
  initiator.notifyJsonParseStarted(value,timestamp,session,false);
  for (  final CacheRequest req : lateJoiners) {
    req.notifyJsonParseStarted(value,timestamp,session,false);
  }
}
Program: 15449
Project: 15449
Buggy source:
public final void notifyJsonParseStarted(final JsonValue result,final long timestamp,final UUID session,final boolean fromCache){
  try {
    onJsonParseStarted(result,timestamp,session,fromCache);
  }
 catch (  Throwable t1) {
    try {
      onCallbackException(t1);
    }
 catch (    Throwable t2) {
      BugReportActivity.addGlobalError(new RRError(null,null,t1));
      BugReportActivity.handleGlobalError(context,t2);
    }
  }
}

Fixed version (ground truth):
public final void notifyJsonParseStarted(final JsonValue result,final long timestamp,final UUID session,final boolean fromCache){
  new Thread(){
    @Override public void run(){
      android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
      try {
        onJsonParseStarted(result,timestamp,session,fromCache);
      }
 catch (      Throwable t1) {
        try {
          onCallbackException(t1);
        }
 catch (        Throwable t2) {
          BugReportActivity.addGlobalError(new RRError(null,null,t1));
          BugReportActivity.handleGlobalError(context,t2);
        }
      }
    }
  }
.start();
}
Program: 15450
Project: 15450
Buggy source:
public PostListingAdapter(final ListView listViewParent,final PostListingFragment fragmentParent){
  this.listViewParent=listViewParent;
  this.fragmentParent=fragmentParent;
  postAddedHandler=new Handler(Looper.getMainLooper()){
    @Override public void handleMessage(    final Message msg){
      final RedditPreparedPost post=(RedditPreparedPost)msg.obj;
      if (!postIds.add(post.idAlone))       return;
      posts.add(post);
      if (listViewParent.getLastVisiblePosition() + 1 >= postsToReport.size()) {
        updatePosts();
      }
    }
  }
;
}

Fixed version (ground truth):
public PostListingAdapter(final ListView listViewParent,final LinearLayout outerLayout,final PostListingFragment fragmentParent){
  this.listViewParent=listViewParent;
  this.outerLayout=outerLayout;
  this.fragmentParent=fragmentParent;
  postAddedHandler=new Handler(Looper.getMainLooper()){
    @Override public void handleMessage(    final Message msg){
      final RedditPreparedPost post=(RedditPreparedPost)msg.obj;
      if (!postIds.add(post.idAlone))       return;
      posts.add(post);
      if (listViewParent.getLastVisiblePosition() + 1 >= postsToReport.size()) {
        updatePosts();
      }
    }
  }
;
}
Program: 15451
Project: 15451
Buggy source:
private void updatePosts(){
  postsToReport.clear();
  postsToReport.addAll(posts);
  notifyDataSetChanged();
}

Fixed version (ground truth):
private void updatePosts(){
  postsToReport.clear();
  postsToReport.addAll(posts);
  notifyDataSetChanged();
  listViewParent.invalidateViews();
  listViewParent.invalidate();
  listViewParent.requestLayout();
  outerLayout.invalidate();
  outerLayout.requestLayout();
}
Program: 15452
Project: 15452
Buggy source:
@Override public void handleMessage(final Message msg){
  final Context context=getSupportActivity();
switch (msg.what) {
case NOTIF_DOWNLOAD_NECESSARY:
    loadingView=new LoadingView(context,R.string.download_waiting,true,true);
  listFooterNotifications.addView(loadingView);
break;
case NOTIF_DOWNLOAD_START:
loadingView.setIndeterminate(R.string.download_connecting);
break;
case NOTIF_STARTING:
if (loadingView != null) loadingView.setIndeterminate(R.string.download_downloadstarting);
break;
case NOTIF_AGE:
final TextView cacheNotif=new TextView(context);
cacheNotif.setText(context.getString(R.string.listing_cached) + "String_Node_Str" + RRTime.formatDateTime((Long)msg.obj));
final int paddingPx=General.dpToPixels(context,6);
cacheNotif.setPadding(paddingPx,paddingPx,paddingPx,paddingPx);
cacheNotif.setTextSize(13f);
listHeaderNotifications.addView(cacheNotif);
listHeaderNotifications.requestLayout();
adapter.notifyDataSetChanged();
break;
case NOTIF_ERROR:
if (loadingView != null) loadingView.setDone(R.string.download_failed);
final RRError error=(RRError)msg.obj;
fragmentHeader.addView(new ErrorView(getSupportActivity(),error));
break;
case NOTIF_PROGRESS:
if (loadingView != null) loadingView.setProgress(R.string.download_loading,(Float)msg.obj);
break;
case NOTIF_DOWNLOAD_DONE:
if (loadingView != null) loadingView.setDoneNoAnim(R.string.download_done);
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(final Message msg){
  final Context context=getSupportActivity();
switch (msg.what) {
case NOTIF_DOWNLOAD_NECESSARY:
    loadingView=new LoadingView(context,R.string.download_waiting,true,true);
  listFooterNotifications.addView(loadingView);
break;
case NOTIF_DOWNLOAD_START:
loadingView.setIndeterminate(R.string.download_connecting);
break;
case NOTIF_STARTING:
if (loadingView != null) loadingView.setIndeterminate(R.string.download_downloadstarting);
break;
case NOTIF_AGE:
final TextView cacheNotif=new TextView(context);
cacheNotif.setText(context.getString(R.string.listing_cached) + "String_Node_Str" + RRTime.formatDateTime((Long)msg.obj));
final int paddingPx=General.dpToPixels(context,6);
cacheNotif.setPadding(paddingPx,paddingPx,paddingPx,paddingPx);
cacheNotif.setTextSize(13f);
listHeaderNotifications.addView(cacheNotif);
listHeaderNotifications.requestLayout();
adapter.notifyDataSetChanged();
break;
case NOTIF_ERROR:
{
if (loadingView != null) loadingView.setDone(R.string.download_failed);
final RRError error=(RRError)msg.obj;
fragmentHeader.addView(new ErrorView(getSupportActivity(),error));
break;
}
case NOTIF_PROGRESS:
if (loadingView != null) loadingView.setProgress(R.string.download_loading,(Float)msg.obj);
break;
case NOTIF_DOWNLOAD_DONE:
if (loadingView != null) loadingView.setDoneNoAnim(R.string.download_done);
break;
case NOTIF_ERROR_FOOTER:
{
if (loadingView != null) loadingView.setDone(R.string.download_failed);
final RRError error=(RRError)msg.obj;
listFooterNotifications.addView(new ErrorView(getSupportActivity(),error));
adapter.notifyDataSetChanged();
break;
}
}
}
Program: 15455
Project: 15455
Buggy source:
private synchronized CacheDownload getNextRedditInQueue(){
  while (redditDownloadsQueued.isEmpty()) {
    try {
      wait();
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  CacheDownload next=null;
  RequestIdentifier nextKey=null;
  for (  final HashMap.Entry<RequestIdentifier,CacheDownload> entry : redditDownloadsQueued.entrySet()) {
    if (next == null || entry.getValue().isHigherPriorityThan(next)) {
      next=entry.getValue();
      nextKey=entry.getKey();
    }
  }
  redditDownloadsQueued.remove(nextKey);
  downloadsInProgress.put(nextKey,next);
  return next;
}

Fixed version (ground truth):
private synchronized CacheDownload getNextRedditInQueue(){
  while (redditDownloadsQueued.isEmpty()) {
    try {
      wait();
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  CacheDownload next=null;
  RequestIdentifier nextKey=null;
  for (  final Map.Entry<RequestIdentifier,CacheDownload> entry : redditDownloadsQueued.entrySet()) {
    if (next == null || entry.getValue().isHigherPriorityThan(next)) {
      next=entry.getValue();
      nextKey=entry.getKey();
    }
  }
  redditDownloadsQueued.remove(nextKey);
  downloadsInProgress.put(nextKey,next);
  return next;
}
Program: 15456
Project: 15456
Buggy source:
public synchronized CacheDownload getNextInQueue(){
  while (downloadsQueued.isEmpty()) {
    try {
      wait();
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  CacheDownload next=null;
  RequestIdentifier nextKey=null;
  for (  final HashMap.Entry<RequestIdentifier,CacheDownload> entry : downloadsQueued.entrySet()) {
    if (next == null || entry.getValue().isHigherPriorityThan(next)) {
      next=entry.getValue();
      nextKey=entry.getKey();
    }
  }
  downloadsQueued.remove(nextKey);
  downloadsInProgress.put(nextKey,next);
  return next;
}

Fixed version (ground truth):
public synchronized CacheDownload getNextInQueue(){
  while (downloadsQueued.isEmpty()) {
    try {
      wait();
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  CacheDownload next=null;
  RequestIdentifier nextKey=null;
  for (  final Map.Entry<RequestIdentifier,CacheDownload> entry : downloadsQueued.entrySet()) {
    if (next == null || entry.getValue().isHigherPriorityThan(next)) {
      next=entry.getValue();
      nextKey=entry.getKey();
    }
  }
  downloadsQueued.remove(nextKey);
  downloadsInProgress.put(nextKey,next);
  return next;
}
Program: 15457
Project: 15457
Buggy source:
@Override public void handleMessage(final Message msg){
  final RedditPreparedPost post=(RedditPreparedPost)msg.obj;
  if (!postIds.add(post.idAlone))   return;
  posts.add(post);
  if (listViewParent.getLastVisiblePosition() + 1 >= posts.size()) {
    updatePosts();
  }
}

Fixed version (ground truth):
@Override public void handleMessage(final Message msg){
  final RedditPreparedPost post=(RedditPreparedPost)msg.obj;
  if (!postIds.add(post.idAlone))   return;
  posts.add(post);
  if (listViewParent.getLastVisiblePosition() + 1 >= postsToReport.size()) {
    updatePosts();
  }
}
Program: 15458
Project: 15458
Buggy source:
public PostListingAdapter(final ListView listViewParent,final PostListingFragment fragmentParent){
  this.listViewParent=listViewParent;
  this.fragmentParent=fragmentParent;
  postAddedHandler=new Handler(Looper.getMainLooper()){
    @Override public void handleMessage(    final Message msg){
      final RedditPreparedPost post=(RedditPreparedPost)msg.obj;
      if (!postIds.add(post.idAlone))       return;
      posts.add(post);
      if (listViewParent.getLastVisiblePosition() + 1 >= posts.size()) {
        updatePosts();
      }
    }
  }
;
}

Fixed version (ground truth):
public PostListingAdapter(final ListView listViewParent,final PostListingFragment fragmentParent){
  this.listViewParent=listViewParent;
  this.fragmentParent=fragmentParent;
  postAddedHandler=new Handler(Looper.getMainLooper()){
    @Override public void handleMessage(    final Message msg){
      final RedditPreparedPost post=(RedditPreparedPost)msg.obj;
      if (!postIds.add(post.idAlone))       return;
      posts.add(post);
      if (listViewParent.getLastVisiblePosition() + 1 >= postsToReport.size()) {
        updatePosts();
      }
    }
  }
;
}
Program: 15459
Project: 15459
Buggy source:
public RedditPreparedPost(final Context context,final CacheManager cm,final int listId,final RedditPost post,final long timestamp,final boolean showSubreddit,final RedditSubreddit parentSubreddit,final boolean updateNeeded,final boolean showThumbnails,final boolean precacheImages,final RedditAccount user){
  this.src=post;
  this.parentSubreddit=parentSubreddit;
  this.showSubreddit=showSubreddit;
  title=StringEscapeUtils.unescapeHtml4(post.title.replace('\n',' ')).trim();
  idAlone=post.id;
  idAndType=post.name;
  url=post.url;
  commentCount=post.num_comments;
  if (post.likes == null) {
    voteDirection=0;
  }
 else {
    voteDirection=Boolean.TRUE.equals(post.likes) ? 1 : -1;
  }
  imageUrl=LinkHandler.getImageUrl(post.url);
  thumbnailUrl=post.thumbnail;
  hasThumbnail=showThumbnails && (hasThumbnail(post) || imageUrl != null);
  final int thumbnailWidth=General.dpToPixels(context,64);
  if (hasThumbnail && hasThumbnail(post)) {
    downloadThumbnail(context,thumbnailWidth,cm,listId,false);
  }
  if (imageUrl != null && precacheImages) {
    downloadThumbnail(context,thumbnailWidth,cm,listId,true);
  }
  lastChange=timestamp;
  if (voteDirection != 0 || saved || hidden) {
    RedditChangeDataManager.getInstance(context).update(parentSubreddit.url,user,this,true);
  }
 else   if (updateNeeded) {
    RedditChangeDataManager.getInstance(context).update(parentSubreddit.url,user,this,false);
  }
  rebuildSubtitle(context);
}

Fixed version (ground truth):
public RedditPreparedPost(final Context context,final CacheManager cm,final int listId,final RedditPost post,final long timestamp,final boolean showSubreddit,final RedditSubreddit parentSubreddit,final boolean updateNeeded,final boolean showThumbnails,final boolean precacheImages,final RedditAccount user){
  this.src=post;
  this.parentSubreddit=parentSubreddit;
  this.showSubreddit=showSubreddit;
  if (post.title == null) {
    title="String_Node_Str";
  }
 else {
    title=StringEscapeUtils.unescapeHtml4(post.title.replace('\n',' ')).trim();
  }
  idAlone=post.id;
  idAndType=post.name;
  url=post.url;
  commentCount=post.num_comments;
  if (post.likes == null) {
    voteDirection=0;
  }
 else {
    voteDirection=Boolean.TRUE.equals(post.likes) ? 1 : -1;
  }
  imageUrl=LinkHandler.getImageUrl(post.url);
  thumbnailUrl=post.thumbnail;
  hasThumbnail=showThumbnails && (hasThumbnail(post) || imageUrl != null);
  final int thumbnailWidth=General.dpToPixels(context,64);
  if (hasThumbnail && hasThumbnail(post)) {
    downloadThumbnail(context,thumbnailWidth,cm,listId,false);
  }
  if (imageUrl != null && precacheImages) {
    downloadThumbnail(context,thumbnailWidth,cm,listId,true);
  }
  lastChange=timestamp;
  if (voteDirection != 0 || saved || hidden) {
    RedditChangeDataManager.getInstance(context).update(parentSubreddit.url,user,this,true);
  }
 else   if (updateNeeded) {
    RedditChangeDataManager.getInstance(context).update(parentSubreddit.url,user,this,false);
  }
  rebuildSubtitle(context);
}
Program: 15460
Project: 15460
Buggy source:
public RedditPreparedMessage(final Context context,final RedditMessage message,final long timestamp){
  this.src=message;
  final TypedArray appearance=context.obtainStyledAttributes(new int[]{R.attr.rrCommentHeaderBoldCol,R.attr.rrCommentHeaderAuthorCol});
  rrCommentHeaderBoldCol=appearance.getColor(0,255);
  rrCommentHeaderAuthorCol=appearance.getColor(1,255);
  body=RedditCommentTextParser.parse(StringEscapeUtils.unescapeHtml4(message.body));
  idAndType=message.name;
  final BetterSSB sb=new BetterSSB();
  sb.append(src.author,BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD,rrCommentHeaderAuthorCol,0,1f);
  sb.append("String_Node_Str",0);
  sb.append(RRTime.formatDurationMs(RRTime.utcCurrentTimeMillis() - src.created_utc * 1000L),BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD,rrCommentHeaderBoldCol,0,1f);
  sb.append("String_Node_Str",0);
  header=sb.get();
}

Fixed version (ground truth):
public RedditPreparedMessage(final Context context,final RedditMessage message,final long timestamp){
  this.src=message;
  final TypedArray appearance=context.obtainStyledAttributes(new int[]{R.attr.rrCommentHeaderBoldCol,R.attr.rrCommentHeaderAuthorCol});
  rrCommentHeaderBoldCol=appearance.getColor(0,255);
  rrCommentHeaderAuthorCol=appearance.getColor(1,255);
  body=RedditCommentTextParser.parse(StringEscapeUtils.unescapeHtml4(message.body));
  idAndType=message.name;
  final BetterSSB sb=new BetterSSB();
  if (src.author == null) {
    sb.append("String_Node_Str",BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD,rrCommentHeaderAuthorCol,0,1f);
  }
 else {
    sb.append(src.author,BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD,rrCommentHeaderAuthorCol,0,1f);
  }
  sb.append("String_Node_Str",0);
  sb.append(RRTime.formatDurationMs(RRTime.utcCurrentTimeMillis() - src.created_utc * 1000L),BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD,rrCommentHeaderBoldCol,0,1f);
  sb.append("String_Node_Str",0);
  header=sb.get();
}
Program: 15461
Project: 15461
Buggy source:
@Override public void handleMessage(final Message msg){
  if (listViewParent.getLastVisiblePosition() + 1 >= posts.size()) {
    updatePosts();
  }
}

Fixed version (ground truth):
@Override public void handleMessage(final Message msg){
  posts.add((RedditPreparedPost)msg.obj);
  if (listViewParent.getLastVisiblePosition() + 1 >= posts.size()) {
    updatePosts();
  }
}
Program: 15462
Project: 15462
Buggy source:
public PostListingAdapter(final ListView listViewParent,final PostListingFragment fragmentParent){
  this.listViewParent=listViewParent;
  this.fragmentParent=fragmentParent;
  postAddedHandler=new Handler(Looper.getMainLooper()){
    @Override public void handleMessage(    final Message msg){
      if (listViewParent.getLastVisiblePosition() + 1 >= posts.size()) {
        updatePosts();
      }
    }
  }
;
}

Fixed version (ground truth):
public PostListingAdapter(final ListView listViewParent,final PostListingFragment fragmentParent){
  this.listViewParent=listViewParent;
  this.fragmentParent=fragmentParent;
  postAddedHandler=new Handler(Looper.getMainLooper()){
    @Override public void handleMessage(    final Message msg){
      posts.add((RedditPreparedPost)msg.obj);
      if (listViewParent.getLastVisiblePosition() + 1 >= posts.size()) {
        updatePosts();
      }
    }
  }
;
}
Program: 15463
Project: 15463
Buggy source:
public void onPostDownloaded(final RedditPreparedPost post){
  posts.add(post);
  postAddedHandler.sendEmptyMessage(0);
}

Fixed version (ground truth):
public void onPostDownloaded(final RedditPreparedPost post){
  postAddedHandler.sendMessage(General.handlerMessage(0,post));
}
Program: 15464
Project: 15464
Buggy source:
/** 
 * Sets the data source as a content Uri. Call this method before  the rest of the methods in this class. This method may be time-consuming.
 * @param context the Context to use when resolving the Uri
 * @param uri the Content URI of the data you want to play
 * @throws IllegalArgumentException if the Uri is invalid
 * @throws SecurityException if the Uri cannot be used due to lack ofpermission.
 */
public void setDataSource(Context context,Uri uri) throws IllegalArgumentException, SecurityException {
  if (uri == null) {
    throw new IllegalArgumentException();
  }
  String scheme=uri.getScheme();
  if (scheme == null || scheme.equals("String_Node_Str")) {
    setDataSource(uri.getPath());
    return;
  }
  Cursor cursor=null;
  try {
    String[] proj={MediaStore.MediaColumns.DATA};
    cursor=context.getContentResolver().query(uri,proj,null,null,null);
    if (cursor != null) {
      int column_index=cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
      if (cursor.moveToFirst()) {
        setDataSource(cursor.getString(column_index));
      }
      cursor.close();
    }
    return;
  }
 catch (  SecurityException ex) {
  }
  setDataSource(uri.toString());
}

Fixed version (ground truth):
/** 
 * Sets the data source as a content Uri. Call this method before  the rest of the methods in this class. This method may be time-consuming.
 * @param context the Context to use when resolving the Uri
 * @param uri the Content URI of the data you want to play
 * @throws IllegalArgumentException if the Uri is invalid
 * @throws SecurityException if the Uri cannot be used due to lack ofpermission.
 */
public void setDataSource(Context context,Uri uri) throws IllegalArgumentException, SecurityException {
  if (uri == null) {
    throw new IllegalArgumentException();
  }
  String scheme=uri.getScheme();
  if (scheme == null || scheme.equals("String_Node_Str")) {
    setDataSource(uri.getPath());
    return;
  }
  Cursor cursor=null;
  try {
    String[] proj={MediaStore.MediaColumns.DATA};
    cursor=context.getContentResolver().query(uri,proj,null,null,null);
    if (cursor != null) {
      int column_index=cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
      if (cursor.moveToFirst()) {
        setDataSource(cursor.getString(column_index));
      }
      cursor.close();
      return;
    }
  }
 catch (  SecurityException ex) {
  }
  setDataSource(uri.toString());
}
Program: 15465
Project: 15465
Buggy source:
public void testFoo(){
  YAMLFile yamlFile=YAMLElementGenerator.getInstance(getProject()).createDummyYamlWithText("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  Collection<YAMLKeyValue> yamlKeyValues=PsiTreeUtil.collectElementsOfType(yamlFile,YAMLKeyValue.class);
  YAMLKeyValue services=ContainerUtil.find(yamlKeyValues,new YamlUpdateArgumentServicesCallbackTest.YAMLKeyValueCondition("String_Node_Str"));
  assertNotNull(services);
  final YamlCreateServiceArgumentsCallback callback=new YamlCreateServiceArgumentsCallback(services);
  CommandProcessor.getInstance().executeCommand(getProject(),new Runnable(){
    @Override public void run(){
      ApplicationManager.getApplication().runWriteAction(new Runnable(){
        @Override public void run(){
          callback.insert(Arrays.asList("String_Node_Str",null,"String_Node_Str"));
        }
      }
);
    }
  }
,null,null);
  assertEquals("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",yamlFile.getText());
}

Fixed version (ground truth):
public void testFoo(){
  YAMLFile yamlFile=YAMLElementGenerator.getInstance(getProject()).createDummyYamlWithText("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  Collection<YAMLKeyValue> yamlKeyValues=PsiTreeUtil.collectElementsOfType(yamlFile,YAMLKeyValue.class);
  YAMLKeyValue services=ContainerUtil.find(yamlKeyValues,new YamlUpdateArgumentServicesCallbackTest.YAMLKeyValueCondition("String_Node_Str"));
  assertNotNull(services);
  final YamlCreateServiceArgumentsCallback callback=new YamlCreateServiceArgumentsCallback(services);
  CommandProcessor.getInstance().executeCommand(getProject(),new Runnable(){
    @Override public void run(){
      ApplicationManager.getApplication().runWriteAction(new Runnable(){
        @Override public void run(){
          callback.insert(Arrays.asList("String_Node_Str",null,"String_Node_Str"));
        }
      }
);
    }
  }
,null,null);
  ApplicationInfo instance=ApplicationInfo.getInstance();
  String minorVersion=instance.getMinorVersion();
  if ((instance.getMajorVersion().equals("String_Node_Str") && Integer.valueOf(minorVersion) >= 2)) {
    assertEquals("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",yamlFile.getText());
  }
 else {
    assertEquals("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",yamlFile.getText());
  }
}