nus-yam/ex-repair huggingface dataset:
Program: 112518
Project: 112518
Buggy source:
@Override public StringKeyedVector getUpdate(LabeledInstance instance){
  StringKeyedVector gradients=model.getGradients(instance);
  Iterator it=gradients.iterator();
  while (it.hasNext()) {
    Map.Entry<String,Double> pairs=(Map.Entry)it.next();
    String feature=pairs.getKey();
    double gradient=pairs.getValue();
    double featureLearningRate=updateAndGetFeatureLearningRate(feature,gradient);
    gradients.setCoordinate(feature,gradient * featureLearningRate);
  }
  return gradients;
}

Fixed version (ground truth):
@Override public StringKeyedVector getUpdate(LabeledInstance instance){
  StringKeyedVector gradients=model.getGradients(instance);
  Iterator it=gradients.iterator();
  while (it.hasNext()) {
    Map.Entry<String,Double> pairs=(Map.Entry)it.next();
    String feature=pairs.getKey();
    double gradient=pairs.getValue();
    double featureLearningRate=updateAndGetFeatureLearningRate(feature,gradient);
    summedGradients.setCoordinate(feature,gradient * featureLearningRate);
  }
  return gradients;
}
Program: 112519
Project: 112519
Buggy source:
/** 
 * Update adaptive feature specific learning rates
 */
public double updateAndGetFeatureLearningRate(String feature,double gradient){
  double gradUpdate=0.0;
  if (gradients.containsKey(feature)) {
    gradUpdate=gradient * gradient;
  }
 else {
    gradUpdate=1d + (gradient * gradient);
  }
  gradients.addToCoordinate(feature,gradUpdate);
  return getFeatureLearningRate(feature);
}

Fixed version (ground truth):
/** 
 * Update adaptive feature specific learning rates
 */
public double updateAndGetFeatureLearningRate(String feature,double gradient){
  double gradUpdate=0.0;
  if (summedGradients.containsKey(feature)) {
    gradUpdate=gradient * gradient;
  }
 else {
    gradUpdate=1d + (gradient * gradient);
  }
  summedGradients.addToCoordinate(feature,gradUpdate);
  return getFeatureLearningRate(feature);
}
Program: 112520
Project: 112520
Buggy source:
@Override public void teardown(){
  gradients=new StringKeyedVector();
}

Fixed version (ground truth):
@Override public void teardown(){
  summedGradients=new StringKeyedVector();
}
Program: 112521
Project: 112521
Buggy source:
@Override public StringKeyedVector getUpdate(LabeledInstance instance){
  StringKeyedVector gradients=model.getGradients(instance);
  double learningRate=getDecreasingLearningRate(model.epoch);
  gradients.mul(learningRate);
  return gradients;
}

Fixed version (ground truth):
@Override public StringKeyedVector getUpdate(LabeledInstance instance){
  StringKeyedVector gradients=model.getGradients(instance);
  double learningRate=getDecreasingLearningRate(model.epoch);
  gradients.mul(-learningRate);
  return gradients;
}
Program: 112522
Project: 112522
Buggy source:
@Override public double loss(LabeledInstance<BinaryLabel> instance){
  double hypothesis=Utilities.logistic(param.dot(instance.getVector()));
  double label=instance.getLabel().getAsPlusMinus();
  double z=hypothesis * label;
  if (z <= this.threshold) {
    return this.threshold - z;
  }
 else {
    return 0.0;
  }
}

Fixed version (ground truth):
@Override public double loss(LabeledInstance<BinaryLabel> instance){
  double inner=param.dot(instance.getVector());
  double label=instance.getLabel().getAsPlusMinus();
  double z=inner * label;
  if (z <= this.threshold) {
    return this.threshold - z;
  }
 else {
    return 0.0;
  }
}
Program: 112523
Project: 112523
Buggy source:
@Override public StringKeyedVector getGradients(LabeledInstance<BinaryLabel> instance){
  StringKeyedVector gradients=instance.getVector().copy();
  double hypothesis=(param.dot(instance.getVector()));
  double label=instance.getLabel().getAsPlusMinus();
  if (hypothesis * label <= this.threshold) {
    gradients.mul(-label);
    return gradients;
  }
 else {
    return new StringKeyedVector();
  }
}

Fixed version (ground truth):
@Override public StringKeyedVector getGradients(LabeledInstance<BinaryLabel> instance){
  StringKeyedVector gradients=instance.getVector().copy();
  double inner=param.dot(instance.getVector());
  double label=instance.getLabel().getAsPlusMinus();
  double z=inner * label;
  if (z <= this.threshold) {
    gradients.mul(-label);
    return gradients;
  }
 else {
    return new StringKeyedVector();
  }
}
Program: 112524
Project: 112524
Buggy source:
@Override public StringKeyedVector getGradients(LabeledInstance<BinaryLabel> instance){
  StringKeyedVector gradients=instance.getVector().copy();
  double label=instance.getLabel().getAsPlusMinus();
  double inner=instance.getVector().dot(param);
  double gradient=-label * Utilities.logistic(-label * inner);
  gradients.mul(gradient);
  return gradients;
}

Fixed version (ground truth):
@Override public StringKeyedVector getGradients(LabeledInstance<BinaryLabel> instance){
  StringKeyedVector gradients=instance.getVector().copy();
  double label=instance.getLabel().getAsPlusMinus();
  double inner=instance.getVector().dot(param);
  double gradient=-label / (Math.exp(label * inner) + 1.0);
  gradients.mul(gradient);
  return gradients;
}
Program: 112525
Project: 112525
Buggy source:
/** 
 * Single gradient update
 */
public void update(LabeledInstance<L> instance){
  optimizer.model=this;
  if (epoch > 0) {
    param.incrementIteration();
  }
  StringKeyedVector update=optimizer.getUpdate(instance);
  param.addScaled(update,-1.0);
  truncate(instance);
  epoch++;
}

