nus-yam/ex-repair huggingface dataset:
Program: 146463
Project: 146463
Buggy source:
@Override public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
  ViewGroup viewGroup;
  if (getResources().getConfiguration().screenWidthDp >= 350) {
    viewGroup=(ViewGroup)buttonView.getParent().getParent().getParent();
  }
 else {
    viewGroup=(ViewGroup)buttonView.getParent();
  }
  StockChartView stockChartView=(StockChartView)viewGroup.findViewById(R.id.stockChartView);
  IndicatorManager iManager=stockChartView.getIndicatorManager();
  SeriesBase priceSeries=stockChartView.findSeriesByName(PRICE_SERIES_NAME);
  if (priceSeries != null) {
    if (isChecked) {
      onIndicatorEnabled(stockChartView,buttonView,priceSeries);
    }
 else {
      onIndicatorDisabled(stockChartView,buttonView);
    }
    stockChartView.recalcIndicators();
    stockChartView.recalc();
    stockChartView.invalidate();
  }
 else {
    SwitchCompat sw=(SwitchCompat)buttonView;
    sw.setChecked(!isChecked);
  }
}

Fixed version (ground truth):
@Override public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
  ViewGroup viewGroup;
  if (getResources().getConfiguration().screenWidthDp >= 350) {
    viewGroup=(ViewGroup)buttonView.getParent().getParent().getParent();
  }
 else {
    viewGroup=(ViewGroup)buttonView.getParent();
  }
  StockChartView stockChartView=(StockChartView)viewGroup.findViewById(R.id.stockChartView);
  SeriesBase priceSeries=stockChartView.findSeriesByName(PRICE_SERIES_NAME);
  if (priceSeries != null) {
    if (isChecked) {
      onIndicatorEnabled(stockChartView,buttonView,priceSeries);
    }
 else {
      onIndicatorDisabled(stockChartView,buttonView);
    }
    stockChartView.recalcIndicators();
    stockChartView.recalc();
    stockChartView.invalidate();
  }
 else {
    SwitchCompat sw=(SwitchCompat)buttonView;
    sw.setChecked(!isChecked);
  }
}
Program: 146465
Project: 146465
Buggy source:
@NonNull private String getChartHtml(@NonNull String tradingViewSymbol){
  return String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",tradingViewSymbol);
}

Fixed version (ground truth):
@NonNull private String getChartHtml(@NonNull String tradingViewSymbol){
  return String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",tradingViewSymbol);
}
Program: 146467
Project: 146467
Buggy source:
@Nullable @WorkerThread private String tryGetPriceFromApi(@NonNull String pair){
  Api api=BtcEApplication.get(getActivity()).getApi();
  CallResult<List<Ticker>> callResult=api.getPairInfo(Collections.singleton(pair));
  if (callResult.isSuccess()) {
    return callResult.getPayload().get(0).getLast().toPlainString();
  }
  return null;
}

Fixed version (ground truth):
@Nullable @WorkerThread private String tryGetPriceFromApi(@NonNull String pair){
  Context context=getActivity();
  if (context != null) {
    Api api=BtcEApplication.get(context).getApi();
    CallResult<List<Ticker>> callResult=api.getPairInfo(Collections.singleton(pair));
    if (callResult.isSuccess()) {
      return callResult.getPayload().get(0).getLast().toPlainString();
    }
  }
  return null;
}
Program: 146469
Project: 146469
Buggy source:
@Override protected void onPostExecute(CallResult<AccountInfo> result){
  String notificationText;
  if (result.isSuccess()) {
    notificationText=getString(R.string.FundsInfoUpdatedtext);
    if (isVisible()) {
      refreshFundsView(result.getPayload().getFunds());
    }
  }
 else {
    notificationText=result.getError();
  }
  activityCallback.makeNotification(ConstantHolder.ACCOUNT_INFO_NOTIF_ID,notificationText);
}

Fixed version (ground truth):
@Override protected void onPostExecute(CallResult<AccountInfo> result){
  String notificationText;
  if (result.isSuccess()) {
    notificationText=getString(R.string.FundsInfoUpdatedtext);
    if (isVisible()) {
      refreshFundsView(result.getPayload().getFunds());
    }
  }
 else {
    notificationText=result.getError();
  }
  if (activityCallback != null) {
    activityCallback.makeNotification(ConstantHolder.ACCOUNT_INFO_NOTIF_ID,notificationText);
  }
}
Program: 146470
Project: 146470
Buggy source:
@Override public void onSaveInstanceState(Bundle outState){
  outState.putInt("String_Node_Str",mPairsSpinner.getSelectedItemPosition());
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle outState){
  if (mPairsSpinner != null) {
    outState.putInt("String_Node_Str",mPairsSpinner.getSelectedItemPosition());
  }
}
Program: 146471
Project: 146471
Buggy source:
@Override public void handleMessage(Message msg){
  if (msg.what == MESSAGE_DOWNLOAD) {
    @SuppressWarnings("String_Node_Str") StockChartView token=(StockChartView)msg.obj;
    handleRequest(token);
  }
}

Fixed version (ground truth):
@Override public boolean handleMessage(Message msg){
  if (msg.what == MESSAGE_DOWNLOAD) {
    @SuppressWarnings("String_Node_Str") StockChartView token=(StockChartView)msg.obj;
    handleRequest(token);
  }
  return true;
}
Program: 146472
Project: 146472
Buggy source:
/** 
 * Starts fetching charts data via HandlerThread and Messages
 */
