nus-yam/ex-repair huggingface dataset:
Program: 153428
Project: 153428
Buggy source:
public void startActivityForResultWithMatjiData(Intent intent,int requestCode,MatjiData data){
  SharedMatjiData.getInstance().push(data);
  super.startActivityForResult(intent,requestCode);
}

Fixed version (ground truth):
public void startActivityForResultWithMatjiData(Intent intent,int requestCode,MatjiData data){
  preStart(data);
  super.startActivityForResult(intent,requestCode);
}
Program: 153429
Project: 153429
Buggy source:
public void finishActivityWithMatjiData(int requestCode){
  SharedMatjiData.getInstance().pop();
  super.finishActivity(requestCode);
}

Fixed version (ground truth):
public void finishActivityWithMatjiData(int requestCode){
  preFinish();
  super.finishActivity(requestCode);
}
Program: 153430
Project: 153430
Buggy source:
public void startActivityFromChildWithMatjiData(Activity child,Intent intent,int requestCode,MatjiData data){
  SharedMatjiData.getInstance().push(data);
  super.startActivityFromChild(child,intent,requestCode);
}

Fixed version (ground truth):
public void startActivityFromChildWithMatjiData(Activity child,Intent intent,int requestCode,MatjiData data){
  preStart(data);
  super.startActivityFromChild(child,intent,requestCode);
}
Program: 153431
Project: 153431
Buggy source:
public boolean startActivityIfNeededWithMatjiData(Intent intent,int requestCode,MatjiData data){
  SharedMatjiData.getInstance().push(data);
  return super.startActivityIfNeeded(intent,requestCode);
}

Fixed version (ground truth):
public boolean startActivityIfNeededWithMatjiData(Intent intent,int requestCode,MatjiData data){
  preStart(data);
  return super.startActivityIfNeeded(intent,requestCode);
}
Program: 153432
Project: 153432
Buggy source:
public void startActivityWithMatjiData(Intent intent,MatjiData data){
  Log.d("String_Node_Str","String_Node_Str");
  SharedMatjiData.getInstance().push(data);
  super.startActivity(intent);
}

Fixed version (ground truth):
public void startActivityWithMatjiData(Intent intent,MatjiData data){
  preStart(data);
  super.startActivity(intent);
}
Program: 153433
Project: 153433
Buggy source:
public void finishFromChildWithMatjiData(Activity child){
  SharedMatjiData.getInstance().pop();
  super.finishFromChild(child);
}

Fixed version (ground truth):
public void finishFromChildWithMatjiData(Activity child){
  preFinish();
  super.finishFromChild(child);
}
Program: 153434
Project: 153434
Buggy source:
public void finishActivityFromChildWithMatjiData(Activity child,int requestCode){
  SharedMatjiData.getInstance().pop();
  super.finishActivityFromChild(child,requestCode);
}

Fixed version (ground truth):
public void finishActivityFromChildWithMatjiData(Activity child,int requestCode){
  preFinish();
  super.finishActivityFromChild(child,requestCode);
}
Program: 153435
Project: 153435
Buggy source:
public void finishWithMatjiData(){
  SharedMatjiData.getInstance().pop();
  super.finish();
}

Fixed version (ground truth):
public void finishWithMatjiData(){
  preFinish();
  super.finish();
}
Program: 153436
Project: 153436
Buggy source:
public void startActivityForResultWithMatjiData(Intent intent,int requestCode,MatjiData data){
  SharedMatjiData.getInstance().push(data);
  super.startActivityForResult(intent,requestCode);
}

Fixed version (ground truth):
public void startActivityForResultWithMatjiData(Intent intent,int requestCode,MatjiData data){
  preStart(data);
  super.startActivityForResult(intent,requestCode);
}
Program: 153437
Project: 153437
Buggy source:
public void finishActivityWithMatjiData(int requestCode){
  SharedMatjiData.getInstance().pop();
  super.finishActivity(requestCode);
}

Fixed version (ground truth):
public void finishActivityWithMatjiData(int requestCode){
  preFinish();
  super.finishActivity(requestCode);
}
Program: 153438
Project: 153438
Buggy source:
public void startActivityFromChildWithMatjiData(Activity child,Intent intent,int requestCode,MatjiData data){
  SharedMatjiData.getInstance().push(data);
  super.startActivityFromChild(child,intent,requestCode);
}

Fixed version (ground truth):
public void startActivityFromChildWithMatjiData(Activity child,Intent intent,int requestCode,MatjiData data){
  preStart(data);
  super.startActivityFromChild(child,intent,requestCode);
}
Program: 153439
Project: 153439
Buggy source:
public boolean startActivityIfNeededWithMatjiData(Intent intent,int requestCode,MatjiData data){
  SharedMatjiData.getInstance().push(data);
  return super.startActivityIfNeeded(intent,requestCode);
}

Fixed version (ground truth):
public boolean startActivityIfNeededWithMatjiData(Intent intent,int requestCode,MatjiData data){
  preStart(data);
  return super.startActivityIfNeeded(intent,requestCode);
}
Program: 153440
Project: 153440
Buggy source:
public void startActivityWithMatjiData(Intent intent,MatjiData data){
  Log.d("String_Node_Str","String_Node_Str");
  SharedMatjiData.getInstance().push(data);
  super.startActivity(intent);
}

Fixed version (ground truth):
public void startActivityWithMatjiData(Intent intent,MatjiData data){
  preStart(data);
  super.startActivity(intent);
}
Program: 153441
Project: 153441
Buggy source:
public void finishFromChildWithMatjiData(Activity child){
  SharedMatjiData.getInstance().pop();
  super.finishFromChild(child);
}

Fixed version (ground truth):
public void finishFromChildWithMatjiData(Activity child){
  preFinish();
  super.finishFromChild(child);
}
Program: 153442
Project: 153442
Buggy source:
public void finishActivityFromChildWithMatjiData(Activity child,int requestCode){
  SharedMatjiData.getInstance().pop();
  super.finishActivityFromChild(child,requestCode);
}

