nus-yam/ex-repair huggingface dataset:
Program: 63744
Project: 63744
Buggy source:
@Override public void processCommand(ICommandSender sender,String[] arguments){
  if (arguments.length <= 0)   throw new WrongUsageException(StringUtil.localize("String_Node_Str",this.getCommandUsage(sender)));
  if (arguments[0].matches("String_Node_Str")) {
    commandTrades(sender,arguments);
    return;
  }
 else   if (arguments[0].matches("String_Node_Str")) {
    commandVirtualize(sender,arguments);
    return;
  }
 else   if (arguments[0].matches("String_Node_Str")) {
    sendChatMessage(sender,StringUtil.localize("String_Node_Str",this.getCommandName()));
    sendChatMessage(sender,StringUtil.localize("String_Node_Str"));
    sendChatMessage(sender,StringUtil.localize("String_Node_Str"));
    sendChatMessage(sender,StringUtil.localize("String_Node_Str"));
    return;
  }
  throw new WrongUsageException(this.getCommandUsage(sender));
}

Fixed version (ground truth):
@Override public void processCommand(ICommandSender sender,String[] arguments){
  if (arguments.length <= 0)   throw new WrongUsageException(StringUtil.localizeAndFormat("String_Node_Str",this.getCommandUsage(sender)));
  if (arguments[0].matches("String_Node_Str")) {
    commandTrades(sender,arguments);
    return;
  }
 else   if (arguments[0].matches("String_Node_Str")) {
    commandVirtualize(sender,arguments);
    return;
  }
 else   if (arguments[0].matches("String_Node_Str")) {
    sendChatMessage(sender,StringUtil.localizeAndFormat("String_Node_Str",this.getCommandName()));
    sendChatMessage(sender,StringUtil.localize("String_Node_Str"));
    sendChatMessage(sender,StringUtil.localize("String_Node_Str"));
    sendChatMessage(sender,StringUtil.localize("String_Node_Str"));
    return;
  }
  throw new WrongUsageException(this.getCommandUsage(sender));
}
Program: 63745
Project: 63745
Buggy source:
@Override public boolean onItemPickup(EntityPlayer player,EntityItem entityitem){
  ItemStack itemstack=entityitem.getEntityItem();
  if (itemstack == null || itemstack.stackSize <= 0)   return false;
  if (player.openContainer instanceof ContainerBackpack || player.openContainer instanceof ContainerNaturalistInventory)   return true;
  topOffPlayerInventory(player,itemstack);
  for (  ItemStack pack : player.inventory.mainInventory) {
    if (pack == null || pack.stackSize <= 0)     continue;
    if (itemstack == null || itemstack.stackSize <= 0)     break;
    if (!(pack.getItem() instanceof ItemBackpack))     continue;
    ItemBackpack backpack=((ItemBackpack)pack.getItem());
    if (backpack.getDefinition().isValidItem(player,itemstack))     backpack.tryStowing(player,pack,itemstack);
  }
  if (itemstack == null || itemstack.stackSize <= 0)   return false;
 else   return true;
}