private void updateCharts(){
  ConnectivityManager connectivityManager=(ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
  if (networkInfo == null || !networkInfo.isConnected()) {
    Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  if (mCharts.size() > 0) {
    Set<String> chartNames=mCharts.keySet();
    String[] chartsNamesSorted=chartNames.toArray(new String[chartNames.size()]);
    Arrays.sort(chartsNamesSorted);
    if (mRefreshItem != null) {
      mRefreshItem.setActionView(R.layout.progress_bar_action_view);
      mRefreshItem.expandActionView();
    }
    for (    String x : chartsNamesSorted) {
      String pair=x.replace("String_Node_Str","String_Node_Str").toLowerCase(Locale.US);
      mChartsUpdater.queueChart((StockChartView)mCharts.get(x).findViewById(R.id.StockChartView),pair);
    }
  }
}

Fixed version (ground truth):
/** 
 * Starts fetching charts data via HandlerThread and Messages
 */
private void updateCharts(){
  ConnectivityManager connectivityManager=(ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
  if (networkInfo == null || !networkInfo.isConnected()) {
    Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  if (mCharts.size() > 0) {
    Set<String> chartNames=mCharts.keySet();
    String[] chartsNamesSorted=chartNames.toArray(new String[chartNames.size()]);
    Arrays.sort(chartsNamesSorted);
    if (mRefreshItem != null) {
      mRefreshItem.setActionView(R.layout.progress_bar_action_view);
      mRefreshItem.expandActionView();
    }
    for (    String x : chartsNamesSorted) {
      String pair=x.replace("String_Node_Str","String_Node_Str").toLowerCase(Locale.US);
      mChartsUpdater.queueChart((StockChartView)mCharts.get(x).findViewById(R.id.stockChartView),pair);
    }
  }
}
Program: 146475
Project: 146475
Buggy source:
void getCookies(){
  try {
    URL url=new URL("String_Node_Str");
    HttpsURLConnection connection=(HttpsURLConnection)url.openConnection();
    if (connection.getResponseCode() != HttpsURLConnection.HTTP_OK) {
      showError();
      return;
    }
    mCookies.addAll(connection.getHeaderFields().get("String_Node_Str"));
    BufferedReader reader=new BufferedReader(new InputStreamReader(connection.getInputStream()));
    Pattern pattern=Pattern.compile("String_Node_Str");
    Matcher matcher=pattern.matcher(reader.readLine());
    if (!matcher.find()) {
      showError();
      return;
    }
    reader.close();
    connection.disconnect();
    mCookies.add(matcher.group(1));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
void getCookies(){
  try {
    URL url=new URL("String_Node_Str");
    HttpsURLConnection connection=(HttpsURLConnection)url.openConnection();
    if (connection.getResponseCode() != HttpsURLConnection.HTTP_OK) {
      showError();
      return;
    }
    mCookies.addAll(connection.getHeaderFields().get("String_Node_Str"));
    BufferedReader reader=new BufferedReader(new InputStreamReader(connection.getInputStream()));
    StringBuilder stringBuilder=new StringBuilder();
    String line="String_Node_Str";
    while ((line=reader.readLine()) != null) {
      stringBuilder.append(line);
    }
    Pattern pattern=Pattern.compile("String_Node_Str");
    Matcher matcher=pattern.matcher(stringBuilder.toString());
    if (!matcher.find()) {
      return;
    }
    reader.close();
    connection.disconnect();
    mCookies.add(matcher.group(1));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 146476
Project: 146476
Buggy source:
public void createHandler(){
  mHandler=new Handler(getLooper()){
    @Override public void handleMessage(    Message msg){
      if (msg.what == MESSAGE_DOWNLOAD) {
        @SuppressWarnings("String_Node_Str") StockChartView token=(StockChartView)msg.obj;
        handleRequest(token);
      }
    }
  }
;
}

Fixed version (ground truth):
public void createHandler(){
  mHandler=new Handler(getLooper(),new Handler.Callback(){
    @Override public boolean handleMessage(    Message msg){
      if (msg.what == MESSAGE_DOWNLOAD) {
        @SuppressWarnings("String_Node_Str") StockChartView token=(StockChartView)msg.obj;
        handleRequest(token);
      }
      return true;
    }
  }
);
}
Program: 146477
Project: 146477
Buggy source:
public void startFlipping(){
  mFrontCover=getChildAt(0);
  mBackCover=getChildAt(1);
  if (mFrontCover == null || mBackCover == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  int frontCoverHeight=mFrontCover.getHeight();
  mBackCover.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,frontCoverHeight));
  mFlipRightIn.setTarget(mFrontCover);
  mFlipRightOut.setTarget(mBackCover);
  mFlipLeftIn.setTarget(mBackCover);
  mFlipLeftOut.setTarget(mFrontCover);
  if (mFlipLeftIn == null || mFlipRightIn == null || mFlipLeftOut == null || mFlipRightOut == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (frontCoverShowing) {
    mFlipLeftIn.start();
    mFlipLeftOut.start();
  }
 else {
    mFlipRightIn.start();
    mFlipRightOut.start();
  }
}

Fixed version (ground truth):
public void startFlipping(){
  mFrontCover=getChildAt(0);
  mBackCover=getChildAt(1);
  if (mFrontCover == null || mBackCover == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  int frontCoverHeight=mFrontCover.getHeight();
  mBackCover.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,frontCoverHeight));
  if (mFlipLeftIn == null || mFlipRightIn == null || mFlipLeftOut == null || mFlipRightOut == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  mFlipRightIn.setTarget(mFrontCover);
  mFlipRightOut.setTarget(mBackCover);
  mFlipLeftIn.setTarget(mBackCover);
  mFlipLeftOut.setTarget(mFrontCover);
  if (frontCoverShowing) {
    mFlipLeftIn.start();
    mFlipLeftOut.start();
  }
 else {
    mFlipRightIn.start();
    mFlipRightOut.start();
  }
}
Program: 146479
Project: 146479
Buggy source:
public void queueChart(StockChartView token,String pair){
  requestMap.put(token,pair);
  mHandler.obtainMessage(MESSAGE_DOWNLOAD,token).sendToTarget();
}

Fixed version (ground truth):
public void queueChart(StockChartView token,String pair){
  if (mHandler == null) {
    throw new NullPointerException("String_Node_Str");
  }
  requestMap.put(token,pair);
  mHandler.obtainMessage(MESSAGE_DOWNLOAD,token).sendToTarget();
}
Program: 146480
Project: 146480
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  setHasOptionsMenu(true);
  mInflater=inflater;
  if (mRootView == null) {
    mRootView=inflater.inflate(R.layout.fragment_chart,container,false);
  }
  mChartsUpdater=new ChartsUpdater(new Handler());
  mChartsUpdater.setListener(new Listener<StockChartView>(){
    @Override public void onChartDownloaded(    StockChartView stockChartView){
      if (isVisible()) {
        stockChartView.invalidate();
      }
    }
  }
);
  mChartsUpdater.start();
  mChartsUpdater.getLooper();
  return mRootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  setHasOptionsMenu(true);
  mInflater=inflater;
  if (mRootView == null) {
    mRootView=inflater.inflate(R.layout.fragment_chart,container,false);
  }
  mChartsUpdater=new ChartsUpdater(new Handler());
  mChartsUpdater.setListener(new Listener<StockChartView>(){
    @Override public void onChartDownloaded(    StockChartView stockChartView){
      if (isVisible()) {
        stockChartView.invalidate();
      }
    }
  }
);
  mChartsUpdater.start();
  mChartsUpdater.createHandler();
  return mRootView;
}
Program: 146481
Project: 146481
Buggy source:
void onChartDownloaded(StockChartView token);

Fixed version (ground truth):
void onChartDownloaded(T token);
Program: 146483
Project: 146483
Buggy source:
@Override public void onGlobalLayout(){
  if (mTickersDashboardAdapter.getNumColumns() == 0) {
    final int numColumns=(int)Math.floor(mTickersContainer.getWidth() / (dashboardSpacing + dahboardItemSize));
    if (numColumns > 0) {
      mTickersDashboardAdapter.setNumColumns(numColumns);
      mTickersContainer.setNumColumns(numColumns);
    }
  }
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  if (mTickersDashboardAdapter.getNumColumns() == 0) {
    final int numColumns=(int)Math.floor(mTickersContainer.getWidth() / (dashboardSpacing + dashboardItemSize));
    if (numColumns > 0) {
      mTickersDashboardAdapter.setNumColumns(numColumns);
      mTickersContainer.setNumColumns(numColumns);
    }
  }
}
Program: 146484
Project: 146484
Buggy source:
/** 
 * Updates TickerStorage with new tickers
 */
private void updateStorageWithTickers(){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(getActivity());
  Set<String> pairs=preferences.getStringSet("String_Node_Str",new HashSet<String>());
  for (  String pair : pairs) {
    if (!TickersStorage.loadLatestData().containsKey(pair.replace("String_Node_Str","String_Node_Str").toLowerCase(Locale.US))) {
      Ticker ticker=new Ticker(pair);
      TickersStorage.addNewTicker(ticker);
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates TickerStorage with new tickers
 */
private void updateStorageWithTickers(){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(getActivity());
  Set<String> pairs=preferences.getStringSet("String_Node_Str",new HashSet<String>());
  if (pairs.size() == 0) {
    TickersStorage.loadLatestData().clear();
    TickersStorage.loadPreviousData().clear();
    return;
  }
  for (  String pair : pairs) {
    if (!TickersStorage.loadLatestData().containsKey(pair.replace("String_Node_Str","String_Node_Str").toLowerCase(Locale.US))) {
      Ticker ticker=new Ticker(pair);
      TickersStorage.addNewTicker(ticker);
    }
  }
  for (Iterator<String> iterator=TickersStorage.loadLatestData().keySet().<String>iterator(); iterator.hasNext(); ) {
    String key=iterator.next();
    if (!pairs.contains(key)) {
      iterator.remove();
    }
  }
}
Program: 146486
Project: 146486
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder viewHolder;
  if (convertView == null) {
    convertView=new CheckBox(mContext);
    viewHolder=new ViewHolder();
    viewHolder.checkBox=(CheckBox)convertView;
    viewHolder.checkBox.setTextSize(TypedValue.COMPLEX_UNIT_SP,16);
    viewHolder.checkBox.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        CheckBox checkBox=(CheckBox)v;
        if (checkBox.isChecked()) {
          mSet.add(checkBox.getText().toString());
        }
 else {
          mSet.remove(checkBox.getText().toString());
        }
      }
    }
);
    convertView.setTag(viewHolder);
  }
 else {
    viewHolder=(ViewHolder)convertView.getTag();
  }
  CheckBox checkBox=viewHolder.checkBox;
  String text=(String)getItem(position);
  if (mSet.contains(text)) {
    checkBox.setChecked(true);
  }
 else {
    checkBox.setChecked(false);
  }
  checkBox.setText(text);
  return checkBox;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder viewHolder;
  if (convertView == null) {
    convertView=LayoutInflater.from(mContext).inflate(R.layout.checkbox,parent,false);
    viewHolder=new ViewHolder();
    viewHolder.checkBox=(CheckBox)convertView;
    viewHolder.checkBox.setTextSize(TypedValue.COMPLEX_UNIT_SP,16);
    viewHolder.checkBox.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        CheckBox checkBox=(CheckBox)v;
        if (checkBox.isChecked()) {
          mSet.add(checkBox.getText().toString());
        }
 else {
          mSet.remove(checkBox.getText().toString());
        }
      }
    }
);
    convertView.setTag(viewHolder);
  }
 else {
    viewHolder=(ViewHolder)convertView.getTag();
  }
  CheckBox checkBox=viewHolder.checkBox;
  String text=(String)getItem(position);
  if (mSet.contains(text)) {
    checkBox.setChecked(true);
  }
 else {
    checkBox.setChecked(false);
  }
  checkBox.setText(text);
  return checkBox;
}
Program: 146487
Project: 146487
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPairsSpinner=new Spinner(getActivity());
  mPairsSpinner.setAdapter(new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,getResources().getStringArray(R.array.ExchangePairs)));
  if (savedInstanceState != null) {
    mPairsSpinner.setSelection(savedInstanceState.getInt("String_Node_Str"));
  }
  mPairsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      String selected=parent.getSelectedItem().toString();
      Bundle bundle=new Bundle();
      bundle.putString("String_Node_Str",selected);
      if (mFragmentOpenedFirstTime) {
        getLoaderManager().initLoader(LOADER_ID,bundle,OrdersBookFragment.this);
        mFragmentOpenedFirstTime=false;
      }
 else {
        getLoaderManager().restartLoader(LOADER_ID,bundle,OrdersBookFragment.this);
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mAsksAdapter=new OrdersBookAdapter(getActivity());
  mBidsAdapter=new OrdersBookAdapter(getActivity());
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPairsSpinner=(Spinner)LayoutInflater.from(getActivity()).inflate(R.layout.spinner,null);
  mPairsSpinner.setAdapter(new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,getResources().getStringArray(R.array.ExchangePairs)));
  if (savedInstanceState != null) {
    mPairsSpinner.setSelection(savedInstanceState.getInt("String_Node_Str"));
  }
  mPairsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      String selected=parent.getSelectedItem().toString();
      Bundle bundle=new Bundle();
      bundle.putString("String_Node_Str",selected);
      if (mFragmentOpenedFirstTime) {
        getLoaderManager().initLoader(LOADER_ID,bundle,OrdersBookFragment.this);
        mFragmentOpenedFirstTime=false;
      }
 else {
        getLoaderManager().restartLoader(LOADER_ID,bundle,OrdersBookFragment.this);
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mAsksAdapter=new OrdersBookAdapter(getActivity());
  mBidsAdapter=new OrdersBookAdapter(getActivity());
}
Program: 146489
Project: 146489
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
  SharedPreferences.Editor editor=sharedPreferences.edit();
  editor.putBoolean(NEW_DASHBOARD_NOTIFICATION_SHOWN_KEY,true);
  editor.commit();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int which){
  SharedPreferences.Editor editor=sharedPreferences.edit();
  editor.putBoolean(keyToCheck,true);
  editor.commit();
}
Program: 146490
Project: 146490
Buggy source:
public AuthRequest(long nonce,Context context){
  SharedPreferences sh=PreferenceManager.getDefaultSharedPreferences(context);
  this.nonce=nonce;
  key=sh.getString("String_Node_Str","String_Node_Str");
  secret=sh.getString("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public AuthRequest(long nonce,Context context){
  SharedPreferences sh=PreferenceManager.getDefaultSharedPreferences(context);
  this.nonce=nonce;
  key=SecurityManager.getInstance(context).decryptString(sh.getString(SettingsFragment.KEY_API_KEY,"String_Node_Str"));
  secret=SecurityManager.getInstance(context).decryptString(sh.getString(SettingsFragment.KEY_API_SECRET,"String_Node_Str"));
}
Program: 146491
Project: 146491
Buggy source:
/** 
 * Converts byte array to HEX string
 * @param array String as array of bytes
 * @return String in HEX format
 */
private static String byteArrayToHexString(byte[] array){
  StringBuilder hexString=new StringBuilder();
  for (  byte b : array) {
    int intVal=b & 0xff;
    if (intVal < 0x10)     hexString.append("String_Node_Str");
    hexString.append(Integer.toHexString(intVal));
  }
  return hexString.toString();
}

Fixed version (ground truth):
/** 
 * Converts byte array to HEX string
 * @param array String as array of bytes
 * @return String in HEX format
 */
private String byteArrayToHexString(byte[] array){
  StringBuilder hexString=new StringBuilder();
  for (  byte b : array) {
    int intVal=b & 0xff;
    if (intVal < 0x10)     hexString.append("String_Node_Str");
    hexString.append(Integer.toHexString(intVal));
  }
  return hexString.toString();
}
Program: 146493
Project: 146493
Buggy source:
public UpdateWidgetsTask(Context context,Map<Integer,String> map){
  mContext=context;
  mMap=map;
}

Fixed version (ground truth):
public UpdateWidgetsTask(Context context,Map<Integer,String> map){
  mContext=new WeakReference<>(context);
  mMap=map;
}
Program: 146497
Project: 146497
Buggy source:
public TickersDashboardAdapter(@NotNull Context context,TickersDashboardAdapterCallbackInterface callback){
  mContext=context;
  mCallback=callback;
}

Fixed version (ground truth):
public TickersDashboardAdapter(@NotNull Context context,TickersDashboardAdapterCallbackInterface callback){
  mContext=context;
  mCallback=callback;
  mLeftOut=(AnimatorSet)AnimatorInflater.loadAnimator(mContext,R.animator.card_flip_left_out);
  mLeftIn=(AnimatorSet)AnimatorInflater.loadAnimator(mContext,R.animator.card_flip_left_in);
  mRightOut=(AnimatorSet)AnimatorInflater.loadAnimator(mContext,R.animator.card_flip_right_out);
  mRightIn=(AnimatorSet)AnimatorInflater.loadAnimator(mContext,R.animator.card_flip_right_in);
}
Program: 146498
Project: 146498
Buggy source:
/** 
 * Starts fetching charts data via AsyncTasks
 */
private void updateCharts(){
  ConnectivityManager connectivityManager=(ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
  if (networkInfo == null || !networkInfo.isConnected()) {
    Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  if (mCharts.size() > 0) {
    Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    Set<String> chartNames=mCharts.keySet();
    String[] chartsNamesSorted=chartNames.toArray(new String[chartNames.size()]);
    Arrays.sort(chartsNamesSorted);
    for (    String x : chartsNamesSorted) {
      String pair=x.replace("String_Node_Str","String_Node_Str").toLowerCase(Locale.US);
      mChartsUpdater.queueChart((StockChartView)mCharts.get(x).findViewById(R.id.StockChartView),pair);
    }
  }
}

Fixed version (ground truth):
/** 
 * Starts fetching charts data via HandlerThread and Messages
 */
private void updateCharts(){
  ConnectivityManager connectivityManager=(ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
  if (networkInfo == null || !networkInfo.isConnected()) {
    Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  if (mCharts.size() > 0) {
    Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    Set<String> chartNames=mCharts.keySet();
    String[] chartsNamesSorted=chartNames.toArray(new String[chartNames.size()]);
    Arrays.sort(chartsNamesSorted);
    for (    String x : chartsNamesSorted) {
      String pair=x.replace("String_Node_Str","String_Node_Str").toLowerCase(Locale.US);
      mChartsUpdater.queueChart((StockChartView)mCharts.get(x).findViewById(R.id.StockChartView),pair);
    }
  }
}
Program: 146499
Project: 146499
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mLoadingViewAsks=new ProgressBar(getActivity());
  mLoadingViewBids=new ProgressBar(getActivity());
  LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT);
  lp.gravity=Gravity.CENTER;
  mLoadingViewAsks.setLayoutParams(lp);
  mLoadingViewBids.setLayoutParams(lp);
  mPairsSpinner=new Spinner(getActivity());
  mPairsSpinner.setAdapter(new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,getResources().getStringArray(R.array.ExchangePairs)));
  if (savedInstanceState != null) {
    mPairsSpinner.setSelection(savedInstanceState.getInt("String_Node_Str"));
  }
  mPairsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      String selected=parent.getSelectedItem().toString();
      Bundle bundle=new Bundle();
      bundle.putString("String_Node_Str",selected);
      if (mFragmentOpenedFirstTime) {
        getLoaderManager().initLoader(LOADER_ID,bundle,OrdersBookFragment.this);
        mFragmentOpenedFirstTime=false;
      }
 else {
        getLoaderManager().restartLoader(LOADER_ID,bundle,OrdersBookFragment.this);
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mAsksAdapter=new OrdersBookAdapter(getActivity());
  mBidsAdapter=new OrdersBookAdapter(getActivity());
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPairsSpinner=new Spinner(getActivity());
  mPairsSpinner.setAdapter(new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,getResources().getStringArray(R.array.ExchangePairs)));
  if (savedInstanceState != null) {
    mPairsSpinner.setSelection(savedInstanceState.getInt("String_Node_Str"));
  }
  mPairsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      String selected=parent.getSelectedItem().toString();
      Bundle bundle=new Bundle();
      bundle.putString("String_Node_Str",selected);
      if (mFragmentOpenedFirstTime) {
        getLoaderManager().initLoader(LOADER_ID,bundle,OrdersBookFragment.this);
        mFragmentOpenedFirstTime=false;
      }
 else {
        getLoaderManager().restartLoader(LOADER_ID,bundle,OrdersBookFragment.this);
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mAsksAdapter=new OrdersBookAdapter(getActivity());
  mBidsAdapter=new OrdersBookAdapter(getActivity());
}
Program: 146500
Project: 146500
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  setHasOptionsMenu(true);
  @SuppressLint("String_Node_Str") View v=inflater.inflate(R.layout.fragment_ordersbook,container,false);
  mAsksList=(ListView)v.findViewById(R.id.asks);
  mBidsList=(ListView)v.findViewById(R.id.bids);
  mChartArea=(FrameLayout)v.findViewById(R.id.OrdersBookChart);
  ((LinearLayout)mAsksList.getParent()).addView(mLoadingViewAsks);
  mAsksList.setEmptyView(mLoadingViewAsks);
  ((LinearLayout)mBidsList.getParent()).addView(mLoadingViewBids);
  mBidsList.setEmptyView(mLoadingViewBids);
  getActivity().getActionBar().setCustomView(mPairsSpinner,new ActionBar.LayoutParams(Gravity.RIGHT));
  getActivity().getActionBar().setDisplayShowCustomEnabled(true);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  setHasOptionsMenu(true);
  @SuppressLint("String_Node_Str") View v=inflater.inflate(R.layout.fragment_ordersbook,container,false);
  mAsksList=(ListView)v.findViewById(R.id.asks);
  mBidsList=(ListView)v.findViewById(R.id.bids);
  mChartArea=(FrameLayout)v.findViewById(R.id.OrdersBookChart);
  mLoadingViewAsks=new ProgressBar(getActivity());
  mLoadingViewBids=new ProgressBar(getActivity());
  LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT);
  lp.gravity=Gravity.CENTER;
  mLoadingViewAsks.setLayoutParams(lp);
  mLoadingViewBids.setLayoutParams(lp);
  ((LinearLayout)mAsksList.getParent()).addView(mLoadingViewAsks);
  mAsksList.setEmptyView(mLoadingViewAsks);
  ((LinearLayout)mBidsList.getParent()).addView(mLoadingViewBids);
  mBidsList.setEmptyView(mLoadingViewBids);
  getActivity().getActionBar().setCustomView(mPairsSpinner,new ActionBar.LayoutParams(Gravity.RIGHT));
  getActivity().getActionBar().setDisplayShowCustomEnabled(true);
  return v;
}
Program: 146501
Project: 146501
Buggy source:
public double getUpdated(){
  return updated;
}

Fixed version (ground truth):
public long getUpdated(){
  return updated;
}
Program: 146502
Project: 146502
Buggy source:
/** 
 * Displays selected fragment
 * @param position Position at the list (0-based)
 */
private void displayItem(final int position){
  Fragment fragment=null;
  final FragmentManager fragmentManager=getFragmentManager();
switch (position) {
case 0:
    fragment=mHomeFragment;
  fragmentManager.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE);
break;
case 1:
fragment=new OrdersBookFragment();
break;
case 2:
fragment=new ActiveOrdersFragment();
break;
case 3:
fragment=new TradeHistoryFragment();
break;
case 4:
fragment=new TransHistoryFragment();
break;
case 5:
fragment=new ChartsFragment();
break;
case 6:
fragment=new SettingsFragment();
break;
case 7:
fragment=new NotifiersFragment();
break;
case 8:
fragment=new HelpFragment();
break;
default :
break;
}
final Fragment fr=fragment;
if (fr != null) {
int delay=250;
new Handler().postDelayed(new Runnable(){
@Override public void run(){
FragmentTransaction transaction=fragmentManager.beginTransaction().replace(R.id.content_frame,fr).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
if (position != 0) {
transaction.addToBackStack(String.valueOf(position));
}
transaction.commit();
setTitle(mDrawerListItems[position]);
}
}
,delay);
mDrawerList.setItemChecked(position,true);
mDrawerList.setSelection(position);
if (!isDrawerLocked) {
mDrawerLayout.closeDrawer(mDrawerList);
}
}
}

Fixed version (ground truth):
/** 
 * Displays selected fragment
 * @param position Position at the list (0-based)
 */
private void displayItem(final int position){
  Fragment fragment=null;
  final FragmentManager fragmentManager=getFragmentManager();
switch (position) {
case 0:
    fragment=mHomeFragment;
  fragmentManager.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE);
break;
case 1:
fragment=new OrdersBookFragment();
break;
case 2:
fragment=new ActiveOrdersFragment();
break;
case 3:
fragment=HistoryFragment.newInstance(ListType.Trades);
break;
case 4:
fragment=HistoryFragment.newInstance(ListType.Transactions);
break;
case 5:
fragment=new ChartsFragment();
break;
case 6:
fragment=new SettingsFragment();
break;
case 7:
fragment=new NotifiersFragment();
break;
case 8:
fragment=new HelpFragment();
break;
default :
break;
}
final Fragment fr=fragment;
if (fr != null) {
int delay=250;
new Handler().postDelayed(new Runnable(){
@Override public void run(){
FragmentTransaction transaction=fragmentManager.beginTransaction().replace(R.id.content_frame,fr).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
if (position != 0) {
transaction.addToBackStack(String.valueOf(position));
}
transaction.commit();
setTitle(mDrawerListItems[position]);
}
}
,delay);
mDrawerList.setItemChecked(position,true);
mDrawerList.setSelection(position);
if (!isDrawerLocked) {
mDrawerLayout.closeDrawer(mDrawerList);
}
}
}
Program: 146503
Project: 146503
Buggy source:
public OrdersAdapter(Context context,ListTypes listType){
  mContext=context;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mListType=listType;
  mDateFormat.setTimeZone(TimeZone.getDefault());
}