Fixed version (ground truth):
/** 
 * Single gradient update
 */
public void update(LabeledInstance<L> instance){
  optimizer.model=this;
  if (epoch > 0) {
    param.incrementIteration();
  }
  StringKeyedVector update=optimizer.getUpdate(instance);
  param.add(update);
  truncate(instance);
  epoch++;
}
Program: 112526
Project: 112526
Buggy source:
/** 
 * Call to syncUser method
 */
public void postUser(){
  new SyncUser().getUserID(email,personName);
}

Fixed version (ground truth):
/** 
 * Call to syncUser method
 */
public void postUser(){
  userID=new SyncUser().getUserID(email,personName);
}
Program: 112527
Project: 112527
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup arg2){
  final ViewHolder holder;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=inflater.inflate(R.layout.saved_tab,null);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.txtName=(TextView)convertView.findViewById(R.id.svd_name);
  holder.txtDate=(TextView)convertView.findViewById(R.id.svd_date);
  holder.txtsync=(TextView)convertView.findViewById(R.id.svd_sync);
  holder.img=(ImageView)convertView.findViewById(R.id.svd_image);
  holder.txtName.setText(list.get(position).getPersonName());
  holder.txtDate.setText(list.get(position).getPersonEmail());
  holder.txtsync.setText(list.get(position).getCreated());
  if (list.get(position).isSynced()) {
    holder.img.setImageResource(R.drawable.pro_pic);
  }
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup arg2){
  final ViewHolder holder;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=inflater.inflate(R.layout.saved_tab,null);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.txtName=(TextView)convertView.findViewById(R.id.svd_name);
  holder.txtDate=(TextView)convertView.findViewById(R.id.svd_date);
  holder.txtsync=(TextView)convertView.findViewById(R.id.svd_sync);
  holder.img=(ImageView)convertView.findViewById(R.id.svd_image);
  holder.txtName.setText(list.get(position).getPersonName());
  holder.txtDate.setText(list.get(position).getPersonEmail());
  holder.txtsync.setText(list.get(position).getCreated());
  if (list.get(position).isSynced()) {
    holder.img.setImageResource(R.drawable.synced);
  }
  return convertView;
}
Program: 112528
Project: 112528
Buggy source:
@Override public String convertInputStreamToString(InputStream inputStream) throws IOException {
  BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream));
  String line="String_Node_Str";
  String result="String_Node_Str";
  while ((line=bufferedReader.readLine()) != null)   result+=line;
  inputStream.close();
  System.out.println("String_Node_Str" + result);
  JSONObject jObject;
  String out=null;
  try {
    jObject=new JSONObject(result);
    out=jObject.getString("String_Node_Str");
    jObject=new JSONObject("String_Node_Str");
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  return out;
}

Fixed version (ground truth):
@Override public String convertInputStreamToString(InputStream inputStream) throws IOException {
  BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream));
  String line="String_Node_Str";
  String result="String_Node_Str";
  while ((line=bufferedReader.readLine()) != null)   result+=line;
  inputStream.close();
  System.out.println("String_Node_Str" + result);
  JSONObject jObject;
  String out=null;
  try {
    jObject=new JSONObject(result);
    out=jObject.getString("String_Node_Str");
    jObject=new JSONObject(out);
    out=jObject.getString("String_Node_Str");
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  return out;
}
Program: 112529
Project: 112529
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_create);
  btnCreate=(Button)findViewById(R.id.create_btn_create);
  btnCreate.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (setData()) {
      }
 else {
      }
    }
  }
);
  spnUnits=(Spinner)findViewById(R.id.create_spn_unit);
  ArrayAdapter<CharSequence> uitsAdapter=ArrayAdapter.createFromResource(this,R.array.units_array,android.R.layout.simple_spinner_item);
  spnUnits.setAdapter(uitsAdapter);
  spnGender=(Spinner)findViewById(R.id.create_spn_gender);
  ArrayAdapter<CharSequence> genderAdapter=ArrayAdapter.createFromResource(this,R.array.gender_array,android.R.layout.simple_spinner_item);
  spnGender.setAdapter(genderAdapter);
  context=this;
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_create);
  btnCreate=(Button)findViewById(R.id.create_btn_create);
  btnCreate.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (!setData()) {
        dialog("String_Node_Str","String_Node_Str");
      }
    }
  }
);
  spnUnits=(Spinner)findViewById(R.id.create_spn_unit);
  ArrayAdapter<CharSequence> uitsAdapter=ArrayAdapter.createFromResource(this,R.array.units_array,android.R.layout.simple_spinner_item);
  spnUnits.setAdapter(uitsAdapter);
  spnGender=(Spinner)findViewById(R.id.create_spn_gender);
  ArrayAdapter<CharSequence> genderAdapter=ArrayAdapter.createFromResource(this,R.array.gender_array,android.R.layout.simple_spinner_item);
  spnGender.setAdapter(genderAdapter);
  context=this;
}
Program: 112530
Project: 112530
Buggy source:
public void dialog(String title,String message){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(title).setMessage(message).setIcon(R.drawable.warning).setCancelable(false).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      dialog.cancel();
      closer();
    }
  }
);
  alertDialog=builder.create();
  alertDialog.show();
}

Fixed version (ground truth):
public void dialog(String title,String message){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(title).setMessage(message).setIcon(R.drawable.warning).setCancelable(false).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      dialog.cancel();
    }
  }
);
  alertDialog=builder.create();
  alertDialog.show();
}
Program: 112531
Project: 112531
Buggy source:
public void onClick(DialogInterface dialog,int id){
  dialog.cancel();
  closer();
}

Fixed version (ground truth):
public void onClick(DialogInterface dialog,int id){
  dialog.cancel();
}
Program: 112533
Project: 112533
Buggy source:
@Override public Fragment getItem(int i){
switch (i) {
case RECEIVE:
case SEND:
case BALANCE:
    return getFragmentOrCreate(fm,account,i);
default :
  throw new RuntimeException("String_Node_Str" + i);
}
}