Fixed version (ground truth):
public void finishActivityFromChildWithMatjiData(Activity child,int requestCode){
  preFinish();
  super.finishActivityFromChild(child,requestCode);
}
Program: 153443
Project: 153443
Buggy source:
public void swipeAnimation(int position,Animation inAnim,Animation outAnim,Animation prevInAnim){
  int currentViewPosition=getChildAtPosition(position);
  int prevViewPositoin=getChildAtPosition(prevPosition);
  if (!hasAnimationStarted) {
    currentFront=listView.getChildAt(currentViewPosition).findViewById(frontId);
    currentRear=listView.getChildAt(currentViewPosition).findViewById(rearId);
switch (currentFront.getVisibility()) {
case View.GONE:
      currentFront.startAnimation(inAnim);
    if (prevPosition == position) {
      prevPosition=-1;
    }
  break;
case View.VISIBLE:
if (prevPosition > 0 && (prevPosition < listView.getFirstVisiblePosition() || prevPosition > listView.getLastVisiblePosition())) {
  prevPosition=-1;
}
currentFront.startAnimation(outAnim);
if (prevPosition > 0 && prevPosition != position) {
prevFront=listView.getChildAt(prevViewPositoin).findViewById(frontId);
prevRear=listView.getChildAt(prevViewPositoin).findViewById(rearId);
if (prevFront.getVisibility() != View.VISIBLE) {
prevFront.startAnimation(prevInAnim);
}
}
prevPosition=position;
break;
}
}
}

Fixed version (ground truth):
public void swipeAnimation(int position,Animation inAnim,Animation outAnim,Animation prevInAnim){
  int currentViewPosition=getChildAtPosition(position);
  int prevViewPositoin=getChildAtPosition(prevPosition);
  if (isMyItem(position - headerPos - 1) && !hasAnimationStarted) {
    currentFront=listView.getChildAt(currentViewPosition).findViewById(frontId);
    currentRear=listView.getChildAt(currentViewPosition).findViewById(rearId);
switch (currentFront.getVisibility()) {
case View.GONE:
      currentFront.startAnimation(inAnim);
    if (prevPosition == position) {
      prevPosition=-1;
    }
  break;
case View.VISIBLE:
if (prevPosition > 0 && (prevPosition < listView.getFirstVisiblePosition() || prevPosition > listView.getLastVisiblePosition())) {
  prevPosition=-1;
}
currentFront.startAnimation(outAnim);
if (prevPosition > 0 && prevPosition != position) {
prevFront=listView.getChildAt(prevViewPositoin).findViewById(frontId);
prevRear=listView.getChildAt(prevViewPositoin).findViewById(rearId);
if (prevFront.getVisibility() != View.VISIBLE) {
prevFront.startAnimation(prevInAnim);
}
}
prevPosition=position;
break;
}
}
}
Program: 153444
Project: 153444
Buggy source:
public CommentListView(Context context,AttributeSet attrs){
  super(context,attrs,new CommentAdapter(context),10);
  request=new CommentHttpRequest(context);
  session=Session.getInstance(context);
  setPage(1);
  listener=new ListItemSwipeListener(context,this,R.id.comment_adapter_wrap,R.id.adapter_swipe_rear,1){
    @Override public void onListItemClicked(    int position){
    }
  }
;
  setOnTouchListener(listener);
  setCanRepeat(true);
}

Fixed version (ground truth):
public CommentListView(Context context,AttributeSet attrs){
  super(context,attrs,new CommentAdapter(context),10);
  request=new CommentHttpRequest(context);
  session=Session.getInstance(context);
  setPage(1);
  listener=new ListItemSwipeListener(context,this,R.id.comment_adapter_wrap,R.id.adapter_swipe_rear,1){
    @Override public void onListItemClicked(    int position){
    }
    @Override public boolean isMyItem(    int position){
      return session.isLogin() && ((Comment)getAdapterData().get(position)).getUserId() == session.getCurrentUser().getId();
    }
  }
;
  setOnTouchListener(listener);
  setCanRepeat(true);
}
Program: 153445
Project: 153445
Buggy source:
public void onClick(View v){
switch (v.getId()) {
case R.id.comment_adapter_thumnail:
case R.id.comment_adapter_nick:
    gotoUserPage(Integer.parseInt((String)v.getTag()));
  break;
case R.id.delete_btn:
if (session.isLogin()) {
  curDeletePos=Integer.parseInt((String)v.getTag());
  Comment comment=(Comment)getAdapterData().get(curDeletePos);
  getHttpRequestManager().request(getActivity(),deleteRequest(comment.getId()),COMMENT_DELETE_REQUEST,this);
}
break;
}
}

Fixed version (ground truth):
public void onClick(View v){
switch (v.getId()) {
case R.id.comment_adapter_thumnail:
case R.id.comment_adapter_nick:
    gotoUserPage(Integer.parseInt((String)v.getTag()));
  break;
case R.id.delete_btn:
if (session.isLogin() && !getHttpRequestManager().isRunning(getActivity())) {
  curDeletePos=Integer.parseInt((String)v.getTag());
  Comment comment=(Comment)getAdapterData().get(curDeletePos);
  getHttpRequestManager().request(getActivity(),deleteRequest(comment.getId()),COMMENT_DELETE_REQUEST,this);
}
break;
}
}
Program: 153446
Project: 153446
Buggy source:
public void putAndRunRequest(Activity activity,HttpRequest request,Requestable requestable){
  Log.d("String_Node_Str","String_Node_Str" + isRequestAlreadyExecute(activity,request));
  if (!isRequestAlreadyExecute(activity,request)) {
    HttpAsyncTask task=new HttpAsyncTask(activity,request,requestable);
    putHttpAsyncTask(activity,task);
    task.execute();
  }
}

Fixed version (ground truth):
public void putAndRunRequest(Activity activity,HttpRequest request,Requestable requestable){
  if (!isRequestAlreadyExecute(activity,request)) {
    HttpAsyncTask task=new HttpAsyncTask(activity,request,requestable);
    putHttpAsyncTask(activity,task);
    task.execute();
  }
}
Program: 153447
Project: 153447
Buggy source:
public void requestStartSpinner(){
}