Fixed version (ground truth):
public OrdersAdapter(Context context,ListType listType){
  mContext=context;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mListType=listType;
  mDateFormat.setTimeZone(TimeZone.getDefault());
}
Program: 146506
Project: 146506
Buggy source:
/** 
 * Makes simple non-authenticated request
 * @param url URL of Trade API
 * @return Response of type JSONObject
 * @throws JSONException
 */
@Nullable public JSONObject makeRequest(String url) throws JSONException {
  try {
    HttpURLConnection connection=(HttpURLConnection)(new URL(url)).openConnection();
    InputStream response=connection.getInputStream();
    StringBuilder sb=new StringBuilder();
    if (connection.getResponseCode() == 200) {
      BufferedReader rd=new BufferedReader(new InputStreamReader(response));
      String line;
      while ((line=rd.readLine()) != null) {
        sb.append(line);
      }
      response.close();
      rd.close();
      return new JSONObject(sb.toString());
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Makes simple non-authenticated request
 * @param urlString URL of Trade API
 * @return Response of type JSONObject
 * @throws JSONException
 */
@Nullable public JSONObject makeRequest(String urlString) throws JSONException {
  HttpURLConnection connection=null;
  BufferedReader rd=null;
  try {
    URL url=new URL(urlString);
    connection=(HttpURLConnection)url.openConnection();
    InputStream response=connection.getInputStream();
    StringBuilder sb=new StringBuilder();
    if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
      rd=new BufferedReader(new InputStreamReader(response));
      String line;
      while ((line=rd.readLine()) != null) {
        sb.append(line);
      }
      return new JSONObject(sb.toString());
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    if (connection != null) {
      connection.disconnect();
    }
    if (rd != null) {
      try {
        rd.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return null;
}
Program: 146507
Project: 146507
Buggy source:
@Override public Loader<JSONObject> onCreateLoader(int id,Bundle args){
  if (mNoItems != null) {
    mNoItems.setVisibility(View.GONE);
  }
  if (mLoadingView != null) {
    mListView.setEmptyView(mLoadingView);
  }
  return new OrdersLoader(getActivity(),null,ListTypes.ActiveOrders);
}

Fixed version (ground truth):
@Override public Loader<JSONObject> onCreateLoader(int id,Bundle args){
  if (mNoItems != null) {
    mNoItems.setVisibility(View.GONE);
  }
  if (mLoadingView != null) {
    mListView.setEmptyView(mLoadingView);
  }
  return new OrdersLoader(getActivity(),null,ListType.ActiveOrders);
}
Program: 146508
Project: 146508
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  mListView=(ListView)getView().findViewById(R.id.ActiveOrdersContainer);
  mAdapter=new OrdersAdapter(getActivity(),ListTypes.ActiveOrders);
  mLoadingView=(ProgressBar)getView().findViewById(R.id.Loading);
  mNoItems=(TextView)getView().findViewById(R.id.NoItems);
  mListView.setEmptyView(mLoadingView);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  mListView=(ListView)getView().findViewById(R.id.ActiveOrdersContainer);
  mAdapter=new OrdersAdapter(getActivity(),ListType.ActiveOrders);
  mLoadingView=(ProgressBar)getView().findViewById(R.id.Loading);
  mNoItems=(TextView)getView().findViewById(R.id.NoItems);
  mListView.setEmptyView(mLoadingView);
}
Program: 146510
Project: 146510
Buggy source:
@Override public void run(){
  fragmentManager.beginTransaction().replace(R.id.content_frame,fr).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).addToBackStack(String.valueOf(position)).commit();
  ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.setTitle(mDrawerListItems[position]);
  }
}

Fixed version (ground truth):
@Override public void run(){
  FragmentTransaction transaction=fragmentManager.beginTransaction().replace(R.id.content_frame,fr).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  if (position != 0) {
    transaction.addToBackStack(String.valueOf(position));
  }
  transaction.commit();
  ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.setTitle(mDrawerListItems[position]);
  }
}
Program: 146511
Project: 146511
Buggy source:
/** 
 * Displays selected fragment
 * @param position Position at the list (0-based)
 */
private void displayItem(final int position){
  Fragment fragment=null;
  final FragmentManager fragmentManager=getFragmentManager();
switch (position) {
case 0:
    fragment=mHomeFragment;
  fragmentManager.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE);
break;
case 1:
fragment=new OrdersBookFragment();
break;
case 2:
fragment=new ActiveOrdersFragment();
break;
case 3:
fragment=new TradeHistoryFragment();
break;
case 4:
fragment=new TransHistoryFragment();
break;
case 5:
fragment=new ChartsFragment();
break;
case 6:
fragment=new SettingsFragment();
break;
case 7:
fragment=new NotifiersFragment();
break;
case 8:
fragment=new HelpFragment();
break;
default :
break;
}
final Fragment fr=fragment;
if (fr != null) {
int delay=250;
new Handler().postDelayed(new Runnable(){
@Override public void run(){
fragmentManager.beginTransaction().replace(R.id.content_frame,fr).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).addToBackStack(String.valueOf(position)).commit();
ActionBar actionBar=getActionBar();
if (actionBar != null) {
actionBar.setTitle(mDrawerListItems[position]);
}
}
}
,delay);
mDrawerList.setItemChecked(position,true);
mDrawerList.setSelection(position);
mDrawerLayout.closeDrawer(mDrawerList);
}
}