Fixed version (ground truth):
@Override public Fragment getItem(int i){
switch (i) {
case RECEIVE:
    if (request == null)     request=createFragment(account,i);
  return request;
case SEND:
if (send == null) send=createFragment(account,i);
return send;
case BALANCE:
if (balance == null) balance=createFragment(account,i);
return balance;
default :
throw new RuntimeException("String_Node_Str" + i);
}
}
Program: 112534
Project: 112534
Buggy source:
private static Fragment createFragment(WalletAccount account,int item){
  String accountId=account.getId();
switch (item) {
case RECEIVE:
    return AddressRequestFragment.newInstance(accountId);
case BALANCE:
  return BalanceFragment.newInstance(accountId);
case SEND:
return SendFragment.newInstance(accountId);
default :
throw new RuntimeException("String_Node_Str" + item);
}
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) private static <T extends Fragment>T createFragment(WalletAccount account,int item){
  String accountId=account.getId();
switch (item) {
case RECEIVE:
    return (T)AddressRequestFragment.newInstance(accountId);
case BALANCE:
  return (T)BalanceFragment.newInstance(accountId);
case SEND:
return (T)SendFragment.newInstance(accountId);
default :
throw new RuntimeException("String_Node_Str" + item);
}
}
Program: 112535
Project: 112535
Buggy source:
@Override public void onViewStateRestored(@Nullable Bundle savedInstanceState){
  if (savedInstanceState != null) {
    currentScreen=savedInstanceState.getInt(ACCOUNT_CURRENT_SCREEN,BALANCE);
    updateView();
  }
  super.onViewStateRestored(savedInstanceState);
}

Fixed version (ground truth):
@Override public void onViewStateRestored(@Nullable Bundle savedInstanceState){
  if (savedInstanceState != null) {
    currentScreen=savedInstanceState.getInt(ACCOUNT_CURRENT_SCREEN,BALANCE);
  }
 else {
    currentScreen=BALANCE;
  }
  updateView();
  super.onViewStateRestored(savedInstanceState);
}
Program: 112536
Project: 112536
Buggy source:
public AppSectionsPagerAdapter(Context context,FragmentManager fm,WalletAccount account){
  super(fm);
  this.context=context;
  this.fm=fm;
  this.account=account;
}

Fixed version (ground truth):
public AppSectionsPagerAdapter(Context context,FragmentManager fm,WalletAccount account){
  super(fm);
  receiveTitle=context.getString(R.string.wallet_title_request);
  sendTitle=context.getString(R.string.wallet_title_send);
  balanceTitle=context.getString(R.string.wallet_title_balance);
  this.account=account;
}
Program: 112537
Project: 112537
Buggy source:
@Override public void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  setRetainInstance(true);
}

Fixed version (ground truth):
@Override public void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  account=application.getAccount(getArguments().getString(Constants.ARG_ACCOUNT_ID));
}
Program: 112538
Project: 112538
Buggy source:
public void setupArgs(String accountId){
  getArguments().putString(Constants.ARG_ACCOUNT_ID,accountId);
}

Fixed version (ground truth):
private void setupArgs(String accountId){
  getArguments().putString(Constants.ARG_ACCOUNT_ID,accountId);
}
Program: 112539
Project: 112539
Buggy source:
@Nullable private SendFragment getSendFragment(){
  return (SendFragment)getFragment(getFragmentManager(),SEND);
}

Fixed version (ground truth):
@Nullable private SendFragment getSendFragment(){
  return (SendFragment)getFragment(getChildFragmentManager(),SEND);
}
Program: 112540
Project: 112540
Buggy source:
@Override public CharSequence getPageTitle(int position){
switch (position) {
case RECEIVE:
    return context.getString(R.string.wallet_title_request);
case SEND:
  return context.getString(R.string.wallet_title_send);
case BALANCE:
default :
return context.getString(R.string.wallet_title_balance);
}
}

Fixed version (ground truth):
@Override public CharSequence getPageTitle(int i){
switch (i) {
case RECEIVE:
    return receiveTitle;
case SEND:
  return sendTitle;
case BALANCE:
return balanceTitle;
default :
throw new RuntimeException("String_Node_Str" + i);
}
}
Program: 112541
Project: 112541
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_account,container,false);
  ButterKnife.bind(this,view);
  mNavigationDrawerFragment=(NavigationDrawerFragment)getFragmentManager().findFragmentById(R.id.navigation_drawer);
  viewPager.setOffscreenPageLimit(OFF_SCREEN_LIMIT);
  viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int pos,    float posOffset,    int posOffsetPixels){
    }
    @Override public void onPageSelected(    int position){
      currentScreen=position;
      if (position == BALANCE)       Keyboard.hideKeyboard(getActivity());
      if (listener != null) {
switch (position) {
case RECEIVE:
          listener.onReceiveSelected();
        break;
case BALANCE:
      listener.onBalanceSelected();
    break;
case SEND:
  listener.onSendSelected();
break;
default :
throw new RuntimeException("String_Node_Str" + position);
}
}
}
@Override public void onPageScrollStateChanged(int state){
}
}
);
return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_account,container,false);
  ButterKnife.bind(this,view);
  mNavigationDrawerFragment=(NavigationDrawerFragment)getFragmentManager().findFragmentById(R.id.navigation_drawer);
  viewPager.setOffscreenPageLimit(OFF_SCREEN_LIMIT);
  viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      currentScreen=position;
      if (position == BALANCE)       Keyboard.hideKeyboard(getActivity());
      if (listener != null) {
switch (position) {
case RECEIVE:
          listener.onReceiveSelected();
        break;
case BALANCE:
      listener.onBalanceSelected();
    break;
case SEND:
  listener.onSendSelected();
break;
default :
throw new RuntimeException("String_Node_Str" + position);
}
}
}
@Override public void onPageScrolled(int pos,float posOffset,int posOffsetPixels){
}
@Override public void onPageScrollStateChanged(int state){
}
}
);
viewPager.setAdapter(new AppSectionsPagerAdapter(getActivity(),getChildFragmentManager(),account));
return view;
}
Program: 112542
Project: 112542
Buggy source:
@Nullable private static Fragment getFragment(FragmentManager fm,int item){
  for (  Fragment f : fm.getFragments()) {
switch (item) {
case RECEIVE:
      if (f instanceof AddressRequestFragment)       return f;
    break;
case BALANCE:
  if (f instanceof BalanceFragment)   return f;
break;
case SEND:
if (f instanceof SendFragment) return f;
break;
default :
throw new RuntimeException("String_Node_Str" + item);
}
}
return null;
}