Fixed version (ground truth):
public void requestStartSpinner(){
  spinnerCount++;
  spinner.start(parent);
}
Program: 153448
Project: 153448
Buggy source:
public void onViewScrollFinished(int currentPage){
  if (mCurrentPage != currentPage) {
    Log.d("String_Node_Str","String_Node_Str");
    try {
      mCurrentPage=currentPage;
      session.getPreferenceProvider().setInt(Session.POST_SLIDER_INDEX,mCurrentPage);
      control.setCurrentPage(currentPage);
      View view=mContentViews.get(currentPage);
      if (view instanceof RequestableMListView) {
        RequestableMListView listView=(RequestableMListView)view;
        listView.requestConditionally();
      }
    }
 catch (    IndexOutOfBoundsException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void onViewScrollFinished(int currentPage){
  if (mCurrentPage != currentPage) {
    Log.d("String_Node_Str","String_Node_Str");
    try {
      mCurrentPage=currentPage;
      session.getPreferenceProvider().setInt(Session.POST_SLIDER_INDEX,mCurrentPage);
      control.setCurrentPage(currentPage);
      View view=mContentViews.get(currentPage);
      if (view instanceof RequestableMListView && !(view instanceof Searchable)) {
        RequestableMListView listView=(RequestableMListView)view;
        listView.requestConditionally();
      }
    }
 catch (    IndexOutOfBoundsException e) {
      e.printStackTrace();
    }
  }
}
Program: 153449
Project: 153449
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  tabHost=getTabHost();
  tabHost.addTab(tabHost.newTabSpec("String_Node_Str").setIndicator("String_Node_Str").setContent(new Intent(this,MainMapActivity.class)));
  tabHost.addTab(tabHost.newTabSpec("String_Node_Str").setIndicator("String_Node_Str").setContent(new Intent(this,StoreSliderActivity.class)));
  tabHost.addTab(tabHost.newTabSpec("String_Node_Str").setIndicator("String_Node_Str").setContent(new Intent(this,UserTabActivity.class)));
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  tabHost=getTabHost();
  tabHost.addTab(tabHost.newTabSpec("String_Node_Str").setIndicator("String_Node_Str").setContent(new Intent(this,MainMapActivity.class)));
  tabHost.addTab(tabHost.newTabSpec("String_Node_Str").setIndicator("String_Node_Str").setContent(new Intent(this,StoreSliderActivity.class)));
}
Program: 153450
Project: 153450
Buggy source:
public HttpRequest request(){
  ((PostHttpRequest)request).actionList(getPage(),getLimit());
  return request;
}

Fixed version (ground truth):
public HttpRequest request(){
  ((PostHttpRequest)request).actionList(getPage(),getLimit());
  Log.d("String_Node_Str","String_Node_Str");
  return request;
}
Program: 153451
Project: 153451
Buggy source:
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.post_adapter_nick:
    Post post=(Post)getAdapterData().get(Integer.parseInt((String)v.getTag()));
  Log.d("String_Node_Str","String_Node_Str" + post.getUser().getNick());
Intent intent=new Intent(getActivity(),UserTabActivity.class);
Log.d("String_Node_Str","String_Node_Str" + post.getUser());
intent.putExtra("String_Node_Str",post.getUser());
getActivity().startActivity(intent);
break;
case R.id.post_adapter_store_name:
Log.d("String_Node_Str","String_Node_Str");
break;
}
}

Fixed version (ground truth):
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.post_adapter_nick:
    Post post=(Post)getAdapterData().get(Integer.parseInt((String)v.getTag()));
  Log.d("String_Node_Str","String_Node_Str" + post.getUser().getNick());
Intent intent=new Intent(getActivity(),PostInfoActivity.class);
Log.d("String_Node_Str","String_Node_Str" + post.getUser());
intent.putExtra("String_Node_Str",post);
getActivity().startActivity(intent);
break;
case R.id.post_adapter_store_name:
Log.d("String_Node_Str","String_Node_Str");
break;
}
}
Program: 153452
Project: 153452
Buggy source:
public void requestCallBack(int tag,ArrayList<? extends MatjiData> data){
  if (data.size() == 0 || data.size() < limit)   scrollListener.requestSetOff();
  adapterData=getListByT(data);
  ((MBaseAdapter)adapter).notifyDataSetChanged();
  if (adapterData.size() <= limit)   onRefreshComplete();
}

Fixed version (ground truth):
public void requestCallBack(int tag,ArrayList<? extends MatjiData> data){
  if (data.size() == 0 || data.size() < limit)   scrollListener.requestSetOff();
  for (int i=0; i < data.size(); i++) {
    adapterData.add((MatjiData)data.get(i));
  }
  ((MBaseAdapter)adapter).notifyDataSetChanged();
  if (adapterData.size() <= limit)   onRefreshComplete();
}
Program: 153453
Project: 153453
Buggy source:
public HttpRequest request(){
  storeRequest.actionList(getPage(),getLimit());
  return storeRequest;
}

Fixed version (ground truth):
public HttpRequest request(){
  Log.d("String_Node_Str","String_Node_Str");
  storeRequest.actionList(getPage(),getLimit());
  return storeRequest;
}
Program: 153454
Project: 153454
Buggy source:
public HttpRequest request(){
  storeRequest.actionNearbyList(lat_sw,lat_ne,lng_sw,lng_ne,getPage(),getLimit());
  return storeRequest;
}

Fixed version (ground truth):
public HttpRequest request(){
  storeRequest.actionNearbyList(lat_sw,lat_ne,lng_sw,lng_ne,getPage(),getLimit());
  Log.d("String_Node_Str","String_Node_Str");
  return storeRequest;
}
Program: 153455
Project: 153455
Buggy source:
@Test public void shouldEnsureGetTalkMessagesReturnsMessages() throws Exception {
  TalkServer talkImpl=new TalkServer();
  ITalkJsonConverter jsonConv=mock(ITalkJsonConverter.class);
  ISiteAuth siteauth=mock(ISiteAuth.class);
  when(siteauth.get(anyString(),anyMap())).thenReturn("String_Node_Str");
  setHiddenField(talkImpl,"String_Node_Str",siteauth);
  List<GeoCamTalkMessage> expectedList=new ArrayList<GeoCamTalkMessage>();
  expectedList.add(new GeoCamTalkMessage());
  when(jsonConv.deserializeList(anyString())).thenReturn(expectedList);
  setHiddenField(talkImpl,"String_Node_Str",jsonConv);
  MessageStore ms=mock(MessageStore.class);
  setHiddenField(talkImpl,"String_Node_Str",ms);
  IIntentHelper intentHelper=mock(IIntentHelper.class);
  setHiddenField(talkImpl,"String_Node_Str",intentHelper);
  talkImpl.getTalkMessages();
  verify(ms).addMessage(anyList());
  verify(jsonConv).deserializeList(anyString());
}