Fixed version (ground truth):
@Override public boolean onItemPickup(EntityPlayer player,EntityItem entityitem){
  ItemStack itemstack=entityitem.getEntityItem();
  if (itemstack == null || itemstack.stackSize <= 0)   return false;
  if (player.openContainer instanceof ContainerBackpack || player.openContainer instanceof ContainerNaturalistBackpack)   return true;
  topOffPlayerInventory(player,itemstack);
  for (  ItemStack pack : player.inventory.mainInventory) {
    if (pack == null || pack.stackSize <= 0)     continue;
    if (itemstack == null || itemstack.stackSize <= 0)     break;
    if (!(pack.getItem() instanceof ItemBackpack))     continue;
    ItemBackpack backpack=((ItemBackpack)pack.getItem());
    if (backpack.getDefinition().isValidItem(player,itemstack))     backpack.tryStowing(player,pack,itemstack);
  }
  if (itemstack == null || itemstack.stackSize <= 0)   return false;
 else   return true;
}
Program: 63746
Project: 63746
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer entityplayer){
  if (Proxies.common.isSimulating(world)) {
    if (contained == null)     return itemstack;
    itemstack.stackSize--;
    EntityItem entity=new EntityItem(world,entityplayer.posX,entityplayer.posY,entityplayer.posZ,new ItemStack(contained.getItem(),9,contained.getItemDamage()));
    entity.delayBeforeCanPickup=40;
    float f1=0.3F;
    entity.motionX=-MathHelper.sin((entityplayer.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((entityplayer.rotationPitch / 180F) * 3.141593F) * f1;
    entity.motionZ=MathHelper.cos((entityplayer.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((entityplayer.rotationPitch / 180F) * 3.141593F) * f1;
    entity.motionY=-MathHelper.sin((entityplayer.rotationPitch / 180F) * 3.141593F) * f1 + 0.1F;
    f1=0.02F;
    float f3=world.rand.nextFloat() * 3.141593F * 2.0F;
    f1*=world.rand.nextFloat();
    entity.motionX+=Math.cos(f3) * f1;
    entity.motionY+=(world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
    entity.motionZ+=Math.sin(f3) * f1;
    world.spawnEntityInWorld(entity);
  }
  return itemstack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer entityplayer){
  if (Proxies.common.isSimulating(world)) {
    if (contained == null || itemstack.stackSize == 0)     return itemstack;
    itemstack.stackSize--;
    EntityItem entity=new EntityItem(world,entityplayer.posX,entityplayer.posY,entityplayer.posZ,new ItemStack(contained.getItem(),9,contained.getItemDamage()));
    entity.delayBeforeCanPickup=40;
    float f1=0.3F;
    entity.motionX=-MathHelper.sin((entityplayer.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((entityplayer.rotationPitch / 180F) * 3.141593F) * f1;
    entity.motionZ=MathHelper.cos((entityplayer.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((entityplayer.rotationPitch / 180F) * 3.141593F) * f1;
    entity.motionY=-MathHelper.sin((entityplayer.rotationPitch / 180F) * 3.141593F) * f1 + 0.1F;
    f1=0.02F;
    float f3=world.rand.nextFloat() * 3.141593F * 2.0F;
    f1*=world.rand.nextFloat();
    entity.motionX+=Math.cos(f3) * f1;
    entity.motionY+=(world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
    entity.motionZ+=Math.sin(f3) * f1;
    world.spawnEntityInWorld(entity);
  }
  return itemstack;
}
Program: 63747
Project: 63747
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  AccountInfo accountInfo=AccountInfo.getSavedAccountInfo(AccountEditor.this,spinnerItems[position]);
  tempAccountCategory=spinnerItems[position];
  if (accountInfo.getAccountCategory() != null) {
    userName.setText(accountInfo.getUserName());
    passWord.setText(accountInfo.getPassWord());
  }
 else {
    userName.setText("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  AccountInfo accountInfo=AccountInfo.getSavedAccountInfo(AccountEditor.this,spinnerItems[position]);
  tempAccountCategory=spinnerItems[position];
  if (accountInfo.getAccountCategory() != null) {
    userName.setText(accountInfo.getUserName());
    passWord.setText(accountInfo.getPassWord());
  }
}
Program: 63748
Project: 63748
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_account_editor);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  accountCategory=getIntent().getStringExtra("String_Node_Str");
  tempAccountCategory="String_Node_Str";
  userName=(EditText)findViewById(R.id.accountEditorActivityUserName);
  passWord=(EditText)findViewById(R.id.accountEditorActivityPassword);
  setSpinner();
  Button saveAccountInfo=(Button)findViewById(R.id.accountEditorActivityButton);
  saveAccountInfo.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (accountCategory.equals("String_Node_Str")) {
        accountCategory=tempAccountCategory;
      }
      SharedPreferences.Editor accountInfo=getSharedPreferences(accountCategory,MODE_PRIVATE).edit();
      accountInfo.putString(accountCategory,accountCategory);
      accountInfo.putString("String_Node_Str",userName.getText().toString());
      accountInfo.putString("String_Node_Str",passWord.getText().toString());
      if (accountCategory.equals("String_Node_Str")) {
        accountInfo.putString("String_Node_Str","String_Node_Str");
      }
 else       if (accountCategory.equals("String_Node_Str")) {
        accountInfo.putString("String_Node_Str","String_Node_Str");
      }
 else       if (accountCategory.equals("String_Node_Str")) {
        accountInfo.putString("String_Node_Str","String_Node_Str");
      }
      accountInfo.commit();
      finish();
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_account_editor);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  accountCategory=getIntent().getStringExtra("String_Node_Str");
  tempAccountCategory="String_Node_Str";
  userName=(EditText)findViewById(R.id.editTextUsername);
  passWord=(EditText)findViewById(R.id.editTextPassword);
  setSpinner();
  Button saveAccountInfo=(Button)findViewById(R.id.buttonSave);
  saveAccountInfo.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (accountCategory.equals("String_Node_Str"))       accountCategory=tempAccountCategory;
      SharedPreferences.Editor accountInfo=getSharedPreferences(accountCategory,MODE_PRIVATE).edit();
      accountInfo.putString(accountCategory,accountCategory);
      accountInfo.putString("String_Node_Str",userName.getText().toString());
      accountInfo.putString("String_Node_Str",passWord.getText().toString());
      if (accountCategory.equals("String_Node_Str")) {
        accountInfo.putString("String_Node_Str","String_Node_Str");
      }
 else       if (accountCategory.equals("String_Node_Str")) {
        accountInfo.putString("String_Node_Str","String_Node_Str");
      }
 else       if (accountCategory.equals("String_Node_Str")) {
        accountInfo.putString("String_Node_Str","String_Node_Str");
      }
      accountInfo.apply();
      finish();
    }
  }
);
}
Program: 63749
Project: 63749
Buggy source:
@Override public void onNothingSelected(AdapterView<?> parent){
  userName.setText("String_Node_Str");
}

Fixed version (ground truth):
@Override public void onNothingSelected(AdapterView<?> parent){
}
Program: 63750
Project: 63750
Buggy source:
@Override public void onClick(View view){
  if (accountCategory.equals("String_Node_Str")) {
    accountCategory=tempAccountCategory;
  }
  SharedPreferences.Editor accountInfo=getSharedPreferences(accountCategory,MODE_PRIVATE).edit();
  accountInfo.putString(accountCategory,accountCategory);
  accountInfo.putString("String_Node_Str",userName.getText().toString());
  accountInfo.putString("String_Node_Str",passWord.getText().toString());
  if (accountCategory.equals("String_Node_Str")) {
    accountInfo.putString("String_Node_Str","String_Node_Str");
  }
 else   if (accountCategory.equals("String_Node_Str")) {
    accountInfo.putString("String_Node_Str","String_Node_Str");
  }
 else   if (accountCategory.equals("String_Node_Str")) {
    accountInfo.putString("String_Node_Str","String_Node_Str");
  }
  accountInfo.commit();
  finish();
}

Fixed version (ground truth):
@Override public void onClick(View view){
  if (accountCategory.equals("String_Node_Str"))   accountCategory=tempAccountCategory;
  SharedPreferences.Editor accountInfo=getSharedPreferences(accountCategory,MODE_PRIVATE).edit();
  accountInfo.putString(accountCategory,accountCategory);
  accountInfo.putString("String_Node_Str",userName.getText().toString());
  accountInfo.putString("String_Node_Str",passWord.getText().toString());
  if (accountCategory.equals("String_Node_Str")) {
    accountInfo.putString("String_Node_Str","String_Node_Str");
  }
 else   if (accountCategory.equals("String_Node_Str")) {
    accountInfo.putString("String_Node_Str","String_Node_Str");
  }
 else   if (accountCategory.equals("String_Node_Str")) {
    accountInfo.putString("String_Node_Str","String_Node_Str");
  }
  accountInfo.apply();
  finish();
}
Program: 63751
Project: 63751
Buggy source:
private void setSpinner(){
  Spinner spinner=(Spinner)findViewById(R.id.accountEditorActivityAccountCategory);
  final String[] spinnerItems=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  spinner.setAdapter(new ArrayAdapter<String>(AccountEditor.this,android.R.layout.simple_spinner_item,spinnerItems));
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      AccountInfo accountInfo=AccountInfo.getSavedAccountInfo(AccountEditor.this,spinnerItems[position]);
      tempAccountCategory=spinnerItems[position];
      if (accountInfo.getAccountCategory() != null) {
        userName.setText(accountInfo.getUserName());
        passWord.setText(accountInfo.getPassWord());
      }
 else {
        userName.setText("String_Node_Str");
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
      userName.setText("String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
private void setSpinner(){
  Spinner spinner=(Spinner)findViewById(R.id.spinnerCategory);
  final String[] spinnerItems=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  spinner.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,spinnerItems));
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      AccountInfo accountInfo=AccountInfo.getSavedAccountInfo(AccountEditor.this,spinnerItems[position]);
      tempAccountCategory=spinnerItems[position];
      if (accountInfo.getAccountCategory() != null) {
        userName.setText(accountInfo.getUserName());
        passWord.setText(accountInfo.getPassWord());
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}
Program: 63752
Project: 63752
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (Configuration.HOME_PAGE_WEBSITE) {
    setContentView(R.layout.activity_main_webview);
    WebView webView=(WebView)findViewById(R.id.webView);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(Configuration.HOME_PAGE_WEBSITE_URL);
    webView.setWebViewClient(new WebViewClient(){
      public boolean shouldOverrideUrlLoading(      WebView view,      String url){
        view.loadUrl(url);
        return true;
      }
    }
);
  }
 else {
    setContentView(R.layout.activity_main_image);
    ImageView imageView=(ImageView)findViewById(R.id.imageView);
    try {
      imageView.setImageBitmap(MediaStore.Images.Media.getBitmap(this.getContentResolver(),Configuration.HOME_PAGE_IMAGE_PATH));
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  WebView webView=(WebView)findViewById(R.id.webView);
  if (Configuration.HOME_SHOW_WEBPAGE) {
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(Configuration.HOME_WEBPAGE_URL);
    webView.setWebViewClient(new WebViewClient(){
      public boolean shouldOverrideUrlLoading(      WebView view,      String url){
        view.loadUrl(url);
        return true;
      }
    }
);
  }
 else {
    webView.setVisibility(View.GONE);
  }
}
Program: 63754
Project: 63754
Buggy source:
private void enable_functions_or_hide_views(){
  if (Configuration.ENABLE_NFC) {
    if (!enable_nfc()) {
      nfcTextView.setText("String_Node_Str");
    }
  }
 else {
    nfcTextView.setVisibility(View.GONE);
  }
  if (Configuration.ENABLE_PHOTO_LOCATION_MODIFICATION) {
    enable_location_modification();
  }
 else {
    locationSwitch.setVisibility(View.GONE);
    locationButton.setVisibility(View.GONE);
  }
  try {
    preview.setImageBitmap(MediaStore.Images.Media.getBitmap(this.getContentResolver(),imageUri));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (Configuration.ENABLE_ANDROID_SHARING) {
    enable_android_sharing();
  }
 else {
    AndroidSharingListButton.setVisibility(View.GONE);
  }
  if (Configuration.ENABLE_BLUETOOTH) {
    enable_bluetooth();
  }
 else {
    bluetoothButton.setVisibility(View.GONE);
  }
  if (Configuration.ENABLE_DONATE) {
    enable_donate();
  }
 else {
    donateButton.setVisibility(View.GONE);
  }
  if (Configuration.ENABLE_ADVERTISEMENT) {
    enable_adView();
  }
}

Fixed version (ground truth):
private void enable_functions_or_hide_views(){
  if (Configuration.ENABLE_NFC) {
    if (!enable_nfc()) {
      nfcTextView.setText("String_Node_Str");
    }
  }
 else {
    nfcTextView.setVisibility(View.GONE);
  }
  if (Configuration.ENABLE_PHOTO_LOCATION_MODIFICATION) {
    enable_location_modification();
  }
 else {
    locationSwitch.setVisibility(View.GONE);
    locationButton.setVisibility(View.GONE);
  }
  try {
    preview.setImageBitmap(MediaStore.Images.Media.getBitmap(this.getContentResolver(),imageUri));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (Configuration.ENABLE_ANDROID_SHARING) {
    enable_android_sharing();
  }
 else {
    AndroidSharingListButton.setVisibility(View.GONE);
  }
  if (Configuration.ENABLE_BLUETOOTH) {
    enable_bluetooth();
  }
 else {
    bluetoothButton.setVisibility(View.GONE);
  }
  if (Configuration.ENABLE_ADVERTISEMENT) {
    enable_adView();
  }
}
Program: 63755
Project: 63755
Buggy source:
private void find_views(){
  bluetoothButton=(Button)findViewById(R.id.bluetoothButton);
  AndroidSharingListButton=(Button)findViewById(R.id.otherButton);
  donateButton=(Button)findViewById(R.id.donateButton);
  preview=(ImageView)findViewById(R.id.imageView);
  descriptionEditText=(EditText)findViewById(R.id.descriptionEditText);
  nfcTextView=(TextView)findViewById(R.id.nfcTextView);
  imageUri=(Uri)getIntent().getExtras().get("String_Node_Str");
  locationSwitch=(Switch)findViewById(R.id.locationSwitch);
  locationButton=(Button)findViewById(R.id.locationButton);
}

Fixed version (ground truth):
private void find_views(){
  bluetoothButton=(Button)findViewById(R.id.bluetoothButton);
  AndroidSharingListButton=(Button)findViewById(R.id.otherButton);
  preview=(ImageView)findViewById(R.id.imageView);
  descriptionEditText=(EditText)findViewById(R.id.descriptionEditText);
  nfcTextView=(TextView)findViewById(R.id.nfcTextView);
  imageUri=(Uri)getIntent().getExtras().get("String_Node_Str");
  locationSwitch=(Switch)findViewById(R.id.locationSwitch);
  locationButton=(Button)findViewById(R.id.locationButton);
}
Program: 63756
Project: 63756
Buggy source:
public ShareToDrupal(Activity activity,AccountInfo accountInfo,String imagePath,String imageTitle){
  assertNotNullOrEmpty(context);
  assertNotNullOrEmpty(accountInfo);
  assertNotNullOrEmpty(imageTitle);
  assertNotNullOrEmpty(imagePath);
  this.activity=activity;
  this.context=activity.getApplicationContext();
  this.accountInfo=accountInfo;
  this.imagePath=imagePath;
  this.imageTitle=imageTitle;
  drupalURL=Configuration.DRUPAL_ROOT_URL;
}

Fixed version (ground truth):
public ShareToDrupal(Activity activity,AccountInfo accountInfo,String imagePath,String imageTitle){
  assertNotNullOrEmpty(activity);
  assertNotNullOrEmpty(accountInfo);
  assertNotNullOrEmpty(imagePath);
  assertNotNullOrEmpty(imageTitle);
  this.activity=activity;
  this.context=activity.getApplicationContext();
  this.accountInfo=accountInfo;
  this.imagePath=imagePath;
  this.imageTitle=imageTitle;
  drupalURL=Configuration.DRUPAL_ROOT_URL;
}
Program: 63757
Project: 63757
Buggy source:
public void saveSexagesimalBack(Uri imageUri,double latitude,double longitude) throws IOException {
  ExifInterface exifInterface=new ExifInterface(imageUri.getPath());
  if (latitude < 0) {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE_REF,"String_Node_Str");
  }
 else {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE_REF,"String_Node_Str");
  }
  exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE,convertToSexagesimal(latitude));
  if (longitude < 0) {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF,"String_Node_Str");
  }
 else {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF,"String_Node_Str");
  }
  exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE,convertToSexagesimal(longitude));
}

Fixed version (ground truth):
public void saveSexagesimalBack(Uri imageUri,double latitude,double longitude) throws IOException {
  ExifInterface exifInterface=new ExifInterface(imageUri.getPath());
  if (latitude < 0) {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE_REF,"String_Node_Str");
  }
 else {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE_REF,"String_Node_Str");
  }
  exifInterface.setAttribute(ExifInterface.TAG_GPS_LATITUDE,convertToSexagesimal(latitude));
  if (longitude < 0) {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF,"String_Node_Str");
  }
 else {
    exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF,"String_Node_Str");
  }
  exifInterface.setAttribute(ExifInterface.TAG_GPS_LONGITUDE,convertToSexagesimal(longitude));
  exifInterface.saveAttributes();
}
Program: 63758
Project: 63758
Buggy source:
public String convertToDegreeForm(Uri imageUri) throws IOException {
  ExifInterface exifInterface=new ExifInterface(imageUri.getPath());
  return getDegree(exifInterface.getAttribute(ExifInterface.TAG_GPS_LATITUDE),ExifInterface.TAG_GPS_LATITUDE_REF) + "String_Node_Str" + getDegree(exifInterface.getAttribute(ExifInterface.TAG_GPS_LONGITUDE),ExifInterface.TAG_GPS_LONGITUDE_REF);
}