Fixed version (ground truth):
@Nullable private static Fragment getFragment(FragmentManager fm,int item){
  if (fm.getFragments() == null)   return null;
  for (  Fragment f : fm.getFragments()) {
switch (item) {
case RECEIVE:
      if (f instanceof AddressRequestFragment)       return f;
    break;
case BALANCE:
  if (f instanceof BalanceFragment)   return f;
break;
case SEND:
if (f instanceof SendFragment) return f;
break;
default :
throw new RuntimeException("String_Node_Str" + item);
}
}
return null;
}
Program: 112543
Project: 112543
Buggy source:
@Override public void running(){
  if (isActivelyConnected()) {
    log.info("String_Node_Str",type.getName(),lastServerAddress);
    broadcastOnConnection();
    retrySeconds=0;
  }
}

Fixed version (ground truth):
@Override public void running(){
  if (isActivelyConnected()) {
    log.info("String_Node_Str",type.getName(),lastServerAddress);
    broadcastOnConnection();
    reschedule(connectionCheckTask,CONNECTION_STABILIZATION,TimeUnit.SECONDS);
  }
}
Program: 112544
Project: 112544
Buggy source:
@Override public void terminated(Service.State from){
  log.info("String_Node_Str",type.getName());
  broadcastOnDisconnect();
  failedAddresses.add(lastServerAddress);
  lastServerAddress=null;
  stratumClient=null;
  if (!stopped) {
    log.info("String_Node_Str",type.getName(),retrySeconds);
    connectionExec.remove(reconnectTask);
    if (retrySeconds > 0) {
      connectionExec.schedule(reconnectTask,retrySeconds,TimeUnit.SECONDS);
    }
 else {
      connectionExec.execute(reconnectTask);
    }
  }
}

Fixed version (ground truth):
@Override public void terminated(Service.State from){
  log.info("String_Node_Str",type.getName());
  broadcastOnDisconnect();
  failedAddresses.add(lastServerAddress);
  lastServerAddress=null;
  stratumClient=null;
  if (!stopped) {
    log.info("String_Node_Str",type.getName(),retrySeconds);
    connectionExec.remove(connectionCheckTask);
    connectionExec.remove(reconnectTask);
    if (retrySeconds > 0) {
      reconnectAt=System.currentTimeMillis() + retrySeconds * 1000;
      connectionExec.schedule(reconnectTask,retrySeconds,TimeUnit.SECONDS);
    }
 else {
      connectionExec.execute(reconnectTask);
    }
  }
}
Program: 112545
Project: 112545
Buggy source:
private ServerAddress getServerAddress(){
  if (failedAddresses.size() == addresses.size()) {
    failedAddresses.clear();
    retrySeconds=Math.min(Math.max(1,retrySeconds * 2),MAX_WAIT);
  }
  ServerAddress address;
  while (true) {
    address=addresses.get(RANDOM.nextInt(addresses.size()));
    if (!failedAddresses.contains(address))     break;
  }
  return address;
}

Fixed version (ground truth):
private ServerAddress getServerAddress(){
  if (failedAddresses.size() == addresses.size()) {
    failedAddresses.clear();
  }
  retrySeconds=Math.min(Math.max(1,retrySeconds * 2),MAX_WAIT);
  ServerAddress address;
  while (true) {
    address=addresses.get(RANDOM.nextInt(addresses.size()));
    if (!failedAddresses.contains(address))     break;
  }
  return address;
}
Program: 112546
Project: 112546
Buggy source:
@Override protected void onResume(){
  super.onResume();
  cameraThread=new HandlerThread("String_Node_Str",Process.THREAD_PRIORITY_BACKGROUND);
  cameraThread.start();
  cameraHandler=new Handler(cameraThread.getLooper());
  final SurfaceView surfaceView=(SurfaceView)findViewById(R.id.scan_activity_preview);
  surfaceHolder=surfaceView.getHolder();
  surfaceHolder.addCallback(this);
  surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  cameraThread=new HandlerThread("String_Node_Str",Process.THREAD_PRIORITY_BACKGROUND);
  cameraThread.start();
  cameraHandler=new Handler(cameraThread.getLooper());
  final SurfaceView surfaceView=(SurfaceView)findViewById(R.id.scan_activity_preview);
  surfaceHolder=surfaceView.getHolder();
  surfaceHolder.addCallback(this);
  if (!hasCameraPermission()) {
    askCameraPermission();
  }
 else {
    openCamera();
  }
}
Program: 112547
Project: 112547
Buggy source:
@Override public void surfaceCreated(final SurfaceHolder holder){
  cameraHandler.post(openRunnable);
}

Fixed version (ground truth):
@Override public void surfaceCreated(final SurfaceHolder holder){
  isSurfaceCreated=true;
  openCamera();
}
Program: 112548
Project: 112548
Buggy source:
@Deprecated public AddCoinTask(Listener listener,CoinType type,Wallet wallet,@Nullable CharSequence password){
  this.listener=listener;
  this.type=type;
  this.wallet=wallet;
  this.password=password;
  description=null;
}