Fixed version (ground truth):
/** 
 * Displays selected fragment
 * @param position Position at the list (0-based)
 */
private void displayItem(final int position){
  Fragment fragment=null;
  final FragmentManager fragmentManager=getFragmentManager();
switch (position) {
case 0:
    fragment=mHomeFragment;
  fragmentManager.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE);
break;
case 1:
fragment=new OrdersBookFragment();
break;
case 2:
fragment=new ActiveOrdersFragment();
break;
case 3:
fragment=new TradeHistoryFragment();
break;
case 4:
fragment=new TransHistoryFragment();
break;
case 5:
fragment=new ChartsFragment();
break;
case 6:
fragment=new SettingsFragment();
break;
case 7:
fragment=new NotifiersFragment();
break;
case 8:
fragment=new HelpFragment();
break;
default :
break;
}
final Fragment fr=fragment;
if (fr != null) {
int delay=250;
new Handler().postDelayed(new Runnable(){
@Override public void run(){
FragmentTransaction transaction=fragmentManager.beginTransaction().replace(R.id.content_frame,fr).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
if (position != 0) {
transaction.addToBackStack(String.valueOf(position));
}
transaction.commit();
ActionBar actionBar=getActionBar();
if (actionBar != null) {
actionBar.setTitle(mDrawerListItems[position]);
}
}
}
,delay);
mDrawerList.setItemChecked(position,true);
mDrawerList.setSelection(position);
mDrawerLayout.closeDrawer(mDrawerList);
}
}
Program: 146512
Project: 146512
Buggy source:
@Override public void onBackPressed(){
  super.onBackPressed();
  FragmentManager fm=getFragmentManager();
  if (fm.getBackStackEntryCount() != 0) {
    String stackName=fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName();
    mDrawerList.setItemChecked(Integer.parseInt(stackName),true);
    mDrawerList.setSelection(Integer.parseInt(stackName));
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  super.onBackPressed();
  int switchToPosition=0;
  FragmentManager fm=getFragmentManager();
  if (fm.getBackStackEntryCount() != 0) {
    String stackName=fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName();
    switchToPosition=Integer.parseInt(stackName);
  }
  mDrawerList.setItemChecked(switchToPosition,true);
  mDrawerList.setSelection(switchToPosition);
  ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.setTitle(mDrawerListItems[switchToPosition]);
  }
}
Program: 146513
Project: 146513
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
  Object systemSensorManager=XposedHelpers.getObjectField(param.thisObject,"String_Node_Str");
  SparseArray<Sensor> sensors=getSensors(systemSensorManager);
  int handle=(Integer)(param.args[0]);
  Sensor sensor=sensors.get(handle);
  Context context=(Context)XposedHelpers.getObjectField(systemSensorManager,"String_Node_Str");
  if (!isPackageAllowedToSeeTrueSensor(lpparam.processName,sensor,context) && getSensorStatus(sensor,context) == Constants.SENSOR_STATUS_MOCK_VALUES) {
    float[] values=getSensorValues(sensor,context);
    System.arraycopy(values,0,param.args[1],0,values.length);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
  Object systemSensorManager=XposedHelpers.getObjectField(param.thisObject,"String_Node_Str");
  SparseArray<Sensor> sensors=getSensors(systemSensorManager);
  int handle=(Integer)(param.args[0]);
  Sensor sensor=sensors.get(handle);
  Context context=AndroidAppHelper.currentApplication();
  if (!isPackageAllowedToSeeTrueSensor(lpparam.processName,sensor,context) && getSensorStatus(sensor,context) == Constants.SENSOR_STATUS_MOCK_VALUES) {
    float[] values=getSensorValues(sensor,context);
    System.arraycopy(values,0,param.args[1],0,values.length);
  }
}
Program: 146514
Project: 146514
Buggy source:
@Override public void modifySensor(final XC_LoadPackage.LoadPackageParam lpparam){
  XC_MethodHook mockSensorHook=new XC_MethodHook(){
    @SuppressWarnings("String_Node_Str") @Override protected void beforeHookedMethod(    MethodHookParam param) throws Throwable {
      Object systemSensorManager=XposedHelpers.getObjectField(param.thisObject,"String_Node_Str");
      SparseArray<Sensor> sensors=getSensors(systemSensorManager);
      int handle=(Integer)(param.args[0]);
      Sensor sensor=sensors.get(handle);
      Context context=(Context)XposedHelpers.getObjectField(systemSensorManager,"String_Node_Str");
      if (!isPackageAllowedToSeeTrueSensor(lpparam.processName,sensor,context) && getSensorStatus(sensor,context) == Constants.SENSOR_STATUS_MOCK_VALUES) {
        float[] values=getSensorValues(sensor,context);
        System.arraycopy(values,0,param.args[1],0,values.length);
      }
    }
  }
;
  XposedHelpers.findAndHookMethod("String_Node_Str",lpparam.classLoader,"String_Node_Str",int.class,float[].class,int.class,long.class,mockSensorHook);
}