Fixed version (ground truth):
public String convertToDegreeForm(Uri imageUri) throws IOException {
  ExifInterface exifInterface=new ExifInterface(imageUri.getPath());
  return getDegree(exifInterface.getAttribute(ExifInterface.TAG_GPS_LATITUDE),exifInterface.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF)) + "String_Node_Str" + getDegree(exifInterface.getAttribute(ExifInterface.TAG_GPS_LONGITUDE),exifInterface.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF));
}
Program: 63759
Project: 63759
Buggy source:
public RangeSeekbar(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  applyConfig(context,attrs);
  mPaddingRect=new Rect(getPaddingLeft(),getPaddingTop(),getPaddingRight(),getPaddingBottom());
  mLeftCursorRect=new Rect();
  mRightCursorRect=new Rect();
  mSeekbarRect=new RectF();
  mSeekbarRectSelected=new RectF();
  mTextWidthArray=new float[mTextArray.length];
  mLeftScroller=new Scroller(context,new DecelerateInterpolator());
  mRightScroller=new Scroller(context,new DecelerateInterpolator());
  initPaint();
  initTextWidthArray();
  setWillNotDraw(false);
  setFocusable(true);
  setClickable(true);
}

Fixed version (ground truth):
public RangeSeekbar(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  applyConfig(context,attrs);
  mPaddingRect=new Rect(getPaddingLeft(),getPaddingTop(),getPaddingRight(),getPaddingBottom());
  mLeftCursorRect=new Rect();
  mRightCursorRect=new Rect();
  mSeekbarRect=new RectF();
  mSeekbarRectSelected=new RectF();
  if (mTextArray != null) {
    mTextWidthArray=new float[mTextArray.length];
  }
  mLeftScroller=new Scroller(context,new DecelerateInterpolator());
  mRightScroller=new Scroller(context,new DecelerateInterpolator());
  initPaint();
  initTextWidthArray();
  setWillNotDraw(false);
  setFocusable(true);
  setClickable(true);
}
Program: 63760
Project: 63760
Buggy source:
/** 
 * This method should be called after   {@link #setTextMarkSize(int)}, because view will measure size of text mark by paint.
 * @param size
 */