Fixed version (ground truth):
public AddCoinTask(Listener listener,CoinType type,Wallet wallet,@Nullable String description,@Nullable CharSequence password){
  this.listener=listener;
  this.type=type;
  this.wallet=wallet;
  this.description=description;
  this.password=password;
}
Program: 112549
Project: 112549
Buggy source:
@Override public void addCoin(String description,CharSequence password){
  if (selectedCoin != null && addCoinTask == null) {
    addCoinTask=new AddCoinTask(this,selectedCoin,wallet,description,password);
    addCoinTask.execute();
  }
}

Fixed version (ground truth):
@Override public void addCoin(CoinType type,String description,CharSequence password){
  if (type != null && addCoinTask == null) {
    addCoinTask=new AddCoinTask(this,type,wallet,description,password);
    addCoinTask.execute();
  }
}
Program: 112550
Project: 112550
Buggy source:
private void showAddCoinDialog(){
  Dialogs.dismissAllowingStateLoss(getFM(),ADD_COIN_DIALOG_TAG);
  ConfirmAddCoinUnlockWalletDialog.getInstance(selectedCoin.getName(),wallet.isEncrypted()).show(getFM(),ADD_COIN_DIALOG_TAG);
}

Fixed version (ground truth):
private void showAddCoinDialog(){
  Dialogs.dismissAllowingStateLoss(getFM(),ADD_COIN_DIALOG_TAG);
  ConfirmAddCoinUnlockWalletDialog.getInstance(selectedCoin,wallet.isEncrypted()).show(getFM(),ADD_COIN_DIALOG_TAG);
}
Program: 112551
Project: 112551
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_fragment_wrapper);
  containerRes=R.id.container;
  if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction().add(containerRes,new TradeSelectFragment()).commit();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_fragment_wrapper);
  containerRes=R.id.container;
  if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction().add(containerRes,new TradeSelectFragment(),TRADE_SELECT_FRAGMENT_TAG).commit();
  }
}
Program: 112552
Project: 112552
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
  String email=emailView.getText().toString();
}

Fixed version (ground truth):
@Override public void onClick(View v){
  String accountId=null;
  for (  WalletAccount account : accounts) {
    if (account.getTransaction(txId) != null) {
      accountId=account.getId();
      break;
    }
  }
  if (accountId != null && txId != null) {
    Intent intent=new Intent(getActivity(),TransactionDetailsActivity.class);
    intent.putExtra(Constants.ARG_ACCOUNT_ID,accountId);
    intent.putExtra(Constants.ARG_TRANSACTION_ID,txId);
    startActivity(intent);
  }
 else {
    if (Constants.COINS_BLOCK_EXPLORERS.containsKey(withdrawType)) {
      String url=String.format(Constants.COINS_BLOCK_EXPLORERS.get(withdrawType),txId);
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse(url));
      startActivity(i);
    }
 else {
      Toast.makeText(getActivity(),R.string.error_generic,Toast.LENGTH_SHORT).show();
    }
  }
}
Program: 112553
Project: 112553
Buggy source:
/** 
 * Get the description of the wallet. See   {@link WalletPocketHD#setDescription(String))}
 */
@Override public String getDescription(){
  if (description == null || description.trim().equals("String_Node_Str")) {
    return type.getName();
  }
 else {
    return description;
  }
}

Fixed version (ground truth):
/** 
 * Get the description of the wallet. See   {@link WalletPocketHD#setDescription(String))}
 */
@Override @Nullable public String getDescription(){
  return description;
}
Program: 112555
Project: 112555
Buggy source:
@Override public Dialog onCreateDialog(final Bundle savedInstanceState){
  final Bundle args=getArguments();
  final WalletAccount account=checkNotNull(app.getAccount(args.getString(ARG_ACCOUNT_ID)));
  final LayoutInflater inflater=LayoutInflater.from(context);
  final DialogBuilder dialog=new DialogBuilder(context);
  final View view=inflater.inflate(R.layout.edit_account_dialog,null);
  final EditText descriptionView=ButterKnife.findById(view,R.id.edit_account_description);
  descriptionView.setText(account.getDescription());
  dialog.setTitle(R.string.edit_account_title);
  dialog.setView(view);
  final DialogInterface.OnClickListener onClickListener=new DialogInterface.OnClickListener(){
    @Override public void onClick(    final DialogInterface dialog,    final int which){
      if (which == DialogInterface.BUTTON_POSITIVE) {
        final String newDescription=descriptionView.getText().toString().trim();
        account.setDescription(newDescription);
        if (listener != null)         listener.onAccountModified(account);
      }
      dismiss();
    }
  }
;
  dialog.setPositiveButton(R.string.button_save,onClickListener);
  dialog.setNegativeButton(R.string.button_cancel,onClickListener);
  return dialog.create();
}

Fixed version (ground truth):
@Override public Dialog onCreateDialog(final Bundle savedInstanceState){
  final Bundle args=getArguments();
  final WalletAccount account=checkNotNull(app.getAccount(args.getString(ARG_ACCOUNT_ID)));
  final LayoutInflater inflater=LayoutInflater.from(context);
  final DialogBuilder dialog=new DialogBuilder(context);
  final View view=inflater.inflate(R.layout.edit_account_dialog,null);
  final EditText descriptionView=ButterKnife.findById(view,R.id.edit_account_description);
  descriptionView.setText(account.getDescription());
  descriptionView.setHint(account.getCoinType().getName());
  dialog.setTitle(R.string.edit_account_title);
  dialog.setView(view);
  final DialogInterface.OnClickListener onClickListener=new DialogInterface.OnClickListener(){
    @Override public void onClick(    final DialogInterface dialog,    final int which){
      if (which == DialogInterface.BUTTON_POSITIVE) {
        final String newDescription=descriptionView.getText().toString().trim();
        account.setDescription(newDescription);
        if (listener != null)         listener.onAccountModified(account);
      }
      dismiss();
    }
  }
;
  dialog.setPositiveButton(R.string.button_save,onClickListener);
  dialog.setNegativeButton(R.string.button_cancel,onClickListener);
  return dialog.create();
}
Program: 112557
Project: 112557
Buggy source:
public void setAccount(WalletAccount account){
  this.type=account.getCoinType();
  title.setText(WalletUtils.getDescriptionOrCoinName(account));
  icon.setImageResource(WalletUtils.getIconRes(account));
}

