nus-yam/ex-repair huggingface dataset:
Program: 35926
Project: 35926
Buggy source:
/** 
 * Creates a new UploadBitmapRfcCompliantListenableRequest request.
 * @param method The request method, {@see Method}
 * @param url The url to be requested.
 * @param listener The listener for success.
 * @param errListener The listener for errors.
 * @param bmp The bitmap to be uploaded.
 * @param filename The filename under which to submit the image.
 */
public UploadBitmapRfcCompliantListenableRequest(final int method,final String url,final Listener<String> listener,final ErrorListener errListener,final Bitmap bmp,final String filename){
  super(method,url,listener,errListener);
  bitmap=bmp;
  this.filename=filename;
  setRetryPolicy(new DefaultRetryPolicy(30000,1,1.5f));
}

Fixed version (ground truth):
/** 
 * Creates a new UploadBitmapRfcCompliantListenableRequest request.
 * @param method The request method, {@see Method}
 * @param url The url to be requested.
 * @param listener The listener for success.
 * @param errListener The listener for errors.
 * @param bmp The bitmap to be uploaded.
 * @param filename The filename under which to submit the image.
 */
public UploadBitmapRfcCompliantListenableRequest(final int method,@NonNull final String url,@NonNull final Listener<String> listener,@Nullable final ErrorListener errListener,@NonNull final Bitmap bmp,@NonNull final String filename){
  super(method,url,listener,errListener);
  bitmap=bmp;
  this.filename=filename;
  setRetryPolicy(new DefaultRetryPolicy(30000,1,1.5f));
}
Program: 35927
Project: 35927
Buggy source:
public void mapReceived(ArrayList<Byte> msg){
  currentMessage=msg;
switch (currentMessage.get(3)) {
case INFO_MENU:
switch (currentMessage.get(6)) {
case RDS_VAL:
      int rds=(currentMessage.get(20) == 0x2A) ? 1 : 0;
    triggerCallback("String_Node_Str",rds);
  break;
case PTY_VAL:
int pty=(currentMessage.get(20) == 0x2A) ? 1 : 0;
triggerCallback("String_Node_Str",pty);
break;
}
break;
case RDS_TEXT:
triggerCallback("String_Node_Str",decodeData());
break;
case SCREEN_UPDATE:
byte screen_mode=currentMessage.get(4);
triggerCallback("String_Node_Str",(int)screen_mode);
break;
case TONE_DATA:
int bass=getToneLevel(ToneType.BASS,currentMessage.get(4));
int treb=getToneLevel(ToneType.TREB,currentMessage.get(5));
int fade=getToneLevel(ToneType.FADE,currentMessage.get(6));
int bal=getToneLevel(ToneType.BAL,currentMessage.get(7));
triggerCallback("String_Node_Str",bass,treb,fade,bal);
break;
case RADIO_METADATA:
byte metaDataType=currentMessage.get(6);
String dataText=decodeData();
switch (metaDataType) {
case 0x41:
triggerCallback("String_Node_Str",dataText);
break;
case 0x04:
case 0x44:
triggerCallback("String_Node_Str",dataText);
break;
case 0x45:
triggerCallback("String_Node_Str",dataText);
break;
case 0x02:
triggerCallback("String_Node_Str",dataText);
break;
}
break;
}
}

Fixed version (ground truth):
public void mapReceived(ArrayList<Byte> msg){
  currentMessage=msg;
switch (currentMessage.get(3)) {
case INFO_MENU:
switch (currentMessage.get(6)) {
case RDS_VAL:
      int rds=(currentMessage.get(20) == 0x2A) ? 1 : 0;
    triggerCallback("String_Node_Str",rds);
  break;
case PTY_VAL:
int pty=(currentMessage.get(20) == 0x2A) ? 1 : 0;
triggerCallback("String_Node_Str",pty);
break;
}
break;
case RDS_TEXT:
triggerCallback("String_Node_Str",decodeData());
break;
case SCREEN_UPDATE:
byte screen_mode=currentMessage.get(4);
triggerCallback("String_Node_Str",(int)screen_mode);
break;
case TONE_DATA:
if (currentMessage.get(1) == 0x07) {
int bass=getToneLevel(ToneType.BASS,currentMessage.get(4));
int treb=getToneLevel(ToneType.TREB,currentMessage.get(5));
int fade=getToneLevel(ToneType.FADE,currentMessage.get(6));
int bal=getToneLevel(ToneType.BAL,currentMessage.get(7));
triggerCallback("String_Node_Str",bass,treb,fade,bal);
}
break;
case RADIO_METADATA:
byte metaDataType=currentMessage.get(6);
String dataText=decodeData();
switch (metaDataType) {
case 0x41:
triggerCallback("String_Node_Str",dataText);
break;
case 0x04:
case 0x44:
triggerCallback("String_Node_Str",dataText);
break;
case 0x45:
triggerCallback("String_Node_Str",dataText);
break;
case 0x02:
triggerCallback("String_Node_Str",dataText);
break;
}
break;
}
}
Program: 35928
Project: 35928
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_activity);
  mDrawerList=(ListView)findViewById(R.id.left_drawer);
  String[] settingsItems=getResources().getStringArray(R.array.options_array);
  mDrawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  mDrawerToggle=new ActionBarDrawerToggle(this,mDrawerLayout,R.drawable.ic_drawer,R.string.drawer_open,R.string.drawer_close){
    public void onDrawerClosed(    View view){
      super.onDrawerClosed(view);
      invalidateOptionsMenu();
    }
    public void onDrawerOpened(    View drawerView){
      super.onDrawerOpened(drawerView);
      invalidateOptionsMenu();
    }
  }