public void setTextMarks(CharSequence... marks){
  if (marks == null || marks.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextArray=marks;
  mLeftCursorIndex=0;
  mRightCursorIndex=mTextArray.length - 1;
  mRightCursorNextIndex=(int)mRightCursorIndex;
  initTextWidthArray();
  requestLayout();
  invalidate();
}

Fixed version (ground truth):
/** 
 * This method should be called after   {@link #setTextMarkSize(int)}, because view will measure size of text mark by paint.
 * @param size
 */
public void setTextMarks(CharSequence... marks){
  if (marks == null || marks.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextArray=marks;
  mLeftCursorIndex=0;
  mRightCursorIndex=mTextArray.length - 1;
  mRightCursorNextIndex=(int)mRightCursorIndex;
  mTextWidthArray=new float[marks.length];
  initTextWidthArray();
  requestLayout();
  invalidate();
}
Program: 63761
Project: 63761
Buggy source:
public void setLeftSelection(int partIndex){
  if (partIndex >= mTextArray.length - 1 || partIndex <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (partIndex != mLeftCursorIndex) {
    if (!mLeftScroller.isFinished()) {
      mLeftScroller.abortAnimation();
    }
    mLeftCursorNextIndex=partIndex;
    final int leftFromX=(int)(mLeftCursorIndex * mPartLength);
    mLeftScroller.startScroll(leftFromX,0,mLeftCursorNextIndex * mPartLength - leftFromX,0,mDuration);
    triggleCallback(true,mLeftCursorNextIndex);
    if (mRightCursorIndex <= mLeftCursorNextIndex) {
      if (!mRightScroller.isFinished()) {
        mRightScroller.abortAnimation();
      }
      mRightCursorNextIndex=mLeftCursorNextIndex + 1;
      final int rightFromX=(int)(mRightCursorIndex * mPartLength);
      mRightScroller.startScroll(rightFromX,0,mRightCursorNextIndex * mPartLength - rightFromX,0,mDuration);
      triggleCallback(false,mRightCursorNextIndex);
    }
    invalidate();
  }
}

Fixed version (ground truth):
public void setLeftSelection(int partIndex){
  if (partIndex >= mTextArray.length - 1 || partIndex < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mPartLength == 0) {
    mLeftCursorIndex=partIndex;
    return;
  }
  if (partIndex != mLeftCursorIndex) {
    if (!mLeftScroller.isFinished()) {
      mLeftScroller.abortAnimation();
    }
    mLeftCursorNextIndex=partIndex;
    final int leftFromX=(int)(mLeftCursorIndex * mPartLength);
    mLeftScroller.startScroll(leftFromX,0,mLeftCursorNextIndex * mPartLength - leftFromX,0,mDuration);
    triggleCallback(true,mLeftCursorNextIndex);
    if (mRightCursorIndex <= mLeftCursorNextIndex) {
      if (!mRightScroller.isFinished()) {
        mRightScroller.abortAnimation();
      }
      mRightCursorNextIndex=mLeftCursorNextIndex + 1;
      final int rightFromX=(int)(mRightCursorIndex * mPartLength);
      mRightScroller.startScroll(rightFromX,0,mRightCursorNextIndex * mPartLength - rightFromX,0,mDuration);
      triggleCallback(false,mRightCursorNextIndex);
    }
    invalidate();
  }
}
Program: 63762
Project: 63762
Buggy source:
public void setRightSelection(int partIndex){
  if (partIndex >= mTextArray.length || partIndex <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (partIndex != mRightCursorIndex) {
    if (!mRightScroller.isFinished()) {
      mRightScroller.abortAnimation();
    }
    mRightCursorNextIndex=partIndex;
    final int rightFromX=(int)(mPartLength * mRightCursorIndex);
    mRightScroller.startScroll(rightFromX,0,mRightCursorNextIndex * mPartLength - rightFromX,0,mDuration);
    triggleCallback(false,mRightCursorNextIndex);
    if (mLeftCursorIndex >= mRightCursorNextIndex) {
      if (!mLeftScroller.isFinished()) {
        mLeftScroller.abortAnimation();
      }
      mLeftCursorNextIndex=mRightCursorNextIndex - 1;
      final int leftFromX=(int)(mLeftCursorIndex * mPartLength);
      mLeftScroller.startScroll(leftFromX,0,mLeftCursorNextIndex * mPartLength - leftFromX,0,mDuration);
      triggleCallback(true,mLeftCursorNextIndex);
    }
    invalidate();
  }
}

Fixed version (ground truth):
public void setRightSelection(int partIndex){
  if (partIndex > mTextArray.length - 1 || partIndex <= 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mPartLength == 0) {
    mRightCursorIndex=partIndex;
    return;
  }
  if (partIndex != mRightCursorIndex) {
    if (!mRightScroller.isFinished()) {
      mRightScroller.abortAnimation();
    }
    mRightCursorNextIndex=partIndex;
    final int rightFromX=(int)(mPartLength * mRightCursorIndex);
    mRightScroller.startScroll(rightFromX,0,mRightCursorNextIndex * mPartLength - rightFromX,0,mDuration);
    triggleCallback(false,mRightCursorNextIndex);
    if (mLeftCursorIndex >= mRightCursorNextIndex) {
      if (!mLeftScroller.isFinished()) {
        mLeftScroller.abortAnimation();
      }
      mLeftCursorNextIndex=mRightCursorNextIndex - 1;
      final int leftFromX=(int)(mLeftCursorIndex * mPartLength);
      mLeftScroller.startScroll(leftFromX,0,mLeftCursorNextIndex * mPartLength - leftFromX,0,mDuration);
      triggleCallback(true,mLeftCursorNextIndex);
    }
    invalidate();
  }
}
Program: 63763
Project: 63763
Buggy source:
public void setTextMarkColorSelected(int color){
  if (color <= 0 || color == Color.TRANSPARENT) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextColorSelected=color;
  invalidate();
}

Fixed version (ground truth):
public void setTextMarkColorSelected(int color){
  if (color == Color.TRANSPARENT) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextColorSelected=color;
  invalidate();
}
Program: 63764
Project: 63764
Buggy source:
public void setTextMarkColorNormal(int color){
  if (color <= 0 || color == Color.TRANSPARENT) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextColorNormal=color;
  invalidate();
}

Fixed version (ground truth):
public void setTextMarkColorNormal(int color){
  if (color == Color.TRANSPARENT) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextColorNormal=color;
  invalidate();
}
Program: 63766
Project: 63766
Buggy source:
public RangeSeekbar(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  applyConfig(context,attrs);
  mPaddingRect=new Rect(getPaddingLeft(),getPaddingTop(),getPaddingRight(),getPaddingBottom());
  mLeftCursorRect=new Rect();
  mRightCursorRect=new Rect();
  mSeekbarRect=new RectF();
  mSeekbarRectSelected=new RectF();
  mTextWidthArray=new float[mTextArray.length];
  mLeftScroller=new Scroller(context,new DecelerateInterpolator());
  mRightScroller=new Scroller(context,new DecelerateInterpolator());
  initPaint();
  setWillNotDraw(false);
  setFocusable(true);
  setClickable(true);
}

Fixed version (ground truth):
public RangeSeekbar(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  applyConfig(context,attrs);
  mPaddingRect=new Rect(getPaddingLeft(),getPaddingTop(),getPaddingRight(),getPaddingBottom());
  mLeftCursorRect=new Rect();
  mRightCursorRect=new Rect();
  mSeekbarRect=new RectF();
  mSeekbarRectSelected=new RectF();
  mTextWidthArray=new float[mTextArray.length];
  mLeftScroller=new Scroller(context,new DecelerateInterpolator());
  mRightScroller=new Scroller(context,new DecelerateInterpolator());
  initPaint();
  initTextWithArray();
  setWillNotDraw(false);
  setFocusable(true);
  setClickable(true);
}
Program: 63767
Project: 63767
Buggy source:
private void initPaint(){
  mPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaint.setAntiAlias(true);
  mPaint.setStyle(Style.FILL);
  mPaint.setTextSize(mTextSize);
  final int length=mTextArray.length;
  for (int i=0; i < length; i++) {
    mTextWidthArray[i]=mPaint.measureText(mTextArray[i].toString());
  }
}

Fixed version (ground truth):
private void initPaint(){
  mPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaint.setAntiAlias(true);
  mPaint.setStyle(Style.FILL);
  mPaint.setTextSize(mTextSize);
}
Program: 63768
Project: 63768
Buggy source:
public void setTextMarks(CharSequence... marks){
  if (marks == null || marks.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextArray=marks;
  mLeftCursorIndex=0;
  mRightCursorIndex=mTextArray.length - 1;
  mRightCursorNextIndex=(int)mRightCursorIndex;
}

Fixed version (ground truth):
public void setTextMarks(CharSequence... marks){
  if (marks == null || marks.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTextArray=marks;
  mLeftCursorIndex=0;
  mRightCursorIndex=mTextArray.length - 1;
  mRightCursorNextIndex=(int)mRightCursorIndex;
  initTextWithArray();
}
Program: 63769
Project: 63769
Buggy source:
private void applyConfig(Context context,AttributeSet attrs){
  if (attrs == null) {
    return;
  }
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.RangeSeekbar);
  mDuration=a.getInteger(R.styleable.RangeSeekbar_autoMoveDuration,DEFAULT_DURATION);
  mLeftCursorBG=a.getDrawable(R.styleable.RangeSeekbar_leftCursorBackground);
  mRightCursorBG=a.getDrawable(R.styleable.RangeSeekbar_rightCursorBackground);
  mTextColorNormal=a.getColor(R.styleable.RangeSeekbar_textColorNormal,Color.BLACK);
  mTextColorSelected=a.getColor(R.styleable.RangeSeekbar_textColorSelected,Color.rgb(242,79,115));
  mSeekbarColorNormal=a.getColor(R.styleable.RangeSeekbar_seekbarColorNormal,Color.rgb(218,215,215));
  mSeekbarColorSelected=a.getColor(R.styleable.RangeSeekbar_seekbarColorSelected,Color.rgb(242,79,115));
  mSeekbarHeight=(int)a.getDimension(R.styleable.RangeSeekbar_seekbarHeight,10);
  mTextSize=(int)a.getDimension(R.styleable.RangeSeekbar_textSize,15);
  mMarginBetween=(int)a.getDimension(R.styleable.RangeSeekbar_spaceBetween,15);
  mTextArray=a.getTextArray(R.styleable.RangeSeekbar_markTextArray);
  if (mTextArray != null && mTextArray.length > 0) {
    mLeftCursorIndex=0;
    mRightCursorIndex=mTextArray.length - 1;
    mRightCursorNextIndex=(int)mRightCursorIndex;
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  a.recycle();
}

Fixed version (ground truth):
private void applyConfig(Context context,AttributeSet attrs){
  if (attrs == null) {
    return;
  }
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.RangeSeekbar);
  mDuration=a.getInteger(R.styleable.RangeSeekbar_autoMoveDuration,DEFAULT_DURATION);
  mLeftCursorBG=a.getDrawable(R.styleable.RangeSeekbar_leftCursorBackground);
  mRightCursorBG=a.getDrawable(R.styleable.RangeSeekbar_rightCursorBackground);
  mTextColorNormal=a.getColor(R.styleable.RangeSeekbar_textColorNormal,Color.BLACK);
  mTextColorSelected=a.getColor(R.styleable.RangeSeekbar_textColorSelected,Color.rgb(242,79,115));
  mSeekbarColorNormal=a.getColor(R.styleable.RangeSeekbar_seekbarColorNormal,Color.rgb(218,215,215));
  mSeekbarColorSelected=a.getColor(R.styleable.RangeSeekbar_seekbarColorSelected,Color.rgb(242,79,115));
  mSeekbarHeight=(int)a.getDimension(R.styleable.RangeSeekbar_seekbarHeight,10);
  mTextSize=(int)a.getDimension(R.styleable.RangeSeekbar_textSize,15);
  mMarginBetween=(int)a.getDimension(R.styleable.RangeSeekbar_spaceBetween,15);
  mTextArray=a.getTextArray(R.styleable.RangeSeekbar_markTextArray);
  if (mTextArray != null && mTextArray.length > 0) {
    mLeftCursorIndex=0;
    mRightCursorIndex=mTextArray.length - 1;
    mRightCursorNextIndex=(int)mRightCursorIndex;
  }
  a.recycle();
}
Program: 63770
Project: 63770
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  final int heightSize=MeasureSpec.getSize(heightMeasureSpec);
  final int leftPointerH=mLeftCursorBG.getIntrinsicHeight();
  final int rightPointerH=mRightCursorBG.getIntrinsicHeight();
  final int maxOfCursor=Math.max(leftPointerH,rightPointerH);
  final int maxOfCursorAndSeekbar=Math.max(mSeekbarHeight,maxOfCursor);
  int heightNeeded=maxOfCursorAndSeekbar + mMarginBetween + mTextSize+ mPaddingRect.top+ mPaddingRect.bottom;
  heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.max(heightSize,heightNeeded),MeasureSpec.EXACTLY);
  final int widthSize=MeasureSpec.getSize(widthMeasureSpec);
  mSeekbarRect.left=mPaddingRect.left + mLeftCursorBG.getIntrinsicWidth() / 2;
  mSeekbarRect.right=widthSize - mPaddingRect.right - mRightCursorBG.getIntrinsicWidth() / 2;
  mSeekbarRect.top=mPaddingRect.top + mTextSize + mMarginBetween;
  mSeekbarRect.bottom=mSeekbarRect.top + mSeekbarHeight;
  mSeekbarRectSelected.top=mSeekbarRect.top;
  mSeekbarRectSelected.bottom=mSeekbarRect.bottom;
  mPartLength=((int)(mSeekbarRect.right - mSeekbarRect.left)) / (mTextArray.length - 1);
  mRightBoundary=(int)(mSeekbarRect.right + mRightCursorBG.getIntrinsicWidth() / 2);
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  final int heightSize=MeasureSpec.getSize(heightMeasureSpec);
  final int leftPointerH=mLeftCursorBG.getIntrinsicHeight();
  final int rightPointerH=mRightCursorBG.getIntrinsicHeight();
  final int maxOfCursor=Math.max(leftPointerH,rightPointerH);
  final int maxOfCursorAndSeekbar=Math.max(mSeekbarHeight,maxOfCursor);
  int heightNeeded=maxOfCursorAndSeekbar + mMarginBetween + mTextSize+ mPaddingRect.top+ mPaddingRect.bottom;
  if (heightMode == MeasureSpec.EXACTLY) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(heightSize,MeasureSpec.EXACTLY);
  }
 else   if (heightMode == MeasureSpec.AT_MOST) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(heightSize < heightNeeded ? heightSize : heightNeeded,MeasureSpec.EXACTLY);
  }
 else {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(heightNeeded,MeasureSpec.EXACTLY);
  }
  final int widthSize=MeasureSpec.getSize(widthMeasureSpec);
  mSeekbarRect.left=mPaddingRect.left + mLeftCursorBG.getIntrinsicWidth() / 2;
  mSeekbarRect.right=widthSize - mPaddingRect.right - mRightCursorBG.getIntrinsicWidth() / 2;
  mSeekbarRect.top=mPaddingRect.top + mTextSize + mMarginBetween;
  mSeekbarRect.bottom=mSeekbarRect.top + mSeekbarHeight;
  mSeekbarRectSelected.top=mSeekbarRect.top;
  mSeekbarRectSelected.bottom=mSeekbarRect.bottom;
  mPartLength=((int)(mSeekbarRect.right - mSeekbarRect.left)) / (mTextArray.length - 1);
  mRightBoundary=(int)(mSeekbarRect.right + mRightCursorBG.getIntrinsicWidth() / 2);
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
}
Program: 63772
Project: 63772
Buggy source:
@Override public void onSurfaceTextureSizeChanged(final SurfaceTexture surface,final int width,final int height){
  mSurfaceWidth=width;
  mSurfaceHeight=height;
  boolean isValidState=(mTargetState == STATE_PLAYING);
  boolean hasValidSize=(mVideoWidth == width && mVideoHeight == height);
  if (mMediaPlayer != null && isValidState && hasValidSize) {
    if (mSeekWhenPrepared != 0) {
      seekTo(mSeekWhenPrepared);
    }
    start();
  }
}

Fixed version (ground truth):
@Override public void onSurfaceTextureSizeChanged(final SurfaceTexture surface,final int width,final int height){
  mSurfaceWidth=width;
  mSurfaceHeight=height;
  boolean isValidState=(mTargetState == STATE_PLAYING);
  boolean hasValidSize=(width > 0 && height > 0);
  if (mMediaPlayer != null && isValidState && hasValidSize) {
    if (mSeekWhenPrepared != 0) {
      seekTo(mSeekWhenPrepared);
    }
    start();
  }
}
Program: 63773
Project: 63773
Buggy source:
public void onPrepared(MediaPlayer mp){
  mCurrentState=STATE_PREPARED;
  mCanPause=mCanSeekBack=mCanSeekForward=true;
  if (mOnPreparedListener != null) {
    mOnPreparedListener.onPrepared(mMediaPlayer);
  }
  if (mMediaController != null) {
    mMediaController.setEnabled(true);
  }
  mVideoWidth=mp.getVideoWidth();
  mVideoHeight=mp.getVideoHeight();
  int seekToPosition=mSeekWhenPrepared;
  if (seekToPosition != 0) {
    seekTo(seekToPosition);
  }
  if (mVideoWidth != 0 && mVideoHeight != 0) {
    getSurfaceTexture().setDefaultBufferSize(mVideoWidth,mVideoHeight);
    if (mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) {
      if (mTargetState == STATE_PLAYING) {
        start();
        if (mMediaController != null) {
          mMediaController.show();
        }
      }
 else       if (!isPlaying() && (seekToPosition != 0 || getCurrentPosition() > 0)) {
        if (mMediaController != null) {
          mMediaController.show(0);
        }
      }
    }
  }
 else {
    if (mTargetState == STATE_PLAYING) {
      start();
    }
  }
}

Fixed version (ground truth):
public void onPrepared(MediaPlayer mp){
  mCurrentState=STATE_PREPARED;
  mCanPause=mCanSeekBack=mCanSeekForward=true;
  if (mOnPreparedListener != null) {
    mOnPreparedListener.onPrepared(mMediaPlayer);
  }
  if (mMediaController != null) {
    mMediaController.setEnabled(true);
  }
  mVideoWidth=mp.getVideoWidth();
  mVideoHeight=mp.getVideoHeight();
  int seekToPosition=mSeekWhenPrepared;
  if (seekToPosition != 0) {
    seekTo(seekToPosition);
  }
  if (mVideoWidth != 0 && mVideoHeight != 0) {
    getSurfaceTexture().setDefaultBufferSize(mVideoWidth,mVideoHeight);
    if (mTargetState == STATE_PLAYING) {
      start();
      if (mMediaController != null) {
        mMediaController.show();
      }
    }
 else     if (!isPlaying() && (seekToPosition != 0 || getCurrentPosition() > 0)) {
      if (mMediaController != null) {
        mMediaController.show(0);
      }
    }
  }
 else {
    if (mTargetState == STATE_PLAYING) {
      start();
    }
  }
}
Program: 63775
Project: 63775
Buggy source:
@Override public void onFocusChange(final View v,final boolean hasFocus){
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      if (mSelfHostedURL && v.getId() == R.id.edtSelfHostedURL && !hasFocus) {
        if (!TextUtils.isEmpty(edtSelfHosted.getText()) && validateURL(edtSelfHosted.getText().toString())) {
          edtSelfHosted.setError(null);
          if (mAutoLogin) {
            findViewById(R.id.controls).setVisibility(View.GONE);
            findViewById(R.id.login_progress).setVisibility(View.VISIBLE);
            mLoginProcessStatus.setText(OResource.string(OdooLogin.this,R.string.status_connecting_to_server));
          }
          findViewById(R.id.imgValidURL).setVisibility(View.GONE);
          findViewById(R.id.serverURLCheckProgress).setVisibility(View.VISIBLE);
          findViewById(R.id.layoutBorderDB).setVisibility(View.GONE);
          findViewById(R.id.layoutDatabase).setVisibility(View.GONE);
          String test_url=createServerURL(edtSelfHosted.getText().toString());
          Log.v("String_Node_Str","String_Node_Str" + test_url);
          Odoo.createInstance(OdooLogin.this,test_url).setOnConnect(OdooLogin.this);
        }
      }
    }
  }