Fixed version (ground truth):
public void setAccount(WalletAccount account){
  this.type=account.getCoinType();
  title.setText(account.getDescriptionOrCoinName());
  icon.setImageResource(WalletUtils.getIconRes(account));
}
Program: 112558
Project: 112558
Buggy source:
public ExchangeRateLoader(final Context context,final Configuration config,final String localSymbol){
  super(context,ExchangeRatesProvider.contentUriToCrypto(context.getPackageName(),localSymbol,false),null,null,new String[]{null},null);
  this.config=config;
  this.packageName=context.getPackageName();
  this.context=context;
}

Fixed version (ground truth):
public ExchangeRateLoader(final Context context,final Configuration config,final String localSymbol){
  super(context,ExchangeRatesProvider.contentUriToCrypto(context.getPackageName(),localSymbol,false),null,null,new String[]{null},null);
  this.config=config;
  this.packageName=context.getPackageName();
  this.context=context;
  this.localCurrency=localSymbol;
}
Program: 112559
Project: 112559
Buggy source:
@Override protected void onStartLoading(){
  super.onStartLoading();
  config.registerOnSharedPreferenceChangeListener(this);
  final IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
  intentFilter.addAction(Intent.ACTION_TIME_TICK);
  context.registerReceiver(broadcastReceiver,intentFilter);
  forceLoad();
}

Fixed version (ground truth):
@Override protected void onStartLoading(){
  super.onStartLoading();
  refreshUri(config.getExchangeCurrencyCode());
  config.registerOnSharedPreferenceChangeListener(this);
  final IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
  intentFilter.addAction(Intent.ACTION_TIME_TICK);
  context.registerReceiver(broadcastReceiver,intentFilter);
  forceLoad();
}
Program: 112560
Project: 112560
Buggy source:
private void onCurrencyChange(){
  final String localCurrency=config.getExchangeCurrencyCode();
  Uri newUri=ExchangeRatesProvider.contentUriToCrypto(packageName,localCurrency,false);
  setUri(newUri);
  forceLoad();
}

Fixed version (ground truth):
private void onCurrencyChange(){
  refreshUri(config.getExchangeCurrencyCode());
  forceLoad();
}
Program: 112561
Project: 112561
Buggy source:
@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_fragment_wrapper);
  if (savedInstanceState == null) {
    ExchangeRatesFragment fragment=new ExchangeRatesFragment();
    fragment.setArguments(getIntent().getExtras());
    getSupportFragmentManager().beginTransaction().add(R.id.container,fragment).commit();
  }
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  getSupportActionBar().setDisplayShowHomeEnabled(false);
}

Fixed version (ground truth):
@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_fragment_wrapper);
  if (savedInstanceState == null) {
    ExchangeRatesFragment fragment=new ExchangeRatesFragment();
    fragment.setArguments(getIntent().getExtras());
    getSupportFragmentManager().beginTransaction().add(R.id.container,fragment).commit();
  }
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
  }
}
Program: 112562
Project: 112562
Buggy source:
@Override public void onListItemClick(final ListView l,final View v,final int position,final long id){
  final Cursor cursor=(Cursor)adapter.getItem(position);
  final ExchangeRate exchangeRate=ExchangeRatesProvider.getExchangeRate(cursor);
  defaultCurrency=exchangeRate.currencyCodeId;
  config.setExchangeCurrencyCode(defaultCurrency);
  updateView();
  Toast.makeText(getActivity(),getString(R.string.set_local_currency,defaultCurrency),Toast.LENGTH_SHORT).show();
  getActivity().finish();
}

Fixed version (ground truth):
@Override public void onListItemClick(final ListView l,final View v,final int position,final long id){
  final Cursor cursor=(Cursor)adapter.getItem(position);
  final ExchangeRate exchangeRate=ExchangeRatesProvider.getExchangeRate(cursor);
  defaultCurrency=exchangeRate.currencyCodeId;
  config.setExchangeCurrencyCode(defaultCurrency);
  Toast.makeText(getActivity(),getString(R.string.set_local_currency,defaultCurrency),Toast.LENGTH_SHORT).show();
  getActivity().finish();
}
Program: 112563
Project: 112563
Buggy source:
@Override public void onDestroy(){
  loaderManager.destroyLoader(ID_TRANSACTION_LOADER);
  loaderManager.destroyLoader(ID_RATE_LOADER);
  super.onDestroy();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  getLoaderManager().destroyLoader(ID_RATE_LOADER);
  super.onDestroy();
}
Program: 112564
Project: 112564
Buggy source:
public void updateView(){
  if (currentBalance != null) {
    String newBalanceStr=GenericUtils.formatFiatValue(currentBalance);
    mainAmount.setAmount(newBalanceStr);
    mainAmount.setSymbol(currentBalance.type.getSymbol());
  }
 else {
    mainAmount.setAmount("String_Node_Str");
    mainAmount.setSymbol("String_Node_Str");
  }
  exchangeRates=ExchangeRatesProvider.getRates(application.getApplicationContext(),config.getExchangeCurrencyCode());
  adapter.setExchangeRates(exchangeRates);
  adapter.notifyDataSetChanged();
}