;
  mDrawerLayout.post(new Runnable(){
    @Override public void run(){
      mDrawerToggle.syncState();
    }
  }
);
  mDrawerLayout.setDrawerListener(mDrawerToggle);
  getActionBar().setIcon(R.drawable.ic_drawer);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  mDrawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_item,settingsItems));
  mDrawerList.setOnItemClickListener(mDrawerClickListener);
  if (savedInstanceState == null) {
    getFragmentManager().addOnBackStackChangedListener(mBackstackStateListener);
    FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
    fragmentTx.replace(R.id.main,mFragments[0]);
    getActionBar().setDisplayShowTitleEnabled(true);
    fragmentTx.addToBackStack(mFragmentTitles[0]);
    fragmentTx.commit();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_activity);
  mDrawerList=(ListView)findViewById(R.id.left_drawer);
  String[] settingsItems=getResources().getStringArray(R.array.options_array);
  mDrawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  mDrawerToggle=new ActionBarDrawerToggle(this,mDrawerLayout,R.drawable.ic_drawer,R.string.drawer_open,R.string.drawer_close){
    public void onDrawerClosed(    View view){
      super.onDrawerClosed(view);
      invalidateOptionsMenu();
    }
    public void onDrawerOpened(    View drawerView){
      super.onDrawerOpened(drawerView);
      invalidateOptionsMenu();
    }
  }
;
  mDrawerLayout.post(new Runnable(){
    @Override public void run(){
      mDrawerToggle.syncState();
    }
  }
);
  mDrawerLayout.setDrawerListener(mDrawerToggle);
  getActionBar().setIcon(R.drawable.ic_drawer);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  mDrawerListAdapter=new ArrayAdapter<String>(this,R.layout.drawer_item,settingsItems);
  mDrawerList.setAdapter(mDrawerListAdapter);
  mDrawerList.setOnItemClickListener(mDrawerClickListener);
  if (savedInstanceState == null) {
    getFragmentManager().addOnBackStackChangedListener(mBackstackStateListener);
    FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
    fragmentTx.replace(R.id.main,mFragments[0]);
    getActionBar().setDisplayShowTitleEnabled(true);
    fragmentTx.addToBackStack(mFragmentTitles[0]);
    fragmentTx.commit();
  }
}
Program: 35929
Project: 35929
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,final int position,long id){
  mDrawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener(){
    @Override public void onDrawerClosed(    View drawerView){
      super.onDrawerClosed(drawerView);
      getActionBar().setDisplayShowTitleEnabled(true);
      FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
      String fragmentTitle=mFragmentTitles[position];
      if (fragmentTitle.equals("String_Node_Str")) {
        Intent intent=new Intent();
        intent.setClassName("String_Node_Str","String_Node_Str");
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
      }
 else {
        fragmentTx.replace(R.id.main,mFragments[position]);
        fragmentTx.addToBackStack(fragmentTitle);
        fragmentTx.commit();
      }
    }
  }
);
  mDrawerLayout.closeDrawer(mDrawerList);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,final int position,long id){
  mDrawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener(){
    @Override public void onDrawerClosed(    View drawerView){
      super.onDrawerClosed(drawerView);
      getActionBar().setDisplayShowTitleEnabled(true);
      FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
      String fragmentTitle=mFragmentTitles[position];
      if (fragmentTitle.equals("String_Node_Str")) {
        Intent intent=new Intent();
        intent.setClassName("String_Node_Str","String_Node_Str");
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
      }
 else {
        fragmentTx.replace(R.id.main,mFragments[position]);
        fragmentTx.addToBackStack(fragmentTitle);
        fragmentTx.commit();
      }
    }
  }
);
  mDrawerList.clearChoices();
  mDrawerListAdapter.notifyDataSetChanged();
  mDrawerLayout.closeDrawer(mDrawerList);
}
Program: 35930
Project: 35930
Buggy source:
/** 
 * Callback to handle Ignition State Updates
 * @param int State of Ignition (0, 1, 2)
 */
@Override public void onUpdateIgnitionSate(final int state){
  int screenState=(state > 0) ? SCREEN_ON : SCREEN_ON;
  setScreenState(screenState);
}

Fixed version (ground truth):
/** 
 * Callback to handle Ignition State Updates
 * @param int State of Ignition (0, 1, 2)
 */
@Override public void onUpdateIgnitionSate(final int state){
  int screenState=(state > 0) ? SCREEN_ON : SCREEN_OFF;
  setScreenState(screenState);
}
Program: 35932
Project: 35932
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  getActivity().registerReceiver(receiver,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  getActivity().registerReceiver(mChargingReceiver,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  Log.d(TAG,"String_Node_Str");
}
Program: 35933
Project: 35933
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  Log.d(TAG,"String_Node_Str");
  mIBusService.removeCallback(mIBusUpdateListener);
  releaseWakelock();
  if (mIBusBound) {
    unbindServices();
  }
  getActivity().unregisterReceiver(receiver);
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  Log.d(TAG,"String_Node_Str");
  mIBusService.removeCallback(mIBusUpdateListener);
  releaseWakelock();
  if (mIBusBound) {
    unbindServices();
  }
  getActivity().unregisterReceiver(mChargingReceiver);
}
Program: 35935
Project: 35935
Buggy source:
public byte[] sendVolumeUp(){
  return new byte[]{mSteeringWheelAddress,0x04,mRadioAddress,0x32,0x31,0x3F};
}

Fixed version (ground truth):
public byte[] sendVolumeUp(){
  return new byte[]{mSteeringWheelAddress,0x04,mRadioAddress,0x32,0x11,0x1F};
}
Program: 35936
Project: 35936
Buggy source:
public byte[] sendVolumeDown(){
  return new byte[]{mSteeringWheelAddress,0x04,mRadioAddress,0x32,0x30,0x3E};
}

Fixed version (ground truth):
public byte[] sendVolumeDown(){
  return new byte[]{mSteeringWheelAddress,0x04,mRadioAddress,0x32,0x10,0x1E};
}
Program: 35937
Project: 35937
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  getActivity().registerReceiver(mChargingReceiver,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  getActivity().registerReceiver(receiver,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  Log.d(TAG,"String_Node_Str");
}
Program: 35938
Project: 35938
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  Log.d(TAG,"String_Node_Str");
  mIBusService.removeCallback(mIBusUpdateListener);
  releaseWakelock();
  if (mIBusBound) {
    unbindServices();
  }
  getActivity().unregisterReceiver(mChargingReceiver);
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  Log.d(TAG,"String_Node_Str");
  mIBusService.removeCallback(mIBusUpdateListener);
  releaseWakelock();
  if (mIBusBound) {
    unbindServices();
  }
  getActivity().unregisterReceiver(receiver);
}
Program: 35940
Project: 35940
Buggy source:
@Override public void onDrawerClosed(View drawerView){
  super.onDrawerClosed(drawerView);
  getActionBar().setDisplayShowTitleEnabled(true);
  getActionBar().setTitle(mFragmentTitles[position]);
  FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
  fragmentTx.replace(R.id.main,mFragments[position]);
  fragmentTx.addToBackStack(null);
  fragmentTx.commit();
}