Fixed version (ground truth):
@Test public void shouldEnsureGetTalkMessagesReturnsMessages() throws Exception {
  TalkServer talkImpl=new TalkServer();
  ITalkJsonConverter jsonConv=mock(ITalkJsonConverter.class);
  ISiteAuth siteauth=mock(ISiteAuth.class);
  when(siteauth.get(anyString(),anyMap())).thenReturn(new ServerResponse(200,"String_Node_Str"));
  setHiddenField(talkImpl,"String_Node_Str",siteauth);
  List<GeoCamTalkMessage> expectedList=new ArrayList<GeoCamTalkMessage>();
  expectedList.add(new GeoCamTalkMessage());
  when(jsonConv.deserializeList(anyString())).thenReturn(expectedList);
  setHiddenField(talkImpl,"String_Node_Str",jsonConv);
  MessageStore ms=mock(MessageStore.class);
  setHiddenField(talkImpl,"String_Node_Str",ms);
  IIntentHelper intentHelper=mock(IIntentHelper.class);
  setHiddenField(talkImpl,"String_Node_Str",intentHelper);
  talkImpl.getTalkMessages();
  verify(ms).addMessage(anyList());
  verify(jsonConv).deserializeList(anyString());
}
Program: 153456
Project: 153456
Buggy source:
@Test public void shouldEnsureCreateTalkMessagePostsTalkMessage() throws Exception {
  ITalkServer talkImpl=new TalkServer();
  ITalkJsonConverter jsonConv=mock(TalkJsonConverter.class);
  ISiteAuth siteauth=mock(ISiteAuth.class);
  when(siteauth.post(anyString(),anyMap(),any(byte[].class))).thenReturn(200);
  setHiddenField(talkImpl,"String_Node_Str",siteauth);
  when(jsonConv.serialize((GeoCamTalkMessage)anyObject())).thenReturn("String_Node_Str");
  setHiddenField(talkImpl,"String_Node_Str",jsonConv);
  talkImpl.createTalkMessage(new GeoCamTalkMessage());
  verify(siteauth).post(anyString(),anyMap(),any(byte[].class));
}