Fixed version (ground truth):
public void updateView(){
  if (currentBalance != null) {
    String newBalanceStr=GenericUtils.formatFiatValue(currentBalance);
    mainAmount.setAmount(newBalanceStr);
    mainAmount.setSymbol(currentBalance.type.getSymbol());
  }
 else {
    mainAmount.setAmount("String_Node_Str");
    mainAmount.setSymbol("String_Node_Str");
  }
}
Program: 112565
Project: 112565
Buggy source:
@Override protected void weakHandleMessage(OverviewFragment ref,Message msg){
switch (msg.what) {
case WALLET_CHANGED:
    ref.updateWallet();
case UPDATE_VIEW:
  ref.updateView();
break;
}
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") protected void weakHandleMessage(OverviewFragment ref,Message msg){
switch (msg.what) {
case WALLET_CHANGED:
    ref.updateWallet();
  break;
case SET_EXCHANGE_RATES:
ref.setExchangeRates((Map<String,ExchangeRate>)msg.obj);
break;
case UPDATE_VIEW:
ref.updateView();
break;
}
}
Program: 112566
Project: 112566
Buggy source:
@Override public void onAttach(final Context context){
  super.onAttach(context);
  try {
    listener=(Listener)context;
  }
 catch (  ClassCastException e) {
    throw new ClassCastException(context.toString() + "String_Node_Str" + Listener.class);
  }
  application=(WalletApplication)context.getApplicationContext();
  config=application.getConfiguration();
  loaderManager=getLoaderManager();
}

Fixed version (ground truth):
@Override public void onAttach(final Context context){
  super.onAttach(context);
  try {
    listener=(Listener)context;
  }
 catch (  ClassCastException e) {
    throw new ClassCastException(context.toString() + "String_Node_Str" + Listener.class);
  }
  application=(WalletApplication)context.getApplicationContext();
  config=application.getConfiguration();
}
Program: 112567
Project: 112567
Buggy source:
public void updateWallet(){
  if (wallet != null) {
    adapter.replace(wallet);
    currentBalance=null;
    Map<String,ExchangeRate> rates=ExchangeRatesProvider.getRates(application,config.getExchangeCurrencyCode());
    for (    WalletAccount w : wallet.getAllAccounts()) {
      ExchangeRate rate=rates.get(w.getCoinType().getSymbol());
      if (rate == null) {
        log.info("String_Node_Str",w.getCoinType().getName());
        continue;
      }
      if (currentBalance != null) {
        currentBalance=currentBalance.add(rate.rate.convert(w.getBalance()));
      }
 else {
        currentBalance=rate.rate.convert(w.getBalance());
      }
    }
  }
}

Fixed version (ground truth):
public void updateWallet(){
  if (wallet != null) {
    adapter.replace(wallet);
    calculateNewBalance();
    updateView();
  }
}
Program: 112568
Project: 112568
Buggy source:
private void processAddress(String addressStr) throws CoinURIParseException, AddressMalformedException {
  List<CoinType> possibleTypes=GenericUtils.getPossibleTypes(addressStr);
  WalletAccount currentAccount=getAccount(lastAccountId);
  if (currentAccount != null && possibleTypes.contains(currentAccount.getCoinType())) {
    AbstractAddress address=currentAccount.getCoinType().newAddress(addressStr);
    processUri(CoinURI.convertToCoinURI(address,null,null,null));
  }
 else   if (possibleTypes.size() == 1) {
    AbstractAddress address=possibleTypes.get(0).newAddress(addressStr);
    processUri(CoinURI.convertToCoinURI(address,null,null,null));
  }
 else {
    List<WalletAccount> possibleAccounts=getAccounts(possibleTypes);
    AbstractAddress addressOfAccount=null;
    for (    WalletAccount account : possibleAccounts) {
      AbstractAddress testAddress=account.getCoinType().newAddress(addressStr);
      if (account.isAddressMine(testAddress)) {
        addressOfAccount=testAddress;
        break;
      }
    }
    if (addressOfAccount != null) {
      processUri(CoinURI.convertToCoinURI(addressOfAccount,null,null,null));
    }
 else {
      showPayToDialog(addressStr);
    }
  }
}

Fixed version (ground truth):
private void processAddress(String addressStr) throws CoinURIParseException, AddressMalformedException {
  List<CoinType> possibleTypes=GenericUtils.getPossibleTypes(addressStr);
  if (possibleTypes.size() == 1) {
    AbstractAddress address=possibleTypes.get(0).newAddress(addressStr);
    processUri(CoinURI.convertToCoinURI(address,null,null,null));
  }
 else {
    List<WalletAccount> possibleAccounts=getAccounts(possibleTypes);
    AbstractAddress addressOfAccount=null;
    for (    WalletAccount account : possibleAccounts) {
      AbstractAddress testAddress=account.getCoinType().newAddress(addressStr);
      if (account.isAddressMine(testAddress)) {
        addressOfAccount=testAddress;
        break;
      }
    }
    if (addressOfAccount != null) {
      processUri(CoinURI.convertToCoinURI(addressOfAccount,null,null,null));
    }
 else {
      showPayToDialog(addressStr);
    }
  }
}
Program: 112569
Project: 112569
Buggy source:
void setHeight(int height){
  this.height=height;
}

Fixed version (ground truth):
@Override public void setHeight(int height){
  this.height=height;
}
Program: 112570
Project: 112570
Buggy source:
public void setConfirmations(int confirmations){
  this.confirmations=confirmations;
}

Fixed version (ground truth):
@Override public void setConfirmations(int confirmations){
  this.confirmations=confirmations;
}
Program: 112571
Project: 112571
Buggy source:
public Long getEcBlockId(){
  return Convert.parseLong(ecBlockId);
}