,500);
}

Fixed version (ground truth):
@Override public void onFocusChange(final View v,final boolean hasFocus){
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      if (mSelfHostedURL && v.getId() == R.id.edtSelfHostedURL && !hasFocus) {
        if (!TextUtils.isEmpty(edtSelfHosted.getText()) && validateURL(edtSelfHosted.getText().toString())) {
          edtSelfHosted.setError(null);
          if (mAutoLogin) {
            findViewById(R.id.controls).setVisibility(View.GONE);
            findViewById(R.id.login_progress).setVisibility(View.VISIBLE);
            mLoginProcessStatus.setText(OResource.string(OdooLogin.this,R.string.status_connecting_to_server));
          }
          findViewById(R.id.imgValidURL).setVisibility(View.GONE);
          findViewById(R.id.serverURLCheckProgress).setVisibility(View.VISIBLE);
          findViewById(R.id.layoutBorderDB).setVisibility(View.GONE);
          findViewById(R.id.layoutDatabase).setVisibility(View.GONE);
          String test_url=createServerURL(edtSelfHosted.getText().toString());
          Log.v("String_Node_Str","String_Node_Str" + test_url);
          try {
            Odoo.createInstance(OdooLogin.this,test_url).setOnConnect(OdooLogin.this);
          }
 catch (          OdooVersionException e) {
            e.printStackTrace();
          }
        }
      }
    }
  }