Fixed version (ground truth):
@Test public void shouldEnsureCreateTalkMessagePostsTalkMessage() throws Exception {
  ITalkServer talkImpl=new TalkServer();
  ITalkJsonConverter jsonConv=mock(TalkJsonConverter.class);
  ISiteAuth siteauth=mock(ISiteAuth.class);
  when(siteauth.post(anyString(),anyMap(),any(byte[].class))).thenReturn(new ServerResponse(200,"String_Node_Str"));
  setHiddenField(talkImpl,"String_Node_Str",siteauth);
  when(jsonConv.serialize((GeoCamTalkMessage)anyObject())).thenReturn("String_Node_Str");
  setHiddenField(talkImpl,"String_Node_Str",jsonConv);
  talkImpl.createTalkMessage(new GeoCamTalkMessage());
  verify(siteauth).post(anyString(),anyMap(),any(byte[].class));
}
Program: 153457
Project: 153457
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.create_talk_message);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.create_talk_message);
  sharedPreferences=PreferenceManager.getDefaultSharedPreferences(this);
}
Program: 153458
Project: 153458
Buggy source:
public void onSendClick(View v){
  GeoCamTalkMessage message=new GeoCamTalkMessage();
  message.setContent(newTalkTextView.getText().toString());
  message.setContentTimestamp(new Date());
  message.setLocation(appState.getLocation());
  if (filename != null) {
    message.setAudio(createByteArray());
  }
  try {
    messageStore.addMessage(message);
    intentHelper.Synchronize();
    UIUtils.goHome(this);
  }
 catch (  Exception e) {
    UIUtils.displayException(this,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void onSendClick(View v){
  GeoCamTalkMessage message=new GeoCamTalkMessage();
  message.setContent(newTalkTextView.getText().toString());
  message.setContentTimestamp(new Date());
  message.setLocation(appState.getLocation());
  message.setAuthorUsername(sharedPreferences.getString("String_Node_Str",null));
  if (filename != null) {
    message.setAudio(createByteArray());
  }
  try {
    messageStore.addMessage(message);
    intentHelper.Synchronize();
    UIUtils.goHome(this);
  }
 catch (  Exception e) {
    UIUtils.displayException(this,e,"String_Node_Str");
  }
}
Program: 153459
Project: 153459
Buggy source:
@Inject public SiteAuthCookie(Context context){
  this.context=context;
}

Fixed version (ground truth):
@Inject public SiteAuthCookie(Context context){
  this.context=context;
  this.sharedPreferences=PreferenceManager.getDefaultSharedPreferences(context);
}
Program: 153460
Project: 153460
Buggy source:
private void ensureAuthenticated() throws AuthenticationFailedException, ClientProtocolException, IOException {
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  String username=prefs.getString("String_Node_Str",null);
  String password=prefs.getString("String_Node_Str",null);
  if (username == null || password == null) {
    throw new AuthenticationFailedException("String_Node_Str");
  }
 else {
    Date now=new Date();
    if (sessionIdCookie == null || sessionIdCookie.isExpired(now)) {
      login(username,password);
    }
  }
}

Fixed version (ground truth):
private void ensureAuthenticated() throws AuthenticationFailedException, ClientProtocolException, IOException {
  String username=sharedPreferences.getString("String_Node_Str",null);
  String password=sharedPreferences.getString("String_Node_Str",null);
  if (username == null || password == null) {
    throw new AuthenticationFailedException("String_Node_Str");
  }
 else {
    Date now=new Date();
    if (sessionIdCookie == null || sessionIdCookie.isExpired(now)) {
      login(username,password);
    }
  }
}
Program: 153461
Project: 153461
Buggy source:
@Override public void createTalkMessage(GeoCamTalkMessage message) throws ClientProtocolException, AuthenticationFailedException, IOException, SQLException {
  HashMap<String,String> map=new HashMap<String,String>();
  map.put("String_Node_Str",jsonConverter.serialize(message));
  ServerResponse sr=siteAuth.post(urlCreateMessage,map,message.getAudio());
  if (sr.getResponseCode() == 401) {
    siteAuth.reAuthenticate();
    sr=siteAuth.post(urlCreateMessage,map,message.getAudio());
  }
  if (sr.getResponseCode() != 200) {
    throw new ClientProtocolException("String_Node_Str" + sr.getResponseCode() + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void createTalkMessage(GeoCamTalkMessage message) throws ClientProtocolException, AuthenticationFailedException, IOException, SQLException {
  HashMap<String,String> map=new HashMap<String,String>();
  map.put("String_Node_Str",jsonConverter.serialize(message));
  ServerResponse sr=siteAuth.post(urlCreateMessage,map,message.getAudio());
  if (sr.getResponseCode() == 401) {
    siteAuth.reAuthenticate();
    sr=siteAuth.post(urlCreateMessage,map,message.getAudio());
  }
  if (sr.getResponseCode() == 200) {
    Map<String,String> result=jsonConverter.createMap(sr.getContent());
    try {
      message.setMessageId(Integer.parseInt(result.get("String_Node_Str")));
      message.setAuthorFullname(result.get("String_Node_Str"));
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str",e);
    }
    message.setSynchronized(true);
    messageStore.updateMessage(message);
    Log.i("String_Node_Str","String_Node_Str");
  }
 else {
    throw new ClientProtocolException("String_Node_Str" + sr.getResponseCode() + "String_Node_Str");
  }
}
Program: 153462
Project: 153462
Buggy source:
@Test public void shouldProperlyDisplayGeolocaionStatus() throws Exception {
  List<GeoCamTalkMessage> msgs=new ArrayList<GeoCamTalkMessage>();
  msgs.add(FakeGeoCamTalkMessageFactory.getMessage("String_Node_Str","String_Node_Str",true));
  msgs.add(FakeGeoCamTalkMessageFactory.getMessage("String_Node_Str","String_Node_Str",false));
  GeoCamTalkMessageArrayAdapter adapter=new GeoCamTalkMessageArrayAdapter(Robolectric.application.getApplicationContext());
  adapter.setTalkMessages(msgs);
  View temp1=View.inflate(Robolectric.application.getApplicationContext(),R.layout.list_item,null);
  View temp2=View.inflate(Robolectric.application.getApplicationContext(),R.layout.list_item,null);
  LinearLayout geoLocatedMsgView=(LinearLayout)adapter.getView(0,temp1,null);
  LinearLayout nonGeoLocatedMsgView=(LinearLayout)adapter.getView(1,temp2,null);
  assertTrue(((ImageView)geoLocatedMsgView.findViewById(R.id.hasGeoLocation)).getVisibility() == View.VISIBLE);
  assertTrue(((ImageView)nonGeoLocatedMsgView.findViewById(R.id.hasGeoLocation)).getVisibility() == View.INVISIBLE);
}

Fixed version (ground truth):
@Test public void shouldProperlyDisplayGeolocaionStatus() throws Exception {
  List<GeoCamTalkMessage> msgs=new ArrayList<GeoCamTalkMessage>();
  msgs.add(FakeGeoCamTalkMessageFactory.getMessage("String_Node_Str","String_Node_Str",true));
  msgs.add(FakeGeoCamTalkMessageFactory.getMessage("String_Node_Str","String_Node_Str",false));
  GeoCamTalkMessageAdapter adapter=new GeoCamTalkMessageAdapter(Robolectric.application.getApplicationContext());
  adapter.setTalkMessages(msgs);
  View temp1=View.inflate(Robolectric.application.getApplicationContext(),R.layout.list_item,null);
  View temp2=View.inflate(Robolectric.application.getApplicationContext(),R.layout.list_item,null);
  LinearLayout geoLocatedMsgView=(LinearLayout)adapter.getView(0,temp1,null);
  LinearLayout nonGeoLocatedMsgView=(LinearLayout)adapter.getView(1,temp2,null);
  assertTrue(((ImageView)geoLocatedMsgView.findViewById(R.id.hasGeoLocation)).getVisibility() == View.VISIBLE);
  assertTrue(((ImageView)nonGeoLocatedMsgView.findViewById(R.id.hasGeoLocation)).getVisibility() == View.INVISIBLE);
}
Program: 153463
Project: 153463
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
}
Program: 153464
Project: 153464
Buggy source:
public void newMessages(){
  try {
    talkMessages=messageStore.getAllMessages();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str","String_Node_Str" + e.getMessage());
  }
  if (talkMessages != null) {
    adapter.setTalkMessages(talkMessages);
    talkListView.setAdapter(adapter);
  }
}

Fixed version (ground truth):
public void newMessages(){
  populateListView();
}
Program: 153465
Project: 153465
Buggy source:
public void onGoHomeClick(View v){
  List<GeoCamTalkMessage> talkMessages=null;
  try {
    talkMessages=messageStore.getAllMessages();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str","String_Node_Str" + e.getMessage());
  }
  if (talkMessages != null) {
    adapter.setTalkMessages(talkMessages);
    talkListView.setAdapter(adapter);
  }
}

Fixed version (ground truth):
public void onGoHomeClick(View v){
  populateListView();
}
Program: 153466
Project: 153466
Buggy source:
@Override protected void onResume(){
  super.onResume();
  IntentFilter filter=new IntentFilter();
  filter.addAction(TalkServerIntent.INTENT_NEW_MESSAGES.toString());
  registerReceiver(receiver,filter);
  setContentView(R.layout.main);
  talkListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parentView,    View childView,    int position,    long id){
      GeoCamTalkMessage msg=adapter.getTalkMessage(position);
      if (msg.hasAudio()) {
        try {
          UIUtils.playAudio(getApplicationContext(),msg,player,siteAuth);
        }
 catch (        Exception e) {
          UIUtils.displayException(getApplicationContext(),e,"String_Node_Str");
        }
      }
    }
  }
);
  try {
    talkMessages=messageStore.getAllMessages();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str","String_Node_Str" + e.getMessage());
  }
  if (talkMessages != null) {
    adapter.setTalkMessages(talkMessages);
    talkListView.setAdapter(adapter);
  }
 else {
    Toast.makeText(this.getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  IntentFilter filter=new IntentFilter();
  filter.addAction(TalkServerIntent.INTENT_NEW_MESSAGES.toString());
  registerReceiver(receiver,filter);
  setContentView(R.layout.main);
  talkListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parentView,    View childView,    int position,    long id){
      GeoCamTalkMessage msg=adapter.getTalkMessage(position);
      if (msg.hasAudio()) {
        try {
          UIUtils.playAudio(getApplicationContext(),msg,player,siteAuth);
        }
 catch (        Exception e) {
          UIUtils.displayException(getApplicationContext(),e,"String_Node_Str");
        }
      }
    }
  }
);
  populateListView();
  super.onResume();
}
Program: 153467
Project: 153467
Buggy source:
@Override protected void configure(){
  bind(IDjangoTalk.class).to(DjangoTalk.class);
  bind(IDatabaseHelper.class).to(DatabaseHelper.class);
  bind(IMessageStore.class).to(MessageStore.class);
  bind(IAudioRecorder.class).to(AudioRecorder.class);
  bind(IAudioPlayer.class).to(AudioPlayer.class);
  bind(IDjangoTalkJsonConverter.class).to(DjangoTalkJsonConverter.class);
  bind(ISiteAuth.class).toInstance(new SiteAuthCookie(application.getApplicationContext()));
  bind(IIntentHelper.class).to(IntentHelper.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(IDjangoTalk.class).to(DjangoTalk.class);
  bind(IDatabaseHelper.class).to(DatabaseHelper.class);
  bind(IMessageStore.class).to(MessageStore.class);
  bind(IAudioRecorder.class).to(AudioRecorder.class);
  bind(IAudioPlayer.class).to(AudioPlayer.class);
  bind(IDjangoTalkJsonConverter.class).to(DjangoTalkJsonConverter.class);
  bind(ISiteAuth.class).toInstance(new SiteAuthCookie(application.getApplicationContext()));
  bind(IIntentHelper.class).to(IntentHelper.class);
  bind(IGeoCamSynchronizationTimerTask.class).to(GeoCamSynchronizationTimerTask.class);
}
Program: 153468
Project: 153468
Buggy source:
public DjangoTalk(){
  super("String_Node_Str");
  Timer timer=new Timer();
  timer.schedule(geoCamSynchronizationTimerTask,0,60 * 10 * 1000);
}

Fixed version (ground truth):
public DjangoTalk(){
  super("String_Node_Str");
}
Program: 153469
Project: 153469
Buggy source:
@Inject public GeoCamSynchronizationTimerTask(IIntentHelper intentHelper){
  this.intentHelper=intentHelper;
}

Fixed version (ground truth):
@Inject public GeoCamSynchronizationTimerTask(IIntentHelper intentHelper){
  this.intentHelper=intentHelper;
  this.timer.schedule(this,0,60 * 10 * 1000);
}
Program: 153470
Project: 153470
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  setDefaultSettings();
  List<GeoCamTalkMessage> talkMessages=djangoTalk.getTalkMessages();
  if (talkMessages != null) {
    adapter.setTalkMessages(talkMessages);
    talkListView.setAdapter(adapter);
  }
 else {
    Toast.makeText(this.getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  String username=prefs.getString("String_Node_Str",null);
  String password=prefs.getString("String_Node_Str",null);
  djangoTalk.setAuth(username,password);
  List<GeoCamTalkMessage> talkMessages=djangoTalk.getTalkMessages();
  if (talkMessages != null) {
    adapter.setTalkMessages(talkMessages);
    talkListView.setAdapter(adapter);
  }
 else {
    Toast.makeText(this.getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}
Program: 153472
Project: 153472
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object receive=e.getMessage();
  if (receive instanceof HttpResponse) {
    HttpResponse response=(HttpResponse)receive;
    if (NettyUtil.isError(response.getStatus())) {
      try {
        handler.onError(new RestErrorResponse(response));
      }
  finally {
        future.finished();
        RestRiakOperations.this.support.responseComplete();
      }
    }
 else {
      this.vclock=response.getHeader(RiakHttpHeaders.VECTOR_CLOCK);
      handler.begin();
    }
  }
 else   if (receive instanceof PartMessage) {
    PartMessage part=(PartMessage)receive;
    boolean done=part.isLast();
    part.setHeader(RiakHttpHeaders.VECTOR_CLOCK,this.vclock);
    if (done) {
      try {
        handler.end();
        future.setSuccess();
      }
  finally {
        RestRiakOperations.this.support.responseComplete();
      }
    }
 else {
      RiakObject<byte[]> ro=RestRiakOperations.this.factory.convert(part,part.getContent(),location);
      handler.handle(RestRiakOperations.this.support.newResponse(ro));
    }
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object receive=e.getMessage();
  if (receive instanceof HttpResponse) {
    HttpResponse response=(HttpResponse)receive;
    if (NettyUtil.isError(response.getStatus())) {
      try {
        handler.onError(new RestErrorResponse(response));
      }
  finally {
        future.finished();
        RestRiakOperations.this.support.responseComplete();
      }
    }
 else {
      this.vclock=response.getHeader(RiakHttpHeaders.VECTOR_CLOCK);
      handler.begin();
    }
  }
 else   if (receive instanceof PartMessage) {
    PartMessage part=(PartMessage)receive;
    boolean done=part.isLast();
    part.setHeader(RiakHttpHeaders.VECTOR_CLOCK,this.vclock);
    if (done) {
      try {
        handler.end();
        if (this.failed == null) {
          future.setSuccess();
        }
 else {
          future.setFailure(this.failed);
        }
      }
  finally {
        RestRiakOperations.this.support.responseComplete();
      }
    }
 else {
      RiakObject<byte[]> ro=RestRiakOperations.this.factory.convert(part,part.getContent(),location);
      try {
        handler.handle(RestRiakOperations.this.support.newResponse(ro));
      }
 catch (      Exception ex) {
        this.failed=ex;
        LOG.error(Markers.DESIGN,ex.getMessage(),ex);
      }
    }
  }
}
Program: 153473
Project: 153473
Buggy source:
/** 
 * Stores a new object in a bucket with a random Riak-assigned key.<br/> set Location key as empty string.
 */
RiakFuture post(RiakObject<byte[]> content,PutOptions options,RiakResponseHandler<RiakObject<byte[]>> handler);

Fixed version (ground truth):
/** 
 * Stores a new object in a bucket with a random Riak-assigned key.<br/> set Location key as empty string.
 */
RiakFuture post(RiakObject<byte[]> content,PostOptions options,RiakResponseHandler<RiakObject<byte[]>> handler);
Program: 153474
Project: 153474
Buggy source:
@Override public RiakFuture post(RiakObject<byte[]> content,PutOptions options,final RiakResponseHandler<RiakObject<byte[]>> handler){
  notNull(content,"String_Node_Str");
  notNull(options,"String_Node_Str");
  notNull(handler,"String_Node_Str");
  RpbPutReq.Builder builder=buildPostRequest(content,options);
  if (options.getReturnBody() == false) {
    return _post("String_Node_Str",content,handler,builder);
  }
  final Location location=content.getLocation();
  final String procedure="String_Node_Str";
  return handle(procedure,builder.build(),handler,new MessageHandler(){
    @Override public boolean handle(    Object receive,    CountDownRiakFuture future) throws Exception {
      if (receive instanceof RpbPutResp) {
        RpbPutResp resp=(RpbPutResp)receive;
        Location newloc=location;
        if (resp.hasKey()) {
          newloc=new Location(location.getBucket(),resp.getKey().toStringUtf8());
        }
        String vclock=toVclock(resp.getVclock());
        if (0 < resp.getContentCount()) {
          RpbContent c=resp.getContent(0);
          RiakObject<byte[]> ro=convert(newloc,vclock,c);
          handler.handle(ProtoBufRiakOperations.this.support.newResponse(ro));
        }
        future.setSuccess();
        return true;
      }
      return false;
    }
  }
);
}

Fixed version (ground truth):
@Override public RiakFuture post(RiakObject<byte[]> content,PostOptions options,final RiakResponseHandler<RiakObject<byte[]>> handler){
  notNull(content,"String_Node_Str");
  notNull(options,"String_Node_Str");
  notNull(handler,"String_Node_Str");
  RpbPutReq.Builder builder=buildPostRequest(content,options);
  if (options.getReturnBody() == false) {
    return _post("String_Node_Str",content,handler,builder);
  }
  final Location location=content.getLocation();
  final String procedure="String_Node_Str";
  return handle(procedure,builder.build(),handler,new MessageHandler(){
    @Override public boolean handle(    Object receive,    CountDownRiakFuture future) throws Exception {
      if (receive instanceof RpbPutResp) {
        RpbPutResp resp=(RpbPutResp)receive;
        Location newloc=location;
        if (resp.hasKey()) {
          newloc=new Location(location.getBucket(),resp.getKey().toStringUtf8());
        }
        String vclock=toVclock(resp.getVclock());
        if (0 < resp.getContentCount()) {
          RpbContent c=resp.getContent(0);
          RiakObject<byte[]> ro=convert(newloc,vclock,c);
          handler.handle(ProtoBufRiakOperations.this.support.newResponse(ro));
        }
        future.setSuccess();
        return true;
      }
      return false;
    }
  }
);
}
Program: 153475
Project: 153475
Buggy source:
protected void merge(PutOptions options,RpbPutReq.Builder builder){
  if (StringUtil.isEmpty(options.getVectorClock()) == false) {
    ByteString clock=fromVclock(options.getVectorClock());
    builder.setVclock(clock);
  }
  if (options.getWriteQuorum() != null) {
    builder.setW(options.getWriteQuorum().getInteger());
  }
  if (options.getDurableWriteQuorum() != null) {
    builder.setDw(options.getDurableWriteQuorum().getInteger());
  }
  if (options.getReturnBody()) {
    builder.setReturnBody(options.getReturnBody());
  }
}

Fixed version (ground truth):
protected void merge(StoreOptions options,RpbPutReq.Builder builder){
  if (options.getWriteQuorum() != null) {
    builder.setW(options.getWriteQuorum().getInteger());
  }
  if (options.getDurableWriteQuorum() != null) {
    builder.setDw(options.getDurableWriteQuorum().getInteger());
  }
  if (options.getReturnBody()) {
    builder.setReturnBody(options.getReturnBody());
  }
}
Program: 153476
Project: 153476
Buggy source:
protected RpbPutReq.Builder buildPostRequest(RiakObject<byte[]> content,PutOptions options){
  RpbPutReq.Builder builder=buildPostRequest(content);
  merge(options,builder);
  return builder;
}

Fixed version (ground truth):
protected RpbPutReq.Builder buildPostRequest(RiakObject<byte[]> content,PostOptions options){
  RpbPutReq.Builder builder=buildPostRequest(content);
  merge(options,builder);
  return builder;
}
Program: 153477
Project: 153477
Buggy source:
protected RpbPutReq.Builder buildPutRequest(RiakObject<byte[]> content,PutOptions options){
  RpbPutReq.Builder builder=buildPutRequest(content);
  merge(options,builder);
  return builder;
}

Fixed version (ground truth):
protected RpbPutReq.Builder buildPutRequest(RiakObject<byte[]> content,PutOptions options){
  RpbPutReq.Builder builder=buildPutRequest(content);
  if (StringUtil.isEmpty(content.getVectorClock()) == false) {
    builder.setVclock(fromVclock(content.getVectorClock()));
  }
  merge(options,builder);
  return builder;
}
Program: 153478
Project: 153478
Buggy source:
@Override public RiakFuture post(RiakObject<byte[]> content,PutOptions options,final RiakResponseHandler<RiakObject<byte[]>> handler){
  notNull(content,"String_Node_Str");
  notNull(options,"String_Node_Str");
  notNull(handler,"String_Node_Str");
  HttpRequest request=this.factory.newPostRequest(content,options);
  if (options.getReturnBody() == false) {
    return _post("String_Node_Str",content,handler,request);
  }
  final String procedure="String_Node_Str";
  return handle(procedure,request,handler,new ChunkedMessageAggregator(procedure,new MessageHandler(){
    @Override public boolean handle(    Object receive,    CountDownRiakFuture future) throws Exception {
      HttpResponse response=(HttpResponse)receive;
      Location location=to(response);
      RiakObject<byte[]> ro=RestRiakOperations.this.factory.convert(response,response.getContent(),location);
      handler.handle(RestRiakOperations.this.support.newResponse(ro));
      future.setSuccess();
      return true;
    }
  }
));
}

Fixed version (ground truth):
@Override public RiakFuture post(RiakObject<byte[]> content,PostOptions options,final RiakResponseHandler<RiakObject<byte[]>> handler){
  notNull(content,"String_Node_Str");
  notNull(options,"String_Node_Str");
  notNull(handler,"String_Node_Str");
  HttpRequest request=this.factory.newPostRequest(content,options);
  if (options.getReturnBody() == false) {
    return _post("String_Node_Str",content,handler,request);
  }
  final String procedure="String_Node_Str";
  return handle(procedure,request,handler,new ChunkedMessageAggregator(procedure,new MessageHandler(){
    @Override public boolean handle(    Object receive,    CountDownRiakFuture future) throws Exception {
      HttpResponse response=(HttpResponse)receive;
      Location location=to(response);
      RiakObject<byte[]> ro=RestRiakOperations.this.factory.convert(response,response.getContent(),location);
      handler.handle(RestRiakOperations.this.support.newResponse(ro));
      future.setSuccess();
      return true;
    }
  }
));
}
Program: 153480
Project: 153480
Buggy source:
public HttpRequest newPostRequest(RiakObject<byte[]> content,PutOptions options){
  HttpRequest request=newPostRequest(content);
  QueryStringEncoder params=to(options,request);
  request.setUri(params.toString());
  return request;
}

Fixed version (ground truth):
public HttpRequest newPostRequest(RiakObject<byte[]> content,PostOptions options){
  HttpRequest request=newPostRequest(content);
  QueryStringEncoder params=to(options,request);
  request.setUri(params.toString());
  return request;
}
Program: 153481
Project: 153481
Buggy source:
protected QueryStringEncoder to(PutOptions options,HttpRequest request){
  QueryStringEncoder params=new QueryStringEncoder(request.getUri());
  if (options.getReadQuorum() != null) {
    params.addParam("String_Node_Str",options.getReadQuorum().getString());
  }
  if (options.getWriteQuorum() != null) {
    params.addParam("String_Node_Str",options.getWriteQuorum().getString());
  }
  if (options.getDurableWriteQuorum() != null) {
    params.addParam("String_Node_Str",options.getDurableWriteQuorum().getString());
  }
  if (options.getReturnBody()) {
    params.addParam("String_Node_Str",String.valueOf(options.getReturnBody()));
  }
  return params;
}

Fixed version (ground truth):
protected QueryStringEncoder to(StoreOptions options,HttpRequest request){
  QueryStringEncoder params=new QueryStringEncoder(request.getUri());
  if (options.getWriteQuorum() != null) {
    params.addParam("String_Node_Str",options.getWriteQuorum().getString());
  }
  if (options.getDurableWriteQuorum() != null) {
    params.addParam("String_Node_Str",options.getDurableWriteQuorum().getString());
  }
  if (options.getReturnBody()) {
    params.addParam("String_Node_Str",String.valueOf(options.getReturnBody()));
  }
  return params;
}
Program: 153482
Project: 153482
Buggy source:
public HttpRequest newPutRequest(RiakObject<byte[]> content,PutOptions options){
  HttpRequest request=newPutRequest(content);
  QueryStringEncoder params=to(options,request);
  request.setUri(params.toString());
  return request;
}

Fixed version (ground truth):
public HttpRequest newPutRequest(RiakObject<byte[]> content,PutOptions options){
  HttpRequest request=newPutRequest(content);
  if (StringUtil.isEmpty(options.getIfNoneMatch()) == false) {
    request.addHeader(HttpHeaders.Names.IF_NONE_MATCH,options.getIfNoneMatch());
  }
  if (StringUtil.isEmpty(options.getIfMatch()) == false) {
    request.addHeader(HttpHeaders.Names.IF_MATCH,options.getIfMatch());
  }
  if (options.getIfModifiedSince() != null) {
    request.addHeader(HttpHeaders.Names.IF_MODIFIED_SINCE,HttpUtil.format(options.getIfModifiedSince()));
  }
  if (options.getIfUnmodifiedSince() != null) {
    request.addHeader(HttpHeaders.Names.IF_UNMODIFIED_SINCE,HttpUtil.format(options.getIfUnmodifiedSince()));
  }
  QueryStringEncoder params=to(options,request);
  request.setUri(params.toString());
  return request;
}
Program: 153483
Project: 153483
Buggy source:
public Location testPostWithReturn(final Location location,final String testdata) throws Exception {
  DefaultRiakObject ro=new DefaultRiakObject(location);
  ro.setContent(testdata.getBytes());
  PutOptions options=new DefaultPutOptions(){
    @Override public boolean getReturnBody(){
      return true;
    }
  }
;
  final Location[] loc=new Location[1];
  RiakFuture waiter=this.target.post(ro,options,new TestingHandler<RiakObject<byte[]>>(){
    @Override public void handle(    RiakContentsResponse<RiakObject<byte[]>> response) throws Exception {
      RiakObject<byte[]> returned=response.getContents();
      assertNotNull(returned.getLocation());
      Location l=returned.getLocation();
      assertEquals(location.getBucket(),l.getBucket());
      assertFalse(l.getKey().isEmpty());
      loc[0]=l;
    }
  }
);
  waitFor(waiter);
  return loc[0];
}

Fixed version (ground truth):
public Location testPostWithReturn(final Location location,final String testdata) throws Exception {
  DefaultRiakObject ro=new DefaultRiakObject(location);
  ro.setContent(testdata.getBytes());
  PostOptions options=new DefaultPostOptions(){
    @Override public boolean getReturnBody(){
      return true;
    }
  }
;
  final Location[] loc=new Location[1];
  RiakFuture waiter=this.target.post(ro,options,new TestingHandler<RiakObject<byte[]>>(){
    @Override public void handle(    RiakContentsResponse<RiakObject<byte[]>> response) throws Exception {
      RiakObject<byte[]> returned=response.getContents();
      assertNotNull(returned.getLocation());
      Location l=returned.getLocation();
      assertEquals(location.getBucket(),l.getBucket());
      assertFalse(l.getKey().isEmpty());
      loc[0]=l;
    }
  }
);
  waitFor(waiter);
  return loc[0];
}