Fixed version (ground truth):
@Override public void modifySensor(final XC_LoadPackage.LoadPackageParam lpparam){
  XC_MethodHook mockSensorHook=new XC_MethodHook(){
    @SuppressWarnings("String_Node_Str") @Override protected void beforeHookedMethod(    MethodHookParam param) throws Throwable {
      Object systemSensorManager=XposedHelpers.getObjectField(param.thisObject,"String_Node_Str");
      SparseArray<Sensor> sensors=getSensors(systemSensorManager);
      int handle=(Integer)(param.args[0]);
      Sensor sensor=sensors.get(handle);
      Context context=AndroidAppHelper.currentApplication();
      if (!isPackageAllowedToSeeTrueSensor(lpparam.processName,sensor,context) && getSensorStatus(sensor,context) == Constants.SENSOR_STATUS_MOCK_VALUES) {
        float[] values=getSensorValues(sensor,context);
        System.arraycopy(values,0,param.args[1],0,values.length);
      }
    }
  }
;
  XposedHelpers.findAndHookMethod("String_Node_Str",lpparam.classLoader,"String_Node_Str",int.class,float[].class,int.class,long.class,mockSensorHook);
}
Program: 146515
Project: 146515
Buggy source:
private boolean isWhitelistEnabled(){
  sharedPreferences.reload();
  return sharedPreferences.getString(Constants.PREFS_KEY_BLOCKLIST,"String_Node_Str").equalsIgnoreCase("String_Node_Str");
}