Fixed version (ground truth):
public Long getEcBlockId(){
  return Convert.parseUnsignedLong(ecBlockId);
}
Program: 112572
Project: 112572
Buggy source:
@VisibleForTesting void addNewTransactionIfNeeded(Transaction tx){
  lock.lock();
  try {
    log.info("String_Node_Str");
    if (getTransaction(tx.getFullHash()) == null) {
      log.info("String_Node_Str");
      rawtransactions.put(new Sha256Hash(tx.getFullHash()),tx);
      queueOnNewBalance();
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@VisibleForTesting void addNewTransactionIfNeeded(Transaction tx){
  lock.lock();
  try {
    log.info("String_Node_Str");
    Transaction storedTx=getTransaction(tx.getFullHash());
    if (storedTx == null) {
      log.info("String_Node_Str");
      rawtransactions.put(new Sha256Hash(tx.getFullHash()),tx);
      queueOnNewBalance();
    }
 else {
      storedTx.setConfirmations(tx.getConfirmations());
      if (storedTx.getHeight() == Integer.MAX_VALUE) {
        storedTx.setHeight(tx.getHeight());
      }
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 112573
Project: 112573
Buggy source:
private void setupConnectivityStatus(){
  setConnectivityStatus(WalletPocketConnectivity.CONNECTED);
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      if (pocket != null) {
        setConnectivityStatus(pocket.getConnectivityStatus());
      }
    }
  }
,2000);
}

Fixed version (ground truth):
private void setupConnectivityStatus(){
  setConnectivityStatus(WalletPocketConnectivity.CONNECTED);
  handler.postDelayed(new Runnable(){
    @Override public void run(){
      if (pocket != null) {
        setConnectivityStatus(pocket.getConnectivityStatus());
      }
    }
  }
,2000);
}
Program: 112574
Project: 112574
Buggy source:
void selectAccount(String accountId){
  selectAccount(application.getAccount(accountId));
}

Fixed version (ground truth):
public void selectAccount(String accountId,boolean closeDrawer){
  selectAccount(application.getAccount(accountId),closeDrawer);
}
Program: 112575
Project: 112575
Buggy source:
private void selectItem(int position,boolean closeDrawer){
  if (position < 0) {
    position=0;
  }
  mCurrentSelectedPosition=position;
  if (mDrawerListView != null) {
    mDrawerListView.setItemChecked(position,true);
  }
  if (closeDrawer) {
    closeDrawer();
  }
  if (mCallbacks != null && application.getWallet() != null) {
    WalletAccount item=application.getWallet().getAllAccounts().get(position);
    mCallbacks.onAccountSelected(item);
  }
}

Fixed version (ground truth):
private void selectItem(int position,boolean closeDrawer,boolean enableCallbacks){
  if (position < 0) {
    position=0;
  }
  mCurrentSelectedPosition=position;
  if (mDrawerListView != null) {
    mDrawerListView.setItemChecked(position,true);
  }
  if (closeDrawer) {
    closeDrawer();
  }
  if (enableCallbacks && mCallbacks != null && application.getWallet() != null) {
    WalletAccount item=application.getWallet().getAllAccounts().get(position);
    mCallbacks.onAccountSelected(item);
  }
}
Program: 112576
Project: 112576
Buggy source:
void notifyDataSetChanged(){
  ((NavDrawerListAdapter)mDrawerListView.getAdapter()).notifyDataSetChanged();
}

Fixed version (ground truth):
public void notifyDataSetChanged(){
  ((NavDrawerListAdapter)mDrawerListView.getAdapter()).notifyDataSetChanged();
}
Program: 112577
Project: 112577
Buggy source:
@Override public void onActivityResult(final int requestCode,final int resultCode,final Intent intent){
  super.onActivityResult(requestCode,resultCode,intent);
  if (requestCode == REQUEST_CODE_SCAN) {
    if (resultCode == Activity.RESULT_OK) {
      final String input=intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
      try {
        final CoinURI coinUri=new CoinURI(input);
        CoinType scannedType=coinUri.getType();
        if (!Constants.SUPPORTED_COINS.contains(scannedType)) {
          String error=getResources().getString(R.string.unsupported_coin,scannedType.getName());
          throw new CoinURIParseException(error);
        }
 else         if (!getWalletApplication().isAccountExists(scannedType)) {
          String error=getResources().getString(R.string.coin_not_added,scannedType.getName());
          throw new CoinURIParseException(error);
        }
        setSendFromCoin(coinUri);
      }
 catch (      final CoinURIParseException e) {
        String error=getResources().getString(R.string.uri_error,e.getMessage());
        Toast.makeText(this,error,Toast.LENGTH_LONG).show();
      }
    }
  }
 else   if (requestCode == ADD_COIN) {
    if (resultCode == Activity.RESULT_OK) {
      String accountId=intent.getStringExtra(Constants.ARG_ACCOUNT_ID);
      mNavigationDrawerFragment.notifyDataSetChanged();
      mNavigationDrawerFragment.selectAccount(accountId);
    }
  }
}

Fixed version (ground truth):
@Override public void onActivityResult(final int requestCode,final int resultCode,final Intent intent){
  super.onActivityResult(requestCode,resultCode,intent);
  handler.post(new Runnable(){
    @Override public void run(){
      if (requestCode == REQUEST_CODE_SCAN) {
        if (resultCode == Activity.RESULT_OK) {
          final String input=intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
          try {
            final CoinURI coinUri=new CoinURI(input);
            CoinType scannedType=coinUri.getType();
            if (!Constants.SUPPORTED_COINS.contains(scannedType)) {
              String error=getResources().getString(R.string.unsupported_coin,scannedType.getName());
              throw new CoinURIParseException(error);
            }
 else             if (!getWalletApplication().isAccountExists(scannedType)) {
              String error=getResources().getString(R.string.coin_not_added,scannedType.getName());
              throw new CoinURIParseException(error);
            }
            setSendFromCoin(coinUri);
          }
 catch (          final CoinURIParseException e) {
            String error=getResources().getString(R.string.uri_error,e.getMessage());
            Toast.makeText(WalletActivity.this,error,Toast.LENGTH_LONG).show();
          }
        }
      }
 else       if (requestCode == ADD_COIN) {
        if (resultCode == Activity.RESULT_OK) {
          final String accountId=intent.getStringExtra(Constants.ARG_ACCOUNT_ID);
          mNavigationDrawerFragment.notifyDataSetChanged();
          openPocket(accountId);
        }
      }
    }
  }
);
}