Fixed version (ground truth):
@Override public void onDrawerClosed(View drawerView){
  super.onDrawerClosed(drawerView);
  getActionBar().setDisplayShowTitleEnabled(true);
  FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
  fragmentTx.replace(R.id.main,mFragments[position]);
  fragmentTx.addToBackStack(mFragmentTitles[position]);
  fragmentTx.commit();
}
Program: 35941
Project: 35941
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,final int position,long id){
  mDrawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener(){
    @Override public void onDrawerClosed(    View drawerView){
      super.onDrawerClosed(drawerView);
      getActionBar().setDisplayShowTitleEnabled(true);
      getActionBar().setTitle(mFragmentTitles[position]);
      FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
      fragmentTx.replace(R.id.main,mFragments[position]);
      fragmentTx.addToBackStack(null);
      fragmentTx.commit();
    }
  }
);
  mDrawerLayout.closeDrawer(mDrawerList);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,final int position,long id){
  mDrawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener(){
    @Override public void onDrawerClosed(    View drawerView){
      super.onDrawerClosed(drawerView);
      getActionBar().setDisplayShowTitleEnabled(true);
      FragmentTransaction fragmentTx=getFragmentManager().beginTransaction();
      fragmentTx.replace(R.id.main,mFragments[position]);
      fragmentTx.addToBackStack(mFragmentTitles[position]);
      fragmentTx.commit();
    }
  }
);
  mDrawerLayout.closeDrawer(mDrawerList);
}
Program: 35942
Project: 35942
Buggy source:
/** 
 * Send a new time setting to the IKE IBus message: 3B 06 80 40 01 <Hours> <Mins> <CRC>
 * @param args Two ints MUST be providedint hours, int minutes
 * @return Byte array of composed message to send to IBus
 */
public byte[] setTime(Object... args){
  int hours=(Integer)args[0];
  int minutes=(Integer)args[1];
  byte[] completedMessage=new byte[]{gfxDriver,0x06,IKESystem,OBCRequestSet,0x01,(byte)hours,(byte)minutes,0x00};
  completedMessage[6]=genMessageCRC(completedMessage);
  return completedMessage;
}

Fixed version (ground truth):
/** 
 * Send a new time setting to the IKE IBus message: 3B 06 80 40 01 <Hours> <Mins> <CRC>
 * @param args Two ints MUST be providedint hours, int minutes
 * @return Byte array of composed message to send to IBus
 */
public byte[] setTime(Object... args){
  int hours=(Integer)args[0];
  int minutes=(Integer)args[1];
  byte[] completedMessage=new byte[]{gfxDriver,0x06,IKESystem,OBCRequestSet,0x01,(byte)hours,(byte)minutes,0x00};
  completedMessage[completedMessage.length - 1]=genMessageCRC(completedMessage);
  return completedMessage;
}
Program: 35943
Project: 35943
Buggy source:
/** 
 * Send a new date setting to the IKE IBus message: 3B 07 80 40 02 <Day> <Month> <Year> <CRC>
 * @param args Three ints MUST be providedint day, int month, int year
 * @return Byte array of composed message to send to IBus
 */
public byte[] setDate(Object... args){
  int day=(Integer)args[0];
  int month=(Integer)args[1];
  int year=(Integer)args[2];
  byte[] completedMessage=new byte[]{gfxDriver,0x07,IKESystem,OBCRequestSet,0x02,(byte)day,(byte)month,(byte)year,0x00};
  completedMessage[7]=genMessageCRC(completedMessage);
  return completedMessage;
}

Fixed version (ground truth):
/** 
 * Send a new date setting to the IKE IBus message: 3B 07 80 40 02 <Day> <Month> <Year> <CRC>
 * @param args Three ints MUST be providedint day, int month, int year
 * @return Byte array of composed message to send to IBus
 */
public byte[] setDate(Object... args){
  int day=(Integer)args[0];
  int month=(Integer)args[1];
  int year=(Integer)args[2];
  byte[] completedMessage=new byte[]{gfxDriver,0x07,IKESystem,OBCRequestSet,0x02,(byte)day,(byte)month,(byte)year,0x00};
  completedMessage[completedMessage.length - 1]=genMessageCRC(completedMessage);
  return completedMessage;
}
Program: 35944
Project: 35944
Buggy source:
/** 
 * Sends "next" media key press.
 */
public void sendNextKey(){
  Log.d(TAG,"String_Node_Str");
  sendKeyEvent(KeyEvent.KEYCODE_MEDIA_NEXT);
}

Fixed version (ground truth):
/** 
 * Sends "next" media key press.
 */
public void sendNextKey(){
  sendKeyEvent(KeyEvent.KEYCODE_MEDIA_NEXT);
}
Program: 35945
Project: 35945
Buggy source:
/** 
 * Send the ACTION_UP and ACTION_DOWN key events
 * @param keyCode The key we are pressing
 * @return true if both clicks were delivered, else false
 */
private boolean sendKeyEvent(int keyCode){
  boolean keyDown=mAudioController.sendMediaKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,keyCode));
  boolean keyUp=mAudioController.sendMediaKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,keyCode));
  return keyDown && keyUp;
}

Fixed version (ground truth):
/** 
 * Send the ACTION_UP and ACTION_DOWN key events
 * @param keyCode The key we are pressing
 * @return true if both clicks were delivered, else false
 */