,500);
}
Program: 63777
Project: 63777
Buggy source:
@Override protected Boolean doInBackground(OUser... params){
  OUser user=params[0];
  Odoo odoo=Odoo.createInstance(mContext,(user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
  odoo.helper.OUser mUser=odoo.authenticate(user.getUsername(),user.getPassword(),(user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
  if (mUser != null) {
    OUser updatedUser=new OUser();
    updatedUser.setFromBundle(mUser.getAsBundle());
    OdooAccountManager.updateUserData(mContext,user,updatedUser);
    try {
      Thread.sleep(1500);
    }
 catch (    Exception e) {
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(OUser... params){
  try {
    OUser user=params[0];
    Odoo odoo=Odoo.createInstance(mContext,(user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
    odoo.helper.OUser mUser=odoo.authenticate(user.getUsername(),user.getPassword(),(user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
    if (mUser != null) {
      OUser updatedUser=new OUser();
      updatedUser.setFromBundle(mUser.getAsBundle());
      OdooAccountManager.updateUserData(mContext,user,updatedUser);
      Thread.sleep(1500);
      return true;
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
catch (  OdooVersionException e) {
    e.printStackTrace();
  }
  return false;
}
Program: 63779
Project: 63779
Buggy source:
public static Odoo createOdooInstance(final Context context,final OUser user){
  final App app=(App)context.getApplicationContext();
  Odoo odoo=app.getOdoo(user);
  if (odoo == null) {
    odoo=Odoo.createInstance(context,(user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
    odoo.helper.OUser mUser=odoo.authenticate(user.getUsername(),user.getPassword(),(user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
    app.setOdoo(odoo,user);
    if (mUser != null) {
      ResCompany company=new ResCompany(context,user);
      if (company.count("String_Node_Str",new String[]{user.getCompanyId() + "String_Node_Str"}) <= 0) {
        ODataRow company_details=new ODataRow();
        company_details.put("String_Node_Str",user.getCompanyId());
        company.quickCreateRecord(company_details);
      }
    }
 else {
      Log.e(TAG,OResource.string(context,R.string.toast_something_gone_wrong));
    }
  }
  return odoo;
}

Fixed version (ground truth):
public static Odoo createOdooInstance(final Context context,final OUser user){
  final App app=(App)context.getApplicationContext();
  Odoo odoo=app.getOdoo(user);
  try {
    if (odoo == null) {
      odoo=Odoo.createQuickInstance(context,(user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
      odoo.helper.OUser mUser=odoo.authenticate(user.getUsername(),user.getPassword(),(user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
      app.setOdoo(odoo,user);
      if (mUser != null) {
        ResCompany company=new ResCompany(context,user);
        if (company.count("String_Node_Str",new String[]{user.getCompanyId() + "String_Node_Str"}) <= 0) {
          ODataRow company_details=new ODataRow();
          company_details.put("String_Node_Str",user.getCompanyId());
          company.quickCreateRecord(company_details);
        }
      }
 else {
        Log.e(TAG,OResource.string(context,R.string.toast_something_gone_wrong));
      }
    }
  }
 catch (  OdooVersionException e) {
    e.printStackTrace();
  }
  return odoo;
}