Fixed version (ground truth):
private boolean isWhitelistEnabled(){
  sharedPreferences.reload();
  return sharedPreferences.getString(Constants.PREFS_KEY_BLOCKLIST,BlocklistType.BLACKLIST.getValue()).equalsIgnoreCase(BlocklistType.WHITELIST.getValue());
}
Program: 146516
Project: 146516
Buggy source:
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  if (!lpparam.packageName.equals(Constants.PACKAGE_NAME)) {
    @SuppressWarnings("String_Node_Str") List<Sensor> fullSensorList=new ArrayList<>((Collection<? extends Sensor>)param.getResult());
    Iterator<Sensor> iterator=fullSensorList.iterator();
    while (iterator.hasNext()) {
      Sensor sensor=iterator.next();
      if (!shouldAppHalt(lpparam.packageName,sensor) && getSensorStatus(sensor) == Constants.SENSOR_STATUS_REMOVE_SENSOR) {
        iterator.remove();
      }
    }
    param.setResult(fullSensorList);
  }
}

Fixed version (ground truth):
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  if (!lpparam.packageName.equals(Constants.PACKAGE_NAME)) {
    @SuppressWarnings("String_Node_Str") List<Sensor> fullSensorList=new ArrayList<>((Collection<? extends Sensor>)param.getResult());
    Iterator<Sensor> iterator=fullSensorList.iterator();
    while (iterator.hasNext()) {
      Sensor sensor=iterator.next();
      if (!shouldAppHalt(lpparam.processName,sensor) && getSensorStatus(sensor) == Constants.SENSOR_STATUS_REMOVE_SENSOR) {
        iterator.remove();
      }
    }
    param.setResult(fullSensorList);
  }
}