private boolean sendKeyEvent(int keyCode){
  KeyEvent keyDown=new KeyEvent(KeyEvent.ACTION_DOWN,keyCode);
  KeyEvent keyUp=new KeyEvent(KeyEvent.ACTION_UP,keyCode);
  boolean keyDownRes=mAudioController.sendMediaKeyEvent(keyDown);
  boolean keyUpRes=mAudioController.sendMediaKeyEvent(keyUp);
  if (!keyDownRes && !keyUpRes) {
    Intent downIntent=new Intent(Intent.ACTION_MEDIA_BUTTON,null);
    downIntent.putExtra(Intent.EXTRA_KEY_EVENT,keyDown);
    getBaseContext().sendOrderedBroadcast(downIntent,null);
    Intent upIntent=new Intent(Intent.ACTION_MEDIA_BUTTON,null);
    upIntent.putExtra(Intent.EXTRA_KEY_EVENT,keyUp);
    getBaseContext().sendOrderedBroadcast(downIntent,null);
  }
  return keyDownRes && keyUpRes;
}
Program: 35947
Project: 35947
Buggy source:
private void initiateHandlers(){
  IBusSysMap.put(DeviceAddressEnum.Radio.toByte(),new RadioSystemCommand());
  IBusSysMap.put(DeviceAddressEnum.InstrumentClusterElectronics.toByte(),new IKESystemCommand());
  IBusSysMap.put(DeviceAddressEnum.NavigationEurope.toByte(),new NavigationSystemCommand());
  IBusSysMap.put(DeviceAddressEnum.MultiFunctionSteeringWheel.toByte(),new SteeringWheelSystemCommand());
  IBusSysMap.put(DeviceAddressEnum.GraphicsNavigationDriver.toByte(),new BoardMonitorSystemCommand());
  for (  Object key : IBusSysMap.keySet())   IBusSysMap.get(key).registerCallbacks(mIBusCbListener);
  callbackRegistered=true;
}

Fixed version (ground truth):
private void initiateHandlers(){
  IBusSysMap.put(DeviceAddressEnum.Radio.toByte(),new RadioSystemCommand());
  IBusSysMap.put(DeviceAddressEnum.InstrumentClusterElectronics.toByte(),new IKESystemCommand());
  IBusSysMap.put(DeviceAddressEnum.NavigationEurope.toByte(),new NavigationSystemCommand());
  IBusSysMap.put(DeviceAddressEnum.MultiFunctionSteeringWheel.toByte(),new SteeringWheelSystemCommand());
  IBusSysMap.put(DeviceAddressEnum.OnBoardMonitor.toByte(),new BoardMonitorSystemCommand());
  for (  Object key : IBusSysMap.keySet())   IBusSysMap.get(key).registerCallbacks(mIBusCbListener);
  callbackRegistered=true;
}
Program: 35950
Project: 35950
Buggy source:
/** 
 * Acquire a screen wake lock to either turn the screen on or off
 * @param screenState if true, turn the screen on, else turn it off
 */
@SuppressWarnings("String_Node_Str") private void changeScreenState(boolean screenState){
  if (mPowerManager == null)   mPowerManager=(PowerManager)getActivity().getSystemService(Context.POWER_SERVICE);
  boolean modeChange=false;
  String state=(screenState == true) ? "String_Node_Str" : "String_Node_Str";
  Log.d(TAG,"String_Node_Str" + state);
  Window window=getActivity().getWindow();
  WindowManager.LayoutParams layoutP=window.getAttributes();
  if (screenState && !mScreenOn) {
    modeChange=true;
    mScreenOn=true;
    layoutP.screenBrightness=-1;
    screenWakeLock=mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,"String_Node_Str");
    window.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD);
  }
 else {
    if (mScreenOn) {
      modeChange=true;
      mScreenOn=false;
      layoutP.screenBrightness=0;
      screenWakeLock=mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"String_Node_Str");
    }
  }
  if (modeChange) {
    releaseWakelock();
    window.setAttributes(layoutP);
    screenWakeLock.acquire();
  }
}

Fixed version (ground truth):
/** 
 * Acquire a screen wake lock to either turn the screen on or off
 * @param screenState if true, turn the screen on, else turn it off
 */
@SuppressWarnings("String_Node_Str") private void changeScreenState(boolean screenState){
  if (mPowerManager == null)   mPowerManager=(PowerManager)getActivity().getSystemService(Context.POWER_SERVICE);
  boolean modeChange=false;
  Window window=getActivity().getWindow();
  WindowManager.LayoutParams layoutP=window.getAttributes();
  if (screenState && !mScreenOn) {
    Log.d(TAG,"String_Node_Str");
    modeChange=true;
    mScreenOn=true;
    layoutP.screenBrightness=-1;
    screenWakeLock=mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,"String_Node_Str");
    window.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD);
  }
  if (!screenState && mScreenOn) {
    modeChange=true;
    mScreenOn=false;
    Log.d(TAG,"String_Node_Str");
    layoutP.screenBrightness=0;
    screenWakeLock=mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"String_Node_Str");
  }
  if (modeChange) {
    releaseWakelock();
    window.setAttributes(layoutP);
    screenWakeLock.acquire();
  }
}
Program: 35951
Project: 35951
Buggy source:
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
  Log.d(TAG,"String_Node_Str");
  if (isChecked) {
    radioLayout.setVisibility(View.GONE);
    tabletLayout.setVisibility(View.VISIBLE);
    if (!(mCurrentRadioMode == RadioModes.AUX))     changeRadioMode(RadioModes.AUX);
  }
 else {
    if (mIsPlaying)     mPlayerService.sendPauseKey();
    radioLayout.setVisibility(View.VISIBLE);
    tabletLayout.setVisibility(View.GONE);
    if (mCurrentRadioMode == RadioModes.AUX || mCurrentRadioMode == RadioModes.CD)     changeRadioMode(RadioModes.Radio);
  }
}

Fixed version (ground truth):
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
  Log.d(TAG,"String_Node_Str");
  if (isChecked) {
    radioLayout.setVisibility(View.GONE);
    tabletLayout.setVisibility(View.VISIBLE);
    if (!(mCurrentRadioMode == RadioModes.AUX)) {
      changeRadioMode(RadioModes.AUX);
    }
  }
 else {
    if (mIsPlaying)     mPlayerService.sendPauseKey();
    radioLayout.setVisibility(View.VISIBLE);
    tabletLayout.setVisibility(View.GONE);
    if (mCurrentRadioMode == RadioModes.AUX || mCurrentRadioMode == RadioModes.CD) {
      changeRadioMode(RadioModes.Radio);
    }
  }
}
Program: 35955
Project: 35955
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  Log.d(TAG,"String_Node_Str");
  unbindServices(true);
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  Log.d(TAG,"String_Node_Str");
  unbindServices();
}
Program: 35956
Project: 35956
Buggy source:
private void unbindServices(boolean doServiceStop){
  Context applicationContext=getActivity();
  if (mIBusBound) {
    try {
      Log.d(TAG,"String_Node_Str");
      mIBusService.disable();
      applicationContext.unbindService(mIBusConnection);
      if (doServiceStop) {
        applicationContext.stopService(new Intent(applicationContext,IBusMessageService.class));
      }
      mIBusBound=false;
    }
 catch (    Exception ex) {
      Log.e(TAG,String.format("String_Node_Str",ex.getMessage()));
    }
  }
  if (mPlayerBound) {
    mPlayerService.disableController();
    try {
      Log.d(TAG,"String_Node_Str");
      applicationContext.unbindService(mPlayerConnection);
      mPlayerBound=false;
    }
 catch (    Exception ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void unbindServices(){
  Context applicationContext=getActivity();
  if (mIBusBound) {
    try {
      Log.d(TAG,"String_Node_Str");
      mIBusService.disable();
      applicationContext.unbindService(mIBusConnection);
      applicationContext.stopService(new Intent(applicationContext,IBusMessageService.class));
      mIBusBound=false;
    }
 catch (    Exception ex) {
      Log.e(TAG,String.format("String_Node_Str",ex.getMessage()));
    }
  }
  if (mPlayerBound) {
    mPlayerService.disableController();
    try {
      Log.d(TAG,"String_Node_Str");
      applicationContext.unbindService(mPlayerConnection);
      mPlayerBound=false;
    }
 catch (    Exception ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
}
Program: 35957
Project: 35957
Buggy source:
@Override public void onPause(){
  super.onPause();
  Log.d(TAG,"String_Node_Str");
  unbindServices(false);
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  Log.d(TAG,"String_Node_Str");
  unbindServices();
}
Program: 35958
Project: 35958
Buggy source:
@Override public void onResume(){
  super.onResume();
  Log.d(TAG,"String_Node_Str");
  bindServices(false);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  Log.d(TAG,"String_Node_Str");
  bindServices();
}
Program: 35959
Project: 35959
Buggy source:
private void bindServices(boolean doServiceStart){
  Context applicationContext=getActivity();
  Intent IBusIntent=new Intent(applicationContext,IBusMessageService.class);
  try {
    Log.d(TAG,"String_Node_Str");
    applicationContext.bindService(IBusIntent,mIBusConnection,Context.BIND_AUTO_CREATE);
    if (doServiceStart) {
      applicationContext.startService(IBusIntent);
    }
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str");
  }
  Intent playerIntent=new Intent(applicationContext,MusicControllerService.class);
  try {
    Log.d(TAG,"String_Node_Str");
    applicationContext.bindService(playerIntent,mPlayerConnection,Context.BIND_AUTO_CREATE);
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void bindServices(){
  Context applicationContext=getActivity();
  Intent IBusIntent=new Intent(applicationContext,IBusMessageService.class);
  try {
    Log.d(TAG,"String_Node_Str");
    applicationContext.bindService(IBusIntent,mIBusConnection,Context.BIND_AUTO_CREATE);
    applicationContext.startService(IBusIntent);
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str");
  }
  Intent playerIntent=new Intent(applicationContext,MusicControllerService.class);
  try {
    Log.d(TAG,"String_Node_Str");
    applicationContext.bindService(playerIntent,mPlayerConnection,Context.BIND_AUTO_CREATE);
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str");
  }
}
Program: 35961
Project: 35961
Buggy source:
/** 
 * Issue a Get request for the "Avg. Speed" Value.
 * @return Byte array of message to send to IBus
 */
public byte[] getAvgSpeed(){
  return IKEGetRequest(0x06,0xF4);
}

Fixed version (ground truth):
/** 
 * Issue a Get request for the "Avg. Speed" Value.
 * @return Byte array of message to send to IBus
 */
public byte[] getAvgSpeed(){
  return IKEGetRequest(0x0A,0xF4);
}
Program: 35962
Project: 35962
Buggy source:
public void setStreetLocation(){
  int lastData=6;
  while (currentMessage.get(lastData) != (byte)0x3B) {
    lastData++;
  }
  if (mCallbackReceiver != null)   mCallbackReceiver.onUpdateStreetLocation(decodeMessage(currentMessage,6,lastData));
}

Fixed version (ground truth):
public void setStreetLocation(){
  int lastData=6;
  while (currentMessage.get(lastData) != (byte)0x3B) {
    lastData++;
  }
  if (mCallbackReceiver != null)   mCallbackReceiver.onUpdateStreetLocation(decodeMessage(currentMessage,6,lastData - 1));
}
Program: 35963
Project: 35963
Buggy source:
public void setLocale(){
  int lastData=6;
  while (currentMessage.get(lastData) != (byte)0x00) {
    lastData++;
  }
  if (mCallbackReceiver != null)   mCallbackReceiver.onUpdateLocale(decodeMessage(currentMessage,6,lastData));
}

Fixed version (ground truth):
public void setLocale(){
  int lastData=6;
  while (currentMessage.get(lastData) != (byte)0x00) {
    lastData++;
  }
  if (mCallbackReceiver != null)   mCallbackReceiver.onUpdateLocale(decodeMessage(currentMessage,6,lastData - 1));
}
Program: 35964
Project: 35964
Buggy source:
private DataWriter writeString(String value){
  writeValueStart();
  if (value == null) {
    if (mode == JSON)     write("String_Node_Str");
 else     if (mode == HTML)     write("String_Node_Str");
  }
 else {
    if (mode == JSON)     write(JSONObject.valueToString(value));
 else     if (mode == XML)     write(StringEscapeUtils.escapeXml(value));
 else     if (mode == HTML)     write(Utils.autoGenerateLink(StringEscapeUtils.escapeHtml(value)));
  }
  writeValueEnd();
  return this;
}

Fixed version (ground truth):
private DataWriter writeString(String value){
  writeValueStart();
  if (value == null) {
    if (mode == JSON)     write("String_Node_Str");
 else     if (mode == HTML)     write("String_Node_Str");
  }
 else {
    if (mode == JSON)     write(JSONObject.valueToString(value));
 else     if (mode == XML)     write(StringEscapeUtils.escapeXml(value));
 else     if (mode == HTML)     write(Utils.autoGenerateLink(StringEscapeUtils.escapeHtml4(value)));
  }
  writeValueEnd();
  return this;
}
Program: 35965
Project: 35965
Buggy source:
public DataWriter key(String keyName){
  writeValueEnd();
  assrt(state().isObject,"String_Node_Str");
  writeValueStart();
  State s=new State();
  s.isKey=true;
  s.key=mode == XML ? keyName.replaceAll("String_Node_Str","String_Node_Str") : keyName;
  states.push(s);
  if (mode == JSON)   write(JSONObject.quote(s.key)).write("String_Node_Str");
 else   if (mode == XML)   write("String_Node_Str").write(s.key).write("String_Node_Str");
 else   if (mode == HTML)   write("String_Node_Str").write(StringEscapeUtils.escapeHtml(s.key)).write("String_Node_Str");
  return this;
}

Fixed version (ground truth):
public DataWriter key(String keyName){
  writeValueEnd();
  assrt(state().isObject,"String_Node_Str");
  writeValueStart();
  State s=new State();
  s.isKey=true;
  s.key=mode == XML ? keyName.replaceAll("String_Node_Str","String_Node_Str") : keyName;
  states.push(s);
  if (mode == JSON)   write(JSONObject.quote(s.key)).write("String_Node_Str");
 else   if (mode == XML)   write("String_Node_Str").write(s.key).write("String_Node_Str");
 else   if (mode == HTML)   write("String_Node_Str").write(StringEscapeUtils.escapeHtml4(s.key)).write("String_Node_Str");
  return this;
}
Program: 35966
Project: 35966
Buggy source:
public static DataService getServiceForEntity(String entityType){
  if (servicesByEntity.containsKey(entityType))   return servicesByEntity.get(entityType);
  IMetaObject meta=Core.getMetaObject(entityType);
  if (meta.getSuperObject() != null) {
    DataService superService=getServiceForEntity(meta.getSuperName());
    if (superService != null) {
      servicesByEntity.put(entityType,superService);
      return superService;
    }
  }
  servicesByEntity.put(entityType,null);
  return null;
}

Fixed version (ground truth):
public static DataService getServiceForEntity(String entityType){
  if (servicesByEntity.containsKey(entityType)) {
    return servicesByEntity.get(entityType);
  }
 else   if (entitiesWithoutService.contains(entityType)) {
    return null;
  }
 else {
    IMetaObject meta=Core.getMetaObject(entityType);
    if (meta.getSuperObject() != null) {
      DataService superService=getServiceForEntity(meta.getSuperName());
      if (superService != null) {
        servicesByEntity.put(entityType,superService);
        return superService;
      }
    }
    entitiesWithoutService.add(entityType);
    return null;
  }
}
Program: 35967
Project: 35967
Buggy source:
public synchronized static void start(IContext context) throws Exception {
  if (instance == null) {
    RestServices.LOGPUBLISH.info("String_Node_Str");
    instance=new RestServiceHandler();
    Core.addRequestHandler(RestServices.PATH_REST,instance);
    started=true;
    loadConfig(context);
    registerServiceHandler(HttpMethod.GET,"String_Node_Str","String_Node_Str",new IRestServiceHandler(){
      @Override public void execute(      RestServiceRequest rsr,      Map<String,String> params) throws Exception {
        ServiceDescriber.serveServiceOverview(rsr);
      }
    }
);
    RestServices.LOGPUBLISH.info("String_Node_Str");
  }
}

Fixed version (ground truth):
public synchronized static void start(IContext context) throws Exception {
  if (instance == null) {
    RestServices.LOGPUBLISH.info("String_Node_Str");
    instance=new RestServiceHandler();
    Core.addRequestHandler(RestServices.PATH_REST,instance);
    started=true;
    loadConfig(context);
    RestServices.LOGPUBLISH.info("String_Node_Str");
  }
}
Program: 35968
Project: 35968
Buggy source:
public static void clearServices(){
  services.clear();
}

Fixed version (ground truth):
public static void clearServices(){
  services.clear();
  registerServiceOverviewHandler();
}
Program: 35970
Project: 35970
Buggy source:
private static RequestEntity buildMultiPartEntity(final IContext context,final IMendixObject source,Map<String,String> params) throws IOException, CoreException {
  List<Part> parts=Lists.newArrayList();
  if (Core.isSubClassOf(FileDocument.entityName,source.getType())) {
    addFilePart(context,getFileDocumentFileName(context,source),source,parts);
  }
  for (  String name : getAssociationsReferingToFileDocs(source.getMetaObject())) {
    IMendixIdentifier subObject=(IMendixIdentifier)source.getValue(context,name);
    params.remove(Utils.getShortMemberName(name));
    if (subObject != null) {
      addFilePart(context,Utils.getShortMemberName(name),Core.retrieveId(context,subObject),parts);
    }
  }
  for (  Entry<String,String> e : params.entrySet()) {
    parts.add(new StringPart(e.getKey(),e.getValue(),RestServices.UTF8));
  }
  params.clear();
  return new MultipartRequestEntity(parts.toArray(new Part[0]),new HttpMethodParams());
}

Fixed version (ground truth):
private static RequestEntity buildMultiPartEntity(final IContext context,final IMendixObject source,Map<String,String> params) throws IOException, CoreException {
  List<Part> parts=Lists.newArrayList();
  if (Core.isSubClassOf(FileDocument.entityName,source.getType())) {
    String partName=getFileDocumentFileName(context,source);
    if (partName == null || partName.isEmpty())     throw new IllegalArgumentException("String_Node_Str");
    addFilePart(context,partName,source,parts);
  }
  for (  String name : getAssociationsReferingToFileDocs(source.getMetaObject())) {
    IMendixIdentifier subObject=(IMendixIdentifier)source.getValue(context,name);
    params.remove(Utils.getShortMemberName(name));
    if (subObject != null) {
      addFilePart(context,Utils.getShortMemberName(name),Core.retrieveId(context,subObject),parts);
    }
  }
  for (  Entry<String,String> e : params.entrySet()) {
    parts.add(new StringPart(e.getKey(),e.getValue(),RestServices.UTF8));
  }
  params.clear();
  return new MultipartRequestEntity(parts.toArray(new Part[0]),new HttpMethodParams());
}
Program: 35972
Project: 35972
Buggy source:
@Test public void testComplexSerialization() throws Exception {
  IContext c=Core.createSystemContext();
  A a=new A(c);
  a.set_id("String_Node_Str");
  a.set_id_jsonkey("String_Node_Str");
  a.setsuper_name("String_Node_Str");
  a.setsuper_name_jsonkey("String_Node_Str");
  B b=new B(c);
  b.setattr("String_Node_Str");
  a.setA_B(b);
  a.setA_B_jsonkey("String_Node_Str");
  JSONObject res=JsonSerializer.writeMendixObjectToJson(c,a.getMendixObject());
  Assert.assertFalse(res.has("String_Node_Str"));
  Assert.assertFalse(res.has("String_Node_Str"));
  Assert.assertEquals("String_Node_Str",res.getString("String_Node_Str"));
  Assert.assertEquals("String_Node_Str",res.getString("String_Node_Str"));
  Assert.assertEquals("String_Node_Str",res.getJSONObject("String_Node_Str").getString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testComplexSerialization() throws Exception {
  final IContext c=Core.createSystemContext();
  Utils.withSessionCache(c,new Function<Boolean>(){
    @Override public Boolean apply() throws Exception {
      A a=new A(c);
      a.set_id("String_Node_Str");
      a.set_id_jsonkey("String_Node_Str");
      a.setsuper_name("String_Node_Str");
      a.setsuper_name_jsonkey("String_Node_Str");
      B b=new B(c);
      b.setattr("String_Node_Str");
      a.setA_B(b);
      a.setA_B_jsonkey("String_Node_Str");
      Assert.assertTrue(a.getA_B() != null);
      Assert.assertTrue(a.getMendixObject().getValue(c,A.MemberNames.A_B.toString()) != null);
      Assert.assertTrue(Core.retrieveId(c,(IMendixIdentifier)a.getMendixObject().getValue(c,A.MemberNames.A_B.toString())) != null);
      JSONObject res=JsonSerializer.writeMendixObjectToJson(c,a.getMendixObject());
      Assert.assertFalse(res.has("String_Node_Str"));
      Assert.assertFalse(res.has("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",res.getString("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",res.getString("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",res.getJSONObject("String_Node_Str").getString("String_Node_Str"));
      return true;
    }
  }
);
}
Program: 35973
Project: 35973
Buggy source:
@Override public Boolean apply() throws Exception {
  A a=new A(c);
  JsonDeserializer.readJsonDataIntoMendixObject(c,data,a.getMendixObject(),false);
  Assert.assertEquals("String_Node_Str",a.get_id());
  Assert.assertEquals("String_Node_Str",a.getsuper_name());
  Assert.assertEquals("String_Node_Str",a.getA_B().getattr());
  Assert.assertEquals(2,a.get_A_Bs().size());
  Assert.assertEquals("String_Node_Str",a.get_A_Bs().get(0).getattr());
  Assert.assertEquals("String_Node_Str",a.get_A_Bs().get(1).getattr());
  return true;
}

Fixed version (ground truth):
@Override public Boolean apply() throws Exception {
  String KEY="String_Node_Str";
  StringArrayTest t=new StringArrayTest(c);
  Primitive string1=new Primitive(c);
  string1.setStringValue("String_Node_Str");
  string1.setPrimitiveType(RestPrimitiveType.String);
  Primitive bool1=new Primitive(c);
  bool1.setBooleanValue(true);
  bool1.setPrimitiveType(RestPrimitiveType._Boolean);
  Primitive nullP=new Primitive(c);
  nullP.setPrimitiveType(RestPrimitiveType._NULL);
  Primitive num1=new Primitive(c);
  num1.setPrimitiveType(RestPrimitiveType.Number);
  num1.setNumberValue(4.7);
  JSONObject res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertTrue(res.has(KEY));
  Assert.assertTrue(res.isNull(KEY));
  t.setdynamicallyTypedItem(nullP);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertTrue(res.isNull(KEY));
  t.setdynamicallyTypedItem(string1);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertEquals("String_Node_Str",res.get(KEY));
  t.setdynamicallyTypedItem(num1);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertEquals(4.7,res.get(KEY));
  t.setdynamicallyTypedItem(bool1);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertEquals(true,res.get(KEY));
  return true;
}
Program: 35974
Project: 35974
Buggy source:
@Test public void testStringArraySerialization() throws Exception {
  IContext c=Core.createSystemContext();
  StringArrayTest t=new StringArrayTest(c);
  Primitive string1=new Primitive(c);
  string1.setStringValue("String_Node_Str");
  string1.setPrimitiveType(RestPrimitiveType.String);
  Primitive string2=new Primitive(c);
  string2.setStringValue("String_Node_Str");
  string2.setPrimitiveType(RestPrimitiveType.String);
  Primitive nullP=new Primitive(c);
  nullP.setPrimitiveType(RestPrimitiveType._NULL);
  JSONObject res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertTrue(res.has("String_Node_Str"));
  Assert.assertTrue(res.isJSONArray("String_Node_Str"));
  Assert.assertEquals(0,res.getJSONArray("String_Node_Str").length());
  List<Primitive> l=t.getitems();
  l.add(string1);
  l.add(string2);
  l.add(nullP);
  t.setitems(l);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertTrue(res.has("String_Node_Str"));
  Assert.assertTrue(res.isJSONArray("String_Node_Str"));
  Assert.assertEquals(3,res.getJSONArray("String_Node_Str").length());
  Assert.assertEquals("String_Node_Str",res.getJSONArray("String_Node_Str").getString(0));
  Assert.assertEquals("String_Node_Str",res.getJSONArray("String_Node_Str").getString(1));
  Assert.assertTrue(res.getJSONArray("String_Node_Str").isNull(2));
}

Fixed version (ground truth):
@Test public void testStringArraySerialization() throws Exception {
  final IContext c=Core.createSystemContext();
  Utils.withSessionCache(c,new Function<Boolean>(){
    @Override public Boolean apply() throws Exception {
      StringArrayTest t=new StringArrayTest(c);
      Primitive string1=new Primitive(c);
      string1.setStringValue("String_Node_Str");
      string1.setPrimitiveType(RestPrimitiveType.String);
      Primitive string2=new Primitive(c);
      string2.setStringValue("String_Node_Str");
      string2.setPrimitiveType(RestPrimitiveType.String);
      Primitive nullP=new Primitive(c);
      nullP.setPrimitiveType(RestPrimitiveType._NULL);
      JSONObject res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
      Assert.assertTrue(res.has("String_Node_Str"));
      Assert.assertTrue(res.isJSONArray("String_Node_Str"));
      Assert.assertEquals(0,res.getJSONArray("String_Node_Str").length());
      List<Primitive> l=t.getitems();
      l.add(string1);
      l.add(string2);
      l.add(nullP);
      t.setitems(l);
      res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
      Assert.assertTrue(res.has("String_Node_Str"));
      Assert.assertTrue(res.isJSONArray("String_Node_Str"));
      Assert.assertEquals(3,res.getJSONArray("String_Node_Str").length());
      Assert.assertEquals("String_Node_Str",res.getJSONArray("String_Node_Str").getString(0));
      Assert.assertEquals("String_Node_Str",res.getJSONArray("String_Node_Str").getString(1));
      Assert.assertTrue(res.getJSONArray("String_Node_Str").isNull(2));
      return true;
    }
  }
);
}
Program: 35975
Project: 35975
Buggy source:
@Test public void testDynamicPrimitiveSerialization() throws Exception {
  IContext c=Core.createSystemContext();
  String KEY="String_Node_Str";
  StringArrayTest t=new StringArrayTest(c);
  Primitive string1=new Primitive(c);
  string1.setStringValue("String_Node_Str");
  string1.setPrimitiveType(RestPrimitiveType.String);
  Primitive bool1=new Primitive(c);
  bool1.setBooleanValue(true);
  bool1.setPrimitiveType(RestPrimitiveType._Boolean);
  Primitive nullP=new Primitive(c);
  nullP.setPrimitiveType(RestPrimitiveType._NULL);
  Primitive num1=new Primitive(c);
  num1.setPrimitiveType(RestPrimitiveType.Number);
  num1.setNumberValue(4.7);
  JSONObject res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertTrue(res.has(KEY));
  Assert.assertTrue(res.isNull(KEY));
  t.setdynamicallyTypedItem(nullP);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertTrue(res.isNull(KEY));
  t.setdynamicallyTypedItem(string1);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertEquals("String_Node_Str",res.get(KEY));
  t.setdynamicallyTypedItem(num1);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertEquals(4.7,res.get(KEY));
  t.setdynamicallyTypedItem(bool1);
  res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
  Assert.assertEquals(true,res.get(KEY));
}

Fixed version (ground truth):
@Test public void testDynamicPrimitiveSerialization() throws Exception {
  final IContext c=Core.createSystemContext();
  Utils.withSessionCache(c,new Function<Boolean>(){
    @Override public Boolean apply() throws Exception {
      String KEY="String_Node_Str";
      StringArrayTest t=new StringArrayTest(c);
      Primitive string1=new Primitive(c);
      string1.setStringValue("String_Node_Str");
      string1.setPrimitiveType(RestPrimitiveType.String);
      Primitive bool1=new Primitive(c);
      bool1.setBooleanValue(true);
      bool1.setPrimitiveType(RestPrimitiveType._Boolean);
      Primitive nullP=new Primitive(c);
      nullP.setPrimitiveType(RestPrimitiveType._NULL);
      Primitive num1=new Primitive(c);
      num1.setPrimitiveType(RestPrimitiveType.Number);
      num1.setNumberValue(4.7);
      JSONObject res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
      Assert.assertTrue(res.has(KEY));
      Assert.assertTrue(res.isNull(KEY));
      t.setdynamicallyTypedItem(nullP);
      res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
      Assert.assertTrue(res.isNull(KEY));
      t.setdynamicallyTypedItem(string1);
      res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
      Assert.assertEquals("String_Node_Str",res.get(KEY));
      t.setdynamicallyTypedItem(num1);
      res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
      Assert.assertEquals(4.7,res.get(KEY));
      t.setdynamicallyTypedItem(bool1);
      res=JsonSerializer.writeMendixObjectToJson(c,t.getMendixObject());
      Assert.assertEquals(true,res.get(KEY));
      return true;
    }
  }
);
}
Program: 35978
Project: 35978
Buggy source:
public void serveDescription(RestServiceRequest rsr){
  rsr.startDoc();
  if (rsr.getResponseContentType() == ResponseType.HTML)   rsr.write("String_Node_Str").write(getName()).write("String_Node_Str");
  rsr.datawriter.object().key("String_Node_Str").value(getName()).key("String_Node_Str").value(description).key("String_Node_Str").value(RestServices.getServiceUrl(getName())).key("String_Node_Str").value(JSONSchemaBuilder.build(Utils.getFirstArgumentType(microflowname))).key("String_Node_Str").value(isFileSource).key("String_Node_Str").value(isFileTarget ? RestServices.CONTENTTYPE_OCTET + "String_Node_Str" : JSONSchemaBuilder.build(Core.getReturnType(microflowname))).endObject();
  rsr.endDoc();
}

Fixed version (ground truth):
public void serveDescription(RestServiceRequest rsr){
  rsr.startDoc();
  if (rsr.getResponseContentType() == ResponseType.HTML)   rsr.write("String_Node_Str").write(getName()).write("String_Node_Str");
  rsr.datawriter.object().key("String_Node_Str").value(getName()).key("String_Node_Str").value(description).key("String_Node_Str").value(RestServices.getServiceUrl(getName())).key("String_Node_Str").value(hasArgument ? JSONSchemaBuilder.build(Utils.getFirstArgumentType(microflowname)) : null).key("String_Node_Str").value(isFileSource).key("String_Node_Str").value(isFileTarget ? RestServices.CONTENTTYPE_OCTET + "String_Node_Str" : JSONSchemaBuilder.build(Core.getReturnType(microflowname))).endObject();
  rsr.endDoc();
}