nus-yam/ex-repair huggingface dataset:
Program: 142362
Project: 142362
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (advanced) {
    menu.removeItem(MODE_ADVANCED);
  }
 else {
    menu.removeItem(MODE_BASIC);
    menu.add(0,MODE_ADVANCED,0,"String_Node_Str").setIcon(android.R.drawable.ic_menu_edit);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (advanced) {
    if (!basicOn) {
      menu.removeItem(MODE_ADVANCED);
      menu.add(0,MODE_BASIC,0,"String_Node_Str").setIcon(android.R.drawable.ic_menu_help);
      advancedOn=false;
      basicOn=true;
    }
  }
 else   if (!advancedOn) {
    menu.removeItem(MODE_BASIC);
    menu.add(0,MODE_ADVANCED,0,"String_Node_Str").setIcon(android.R.drawable.ic_menu_edit);
    advancedOn=true;
    basicOn=false;
  }
  return true;
}
Program: 142363
Project: 142363
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!upgradeMode) {
switch (item.getItemId()) {
case MODE_BASIC:
      advanced=false;
    advancedView.setVisibility(View.INVISIBLE);
  return true;
case MODE_ADVANCED:
advanced=true;
advancedView.setVisibility(View.VISIBLE);
mScanBarcodeButton.setVisibility(View.GONE);
installButton.setVisibility(View.VISIBLE);
installButton.setEnabled(true);
return true;
}
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!upgradeMode) {
switch (item.getItemId()) {
case MODE_BASIC:
      advanced=false;
    advancedView.setVisibility(View.INVISIBLE);
  mScanBarcodeButton.setVisibility(View.VISIBLE);
return true;
case MODE_ADVANCED:
advanced=true;
advancedView.setVisibility(View.VISIBLE);
mScanBarcodeButton.setVisibility(View.INVISIBLE);
installButton.setVisibility(View.VISIBLE);
installButton.setEnabled(true);
return true;
}
}
return super.onOptionsItemSelected(item);
}
Program: 142364
Project: 142364
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (advanced) {
    if (!basicOn) {
      menu.removeItem(MODE_ADVANCED);
      menu.add(0,MODE_BASIC,0,"String_Node_Str").setIcon(android.R.drawable.ic_menu_help);
      advancedOn=false;
      basicOn=true;
    }
  }
 else   if (!advancedOn) {
    menu.removeItem(MODE_BASIC);
    menu.add(0,MODE_ADVANCED,0,"String_Node_Str").setIcon(android.R.drawable.ic_menu_edit);
    advancedOn=true;
    basicOn=false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  manageIcons(menu,advanced);
  return true;
}
Program: 142365
Project: 142365
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (requestCode == BARCODE_CAPTURE) {
    if (resultCode == Activity.RESULT_CANCELED) {
    }
 else     if (resultCode == Activity.RESULT_OK) {
      String result=data.getStringExtra("String_Node_Str");
      editProfileRef.setText(result);
      incomingRef=result;
      this.installButton.setVisibility(View.VISIBLE);
      mainMessage.setText("String_Node_Str");
      mScanBarcodeButton.setVisibility(View.GONE);
    }
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (requestCode == BARCODE_CAPTURE) {
    if (resultCode == Activity.RESULT_CANCELED) {
    }
 else     if (resultCode == Activity.RESULT_OK) {
      String result=data.getStringExtra("String_Node_Str");
      editProfileRef.setText(result);
      incomingRef=result;
      urlSet=true;
      this.installButton.setVisibility(View.VISIBLE);
      mainMessage.setText("String_Node_Str");
      mScanBarcodeButton.setVisibility(View.GONE);
    }
  }
}
Program: 142366
Project: 142366
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!upgradeMode) {
switch (item.getItemId()) {
case MODE_BASIC:
      advanced=false;
    advancedView.setVisibility(View.INVISIBLE);
  mScanBarcodeButton.setVisibility(View.VISIBLE);
return true;
case MODE_ADVANCED:
advanced=true;
advancedView.setVisibility(View.VISIBLE);
mScanBarcodeButton.setVisibility(View.INVISIBLE);
installButton.setVisibility(View.VISIBLE);
installButton.setEnabled(true);
return true;
}
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!upgradeMode) {
switch (item.getItemId()) {
case MODE_BASIC:
      setModeToBasic();
    return true;
case MODE_ADVANCED:
  setModeToAdvanced();
return true;
}
}
return super.onOptionsItemSelected(item);
}
Program: 142367
Project: 142367
Buggy source:
public void loadFromStateDescription(SessionStateDescriptor descriptor){
  this.sessionStateRecordId=descriptor.getID();
  this.formRecordId=descriptor.getFormRecordId();
  descriptor.loadSession(this.session);
}

Fixed version (ground truth):
public void loadFromStateDescription(SessionStateDescriptor descriptor){
  this.reset();
  this.sessionStateRecordId=descriptor.getID();
  this.formRecordId=descriptor.getFormRecordId();
  descriptor.loadSession(this.session);
}
Program: 142369
Project: 142369
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.entity_select_layout);
  searchbox=(EditText)findViewById(R.id.searchbox);
  header=(LinearLayout)findViewById(R.id.entity_select_header);
  barcodeButton=(ImageButton)findViewById(R.id.barcodeButton);
  searchbox.addTextChangedListener(this);
  searchbox.requestFocus();
  session=CommCareApplication._().getCurrentSession();
  Vector<Entry> entries=session.getEntriesForCommand(session.getCommand());
  prototype=entries.elementAt(0);
  setTitle(getString(R.string.app_name) + "String_Node_Str" + "String_Node_Str");
  selectDatum=session.getNeededDatum();
  barcodeButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Intent i=new Intent("String_Node_Str");
      try {
        startActivityForResult(i,BARCODE_FETCH);
      }
 catch (      ActivityNotFoundException anfe) {
        Toast noReader=Toast.makeText(EntitySelectActivity.this,"String_Node_Str",Toast.LENGTH_LONG);
        noReader.show();
      }
    }
  }
);
  if (selectDatum.getLongDetail() != null && this.getIntent().hasExtra(EXTRA_ENTITY_KEY)) {
    TreeReference entity=getEntityFromID(this.getIntent().getStringExtra(EXTRA_ENTITY_KEY));
    Intent i=getDetailIntent(entity);
    startActivityForResult(i,CONFIRM_SELECT);
  }
 else {
    refreshView();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.entity_select_layout);
  searchbox=(EditText)findViewById(R.id.searchbox);
  header=(LinearLayout)findViewById(R.id.entity_select_header);
  barcodeButton=(ImageButton)findViewById(R.id.barcodeButton);
  searchbox.addTextChangedListener(this);
  searchbox.requestFocus();
  session=CommCareApplication._().getCurrentSession();
  Vector<Entry> entries=session.getEntriesForCommand(session.getCommand());
  prototype=entries.elementAt(0);
  setTitle(getString(R.string.app_name) + "String_Node_Str" + "String_Node_Str");
  selectDatum=session.getNeededDatum();
  barcodeButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Intent i=new Intent("String_Node_Str");
      try {
        startActivityForResult(i,BARCODE_FETCH);
      }
 catch (      ActivityNotFoundException anfe) {
        Toast noReader=Toast.makeText(EntitySelectActivity.this,"String_Node_Str",Toast.LENGTH_LONG);
        noReader.show();
      }
    }
  }
);
  if (selectDatum.getLongDetail() != null && this.getIntent().hasExtra(EXTRA_ENTITY_KEY)) {
    TreeReference entity=getEntityFromID(this.getIntent().getStringExtra(EXTRA_ENTITY_KEY));
    if (entity != null) {
      Intent i=getDetailIntent(entity);
      startActivityForResult(i,CONFIRM_SELECT);
    }
 else {
      refreshView();
    }
  }
 else {
    refreshView();
  }
}
Program: 142370
Project: 142370
Buggy source:
public DeviceReport(CommCareApplication application){
  this.mContext=application;
  TelephonyManager mTelephonyManager=(TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
  String did=mTelephonyManager.getDeviceId();
  document=new Document();
  reportNode=document.createElement(XMLNS,"String_Node_Str");
  document.addChild(Element.ELEMENT,reportNode);
  Element deviceId=reportNode.createElement(null,"String_Node_Str");
  deviceId.addChild(Element.TEXT,did);
  reportNode.addChild(Element.ELEMENT,deviceId);
  Element appVersion=reportNode.createElement(null,"String_Node_Str");
  appVersion.addChild(Element.TEXT,application.getCurrentVersionString());
  reportNode.addChild(Element.ELEMENT,appVersion);
  Element reportDate=reportNode.createElement(null,"String_Node_Str");
  reportDate.addChild(Element.TEXT,DateUtils.formatDate(new Date(),DateUtils.FORMAT_ISO8601));
  reportNode.addChild(Element.ELEMENT,reportDate);
}

Fixed version (ground truth):
public DeviceReport(CommCareApplication application){
  this.mContext=application;
  String did=application.getPhoneId();
  document=new Document();
  reportNode=document.createElement(XMLNS,"String_Node_Str");
  document.addChild(Element.ELEMENT,reportNode);
  Element deviceId=reportNode.createElement(null,"String_Node_Str");
  deviceId.addChild(Element.TEXT,did);
  reportNode.addChild(Element.ELEMENT,deviceId);
  Element appVersion=reportNode.createElement(null,"String_Node_Str");
  appVersion.addChild(Element.TEXT,application.getCurrentVersionString());
  reportNode.addChild(Element.ELEMENT,appVersion);
  Element reportDate=reportNode.createElement(null,"String_Node_Str");
  reportDate.addChild(Element.TEXT,DateUtils.formatDate(new Date(),DateUtils.FORMAT_ISO8601));
  reportNode.addChild(Element.ELEMENT,reportDate);
}
Program: 142371
Project: 142371
Buggy source:
private void startFormEntry(AndroidSessionWrapper state) throws SessionUnavailableException {
  try {
    if (state.getFormRecordId() == -1) {
      SessionStateDescriptor existing=state.searchForDuplicates();
      if (existing != null) {
        createAskUseOldDialog(state,existing);
        return;
      }
      state.commitStub();
    }
 else {
      Logger.log("String_Node_Str","String_Node_Str");
    }
    FormRecord record=state.getFormRecord();
    formEntry(platform.getFormContentUri(record.getFormNamespace()),record);
  }
 catch (  StorageFullException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private void startFormEntry(AndroidSessionWrapper state) throws SessionUnavailableException {
  try {
    if (state.getFormRecordId() == -1) {
      SessionStateDescriptor existing=state.searchForDuplicates();
      if (existing != null && existing.getSessionDescriptor().contains(CommCareSession.STATE_DATUM_VAL)) {
        createAskUseOldDialog(state,existing);
        return;
      }
      state.commitStub();
    }
 else {
      Logger.log("String_Node_Str","String_Node_Str");
    }
    FormRecord record=state.getFormRecord();
    formEntry(platform.getFormContentUri(record.getFormNamespace()),record);
  }
 catch (  StorageFullException e) {
    throw new RuntimeException(e);
  }
}
Program: 142372
Project: 142372
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  try {
    setContentView(R.layout.entity_detail);
    next=(Button)findViewById(R.id.entity_select_button);
    next.setOnClickListener(new OnClickListener(){
      public void onClick(      View v){
        Intent i=new Intent(EntityDetailActivity.this.getIntent());
        loadOutgoingIntent(i);
        setResult(RESULT_OK,i);
        finish();
      }
    }
);
    if (getIntent().getBooleanExtra(IS_DEAD_END,false)) {
      next.setText("String_Node_Str");
    }
    String passedCommand=getIntent().getStringExtra(CommCareSession.STATE_COMMAND_ID);
    Vector<Entry> entries=session.getEntriesForCommand(passedCommand == null ? session.getCommand() : passedCommand);
    prototype=entries.elementAt(0);
    factory=new NodeEntityFactory(session.getDetail(getIntent().getStringExtra(EntityDetailActivity.DETAIL_ID)),session.getEvaluationContext(new CommCareInstanceInitializer(session)));
    entity=factory.getEntity(CommCareApplication._().deserializeFromIntent(getIntent(),EntityDetailActivity.CONTEXT_REFERENCE,TreeReference.class));
    setTitle(getString(R.string.app_name) + "String_Node_Str" + "String_Node_Str");
    refreshView();
  }
 catch (  SessionUnavailableException sue) {
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  try {
    setContentView(R.layout.entity_detail);
    next=(Button)findViewById(R.id.entity_select_button);
    next.setOnClickListener(new OnClickListener(){
      public void onClick(      View v){
        Intent i=new Intent(EntityDetailActivity.this.getIntent());
        loadOutgoingIntent(i);
        setResult(RESULT_OK,i);
        finish();
      }
    }
);
    if (getIntent().getBooleanExtra(IS_DEAD_END,false)) {
      next.setText("String_Node_Str");
    }
    session=CommCareApplication._().getCurrentSession();
    String passedCommand=getIntent().getStringExtra(CommCareSession.STATE_COMMAND_ID);
    Vector<Entry> entries=session.getEntriesForCommand(passedCommand == null ? session.getCommand() : passedCommand);
    prototype=entries.elementAt(0);
    factory=new NodeEntityFactory(session.getDetail(getIntent().getStringExtra(EntityDetailActivity.DETAIL_ID)),session.getEvaluationContext(new CommCareInstanceInitializer(session)));
    entity=factory.getEntity(CommCareApplication._().deserializeFromIntent(getIntent(),EntityDetailActivity.CONTEXT_REFERENCE,TreeReference.class));
    setTitle(getString(R.string.app_name) + "String_Node_Str" + "String_Node_Str");
    refreshView();
  }
 catch (  SessionUnavailableException sue) {
  }
}
Program: 142373
Project: 142373
Buggy source:
public String createSessionDescriptor(CommCareSession session){
  String descriptor="String_Node_Str";
  for (  String[] step : session.getSteps()) {
    descriptor+=step[0] + "String_Node_Str";
    if (step[0] == CommCareSession.STATE_COMMAND_ID) {
      descriptor+=step[1] + "String_Node_Str";
    }
 else     if (step[0] == CommCareSession.STATE_DATUM_VAL || step[0] == CommCareSession.STATE_DATUM_COMPUTED) {
      descriptor+=step[1] + "String_Node_Str" + step[2]+ "String_Node_Str";
    }
  }
  return descriptor.trim();
}

Fixed version (ground truth):
private String createSessionDescriptor(CommCareSession session){
  String descriptor="String_Node_Str";
  for (  String[] step : session.getSteps()) {
    descriptor+=step[0] + "String_Node_Str";
    if (step[0] == CommCareSession.STATE_COMMAND_ID) {
      descriptor+=step[1] + "String_Node_Str";
    }
 else     if (step[0] == CommCareSession.STATE_DATUM_VAL || step[0] == CommCareSession.STATE_DATUM_COMPUTED) {
      descriptor+=step[1] + "String_Node_Str" + step[2]+ "String_Node_Str";
    }
  }
  return descriptor.trim();
}
Program: 142375
Project: 142375
Buggy source:
private boolean tryLocalLogin(){
  try {
    String passwd=password.getText().toString();
    for (    User u : storage()) {
      String hash=u.getPassword();
      if (hash.contains("String_Node_Str")) {
        String alg="String_Node_Str";
        String salt=hash.split("String_Node_Str")[1];
        String check=hash.split("String_Node_Str")[2];
        MessageDigest md=MessageDigest.getInstance("String_Node_Str");
        BigInteger number=new BigInteger(1,md.digest((salt + passwd).getBytes()));
        String hashed=number.toString(16);
        while (hashed.length() < check.length()) {
          hashed="String_Node_Str" + hashed;
        }
        if (hash.equals(alg + "String_Node_Str" + salt+ "String_Node_Str"+ hashed)) {
          byte[] key=CryptUtil.unWrapKey(u.getWrappedKey(),passwd);
          u.setCachedPwd(passwd);
          logIn(u,key);
          return true;
        }
      }
 else {
        if (u.getPassword().equals(passwd)) {
          byte[] key=CryptUtil.unWrapKey(u.getWrappedKey(),passwd);
          u.setCachedPwd(passwd);
          logIn(u,key);
          return true;
        }
      }
    }
    return false;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
private boolean tryLocalLogin(){
  try {
    String passwd=password.getText().toString();
    for (    User u : storage()) {
      if (!u.getUsername().equals(getUsername())) {
        continue;
      }
      String hash=u.getPassword();
      if (hash.contains("String_Node_Str")) {
        String alg="String_Node_Str";
        String salt=hash.split("String_Node_Str")[1];
        String check=hash.split("String_Node_Str")[2];
        MessageDigest md=MessageDigest.getInstance("String_Node_Str");
        BigInteger number=new BigInteger(1,md.digest((salt + passwd).getBytes()));
        String hashed=number.toString(16);
        while (hashed.length() < check.length()) {
          hashed="String_Node_Str" + hashed;
        }
        if (hash.equals(alg + "String_Node_Str" + salt+ "String_Node_Str"+ hashed)) {
          byte[] key=CryptUtil.unWrapKey(u.getWrappedKey(),passwd);
          u.setCachedPwd(passwd);
          logIn(u,key);
          return true;
        }
      }
 else {
        if (u.getPassword().equals(passwd)) {
          byte[] key=CryptUtil.unWrapKey(u.getWrappedKey(),passwd);
          u.setCachedPwd(passwd);
          logIn(u,key);
          return true;
        }
      }
    }
    return false;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}
Program: 142376
Project: 142376
Buggy source:
void doBindService(final byte[] key,final User user){
  mConnection=new ServiceConnection(){
    public void onServiceConnected(    ComponentName className,    IBinder service){
      mBoundService=((CommCareSessionService.LocalBinder)service).getService();
      mBoundService.logIn(key,user);
      if (database != null && database.isOpen()) {
        database.close();
      }
      CursorFactory factory=new CommCareDBCursorFactory(CommCareApplication.this.encryptedModels()){
        protected Cipher getReadCipher(){
          return mBoundService.getDecrypter();
        }
      }
;
      database=new CommCareOpenHelper(CommCareApplication.this,factory).getWritableDatabase();
      if (user != null) {
        attachCallListener(user);
      }
    }
    public void onServiceDisconnected(    ComponentName className){
      mBoundService=null;
    }
  }
;
  bindService(new Intent(this,CommCareSessionService.class),mConnection,Context.BIND_AUTO_CREATE);
  mIsBound=true;
}

Fixed version (ground truth):
void doBindService(final byte[] key,final User user){
  mConnection=new ServiceConnection(){
    public void onServiceConnected(    ComponentName className,    IBinder service){
      mBoundService=((CommCareSessionService.LocalBinder)service).getService();
synchronized (mBoundService) {
        mBoundService.logIn(key,user);
      }
      mIsBound=true;
      mIsBinding=false;
      if (database != null && database.isOpen()) {
        database.close();
      }
      CursorFactory factory=new CommCareDBCursorFactory(CommCareApplication.this.encryptedModels()){
        protected Cipher getReadCipher(){
          return mBoundService.getDecrypter();
        }
      }
;
      database=new CommCareOpenHelper(CommCareApplication.this,factory).getWritableDatabase();
      if (user != null) {
        attachCallListener(user);
      }
    }
    public void onServiceDisconnected(    ComponentName className){
      mBoundService=null;
    }
  }
;
  bindService(new Intent(this,CommCareSessionService.class),mConnection,Context.BIND_AUTO_CREATE);
  mIsBinding=true;
}
Program: 142377
Project: 142377
Buggy source:
public SecretKey createNewSymetricKey(){
  return mBoundService.createNewSymetricKey();
}

Fixed version (ground truth):
public SecretKey createNewSymetricKey(){
synchronized (mBoundService) {
    return mBoundService.createNewSymetricKey();
  }
}
Program: 142378
Project: 142378
Buggy source:
public void onServiceConnected(ComponentName className,IBinder service){
  mBoundService=((CommCareSessionService.LocalBinder)service).getService();
  mBoundService.logIn(key,user);
  if (database != null && database.isOpen()) {
    database.close();
  }
  CursorFactory factory=new CommCareDBCursorFactory(CommCareApplication.this.encryptedModels()){
    protected Cipher getReadCipher(){
      return mBoundService.getDecrypter();
    }
  }
;
  database=new CommCareOpenHelper(CommCareApplication.this,factory).getWritableDatabase();
  if (user != null) {
    attachCallListener(user);
  }
}

Fixed version (ground truth):
public void onServiceConnected(ComponentName className,IBinder service){
  mBoundService=((CommCareSessionService.LocalBinder)service).getService();
synchronized (mBoundService) {
    mBoundService.logIn(key,user);
  }
  mIsBound=true;
  mIsBinding=false;
  if (database != null && database.isOpen()) {
    database.close();
  }
  CursorFactory factory=new CommCareDBCursorFactory(CommCareApplication.this.encryptedModels()){
    protected Cipher getReadCipher(){
      return mBoundService.getDecrypter();
    }
  }
;
  database=new CommCareOpenHelper(CommCareApplication.this,factory).getWritableDatabase();
  if (user != null) {
    attachCallListener(user);
  }
}
Program: 142379
Project: 142379
Buggy source:
public CommCareSessionService getSession() throws SessionUnavailableException {
  if (mIsBound) {
    return mBoundService;
  }
 else {
    throw new SessionUnavailableException();
  }
}

Fixed version (ground truth):
public CommCareSessionService getSession() throws SessionUnavailableException {
  while (mIsBinding)   ;
  if (mIsBound) {
synchronized (mBoundService) {
      return mBoundService;
    }
  }
 else {
    throw new SessionUnavailableException();
  }
}
Program: 142383
Project: 142383
Buggy source:
public static Screen load(String screenClassName){
  screenClassName="String_Node_Str" + screenClassName;
  Screen newScreen=null;
  if (!screens.containsKey(screenClassName)) {
    try {
      Class<?> screenClass=Class.forName(screenClassName);
      Constructor<?> constructor=screenClass.getConstructor(Game.class);
      newScreen=(Screen)constructor.newInstance(game);
      screens.put(screenClassName,newScreen);
    }
 catch (    InvocationTargetException ex) {
      System.err.println(ex + "String_Node_Str");
    }
catch (    NoSuchMethodException ex) {
    }
catch (    ClassNotFoundException ex) {
      System.err.println(ex + "String_Node_Str");
    }
catch (    InstantiationException ex) {
      System.err.println(ex + "String_Node_Str");
    }
catch (    IllegalAccessException ex) {
      System.err.println(ex + "String_Node_Str");
    }
  }
 else {
    newScreen=screens.get(screenClassName);
  }
  if (currentScreen != null) {
    currentScreen.dispose();
  }
  currentScreen=newScreen;
  return currentScreen;
}

Fixed version (ground truth):
public static Screen load(String screenClassName){
  screenClassName="String_Node_Str" + screenClassName;
  Screen newScreen=null;
  if (!screens.containsKey(screenClassName)) {
    try {
      Class<?> screenClass=Class.forName(screenClassName);
      Constructor<?> constructor=screenClass.getConstructor(Game.class);
      newScreen=(Screen)constructor.newInstance(game);
      screens.put(screenClassName,newScreen);
    }
 catch (    InvocationTargetException ex) {
      System.err.println(ex.getMessage() + "String_Node_Str");
    }
catch (    NoSuchMethodException ex) {
    }
catch (    ClassNotFoundException ex) {
      System.err.println(ex + "String_Node_Str");
    }
catch (    InstantiationException ex) {
      System.err.println(ex + "String_Node_Str");
    }
catch (    IllegalAccessException ex) {
      System.err.println(ex + "String_Node_Str");
    }
  }
 else {
    newScreen=screens.get(screenClassName);
  }
  if (currentScreen != null) {
    currentScreen.dispose();
  }
  currentScreen=newScreen;
  return currentScreen;
}
Program: 142385
Project: 142385
Buggy source:
@Override public Map loadMap(String map){
  Reader<Map> reader=new Reader<Map>();
  MapLoader loader=new MapLoader();
  return reader.read(Game.GAME_MAPS_PATH + map + "String_Node_Str",loader);
}

Fixed version (ground truth):
@Override public Map loadMap(String map){
  Reader<Map> reader=new Reader<Map>();
  MapLoader loader=new MapLoader();
  return reader.read(Game.GAME_MAPS_PATH + "String_Node_Str" + map+ "String_Node_Str",loader);
}
Program: 142386
Project: 142386
Buggy source:
@Override public void place(){
  float offsetCounterX=0.0f, offsetCounterY=0.0f;
  if (this.mNextX != 0) {
    offsetCounterX=this.mNextX * this.mSpeed * this.mDeltaTime;
    this.mX+=offsetCounterX;
    if (this.mNextX == 1) {
      if (this.mX >= (this.mUserPosX) * TILE_PIXEL_WIDTH) {
        this.updateUserPos();
        this.mMoving=false;
        this.mNextX=0;
      }
    }
 else     if (this.mNextX == -1) {
      if (this.mX <= (this.mUserPosX) * TILE_PIXEL_WIDTH) {
        this.updateUserPos();
        this.mMoving=false;
        this.mNextX=0;
      }
    }
  }
  if (this.mNextY != 0) {
    offsetCounterY=this.mNextY * this.mSpeed * this.mDeltaTime;
    this.mY+=offsetCounterY;
    if (this.mNextY == 1) {
      if (this.mY >= (this.mUserPosY) * TILE_PIXEL_HEIGHT) {
        this.updateUserPos();
        this.mMoving=false;
        this.mNextY=0;
      }
    }
 else     if (this.mNextY == -1) {
      if (this.mY <= (this.mUserPosY) * TILE_PIXEL_HEIGHT) {
        this.updateUserPos();
        this.mMoving=false;
        this.mNextY=0;
      }
    }
  }
  this.updateLight(this.mX,this.mY);
}

Fixed version (ground truth):
@Override public void place(){
  float offsetCounterX=0.0f, offsetCounterY=0.0f;
  offsetCounterX=this.mNextX * this.mSpeed * this.mDeltaTime;
  this.mX+=offsetCounterX;
  offsetCounterY=this.mNextY * this.mSpeed * this.mDeltaTime;
  this.mY+=offsetCounterY;
  if (this.mNextX == 1) {
    if (this.mX >= (this.mUserPosX) * TILE_PIXEL_WIDTH) {
      this.updateUserPos();
      this.mMoving=false;
      this.mNextX=0;
    }
  }
 else   if (this.mNextX == -1) {
    if (this.mX <= (this.mUserPosX) * TILE_PIXEL_WIDTH) {
      this.updateUserPos();
      this.mMoving=false;
      this.mNextX=0;
    }
  }
  if (this.mNextY == 1) {
    if (this.mY >= (this.mUserPosY) * TILE_PIXEL_HEIGHT) {
      this.updateUserPos();
      this.mMoving=false;
      this.mNextY=0;
    }
  }
 else   if (this.mNextY == -1) {
    if (this.mY <= (this.mUserPosY) * TILE_PIXEL_HEIGHT) {
      this.updateUserPos();
      this.mMoving=false;
      this.mNextY=0;
    }
  }
  this.updateLight(this.mX,this.mY);
}
Program: 142387
Project: 142387
Buggy source:
public void initEngine(){
  this.mWorld=new World(new Vector2(),true);
  this.mDebugRenderer=new Box2DDebugRenderer();
  this.mDebugRenderer.setDrawBodies(false);
  RayHandler.setGammaCorrection(true);
  RayHandler.useDiffuseLight(true);
  this.mRayHandler=new RayHandler(this.mWorld);
  this.mRayHandler.setCulling(true);
  this.mRayHandler.setBlurNum(5);
  this.setLightHandler(new LightHandler(this.mGame));
}

Fixed version (ground truth):
public void initEngine(){
  this.mWorld=new World(new Vector2(),true);
  this.mDebugRenderer=new Box2DDebugRenderer();
  this.mDebugRenderer.setDrawBodies(false);
  RayHandler.setGammaCorrection(true);
  RayHandler.useDiffuseLight(true);
  this.mRayHandler=new RayHandler(this.mWorld);
  this.mRayHandler.setCulling(true);
  this.mRayHandler.setBlurNum(5);
  this.mLightHandler=new LightHandler(this.mGame);
}
Program: 142388
Project: 142388
Buggy source:
public int createLight(float x,float y,Color pColor,float pSize){
  int index=this.mLights.size() + 1;
  this.mLights.put(index,new PointLight(this.mGame.getEngine().getRayHandler(),DEFAULT_NUM_RAYS,pColor,pSize,x - (TILE_PIXEL_WIDTH / 2f),y - (TILE_PIXEL_HEIGHT / 2f)));
  return index;
}

Fixed version (ground truth):
public int createLight(Light pLight){
  int index=this.mLights.size() + 1;
  this.mLights.put(index,pLight);
  return index;
}
Program: 142389
Project: 142389
Buggy source:
@Override public void update(float dt){
  Gdx.graphics.setTitle("String_Node_Str" + String.valueOf(Gdx.graphics.getFramesPerSecond() + "String_Node_Str" + map+ "String_Node_Str"+ this.mGame.getCharacterHandler().getPlayer().getUserPosX()+ "String_Node_Str"+ this.mGame.getCharacterHandler().getPlayer().getUserPosY()));
  if (Gdx.input.isKeyPressed(Input.Keys.UP)) {
    this.mGame.getCharacterHandler().getPlayer().moveUp();
  }
  if (Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
    this.mGame.getCharacterHandler().getPlayer().moveLeft();
  }
  if (Gdx.input.isKeyPressed(Input.Keys.DOWN)) {
    this.mGame.getCharacterHandler().getPlayer().moveDown();
  }
  if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
    this.mGame.getCharacterHandler().getPlayer().moveRight();
  }
  Gdx.gl.glClearColor(0,0,0,1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  Gdx.gl.glEnable(GL20.GL_BLEND);
  Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA,GL20.GL_ONE);
  this.mGame.getSpriteBatch().begin();
  this.mGame.getSpriteBatch().setProjectionMatrix(this.mGame.getCamera().combined);
  this.mGame.getCamera().update();
  this.mGame.getEngine().update(dt);
  this.mGame.getSpriteBatch().end();
  this.mGame.getEngine().updatePhysics(dt);
}

Fixed version (ground truth):
@Override public void update(float dt){
  Gdx.graphics.setTitle("String_Node_Str" + String.valueOf(Gdx.graphics.getFramesPerSecond() + "String_Node_Str" + map+ "String_Node_Str"+ this.mGame.getCharacterHandler().getPlayer().getUserPosX()+ "String_Node_Str"+ this.mGame.getCharacterHandler().getPlayer().getUserPosY()));
  if (Gdx.input.isKeyPressed(Input.Keys.UP)) {
    this.mGame.getCharacterHandler().getPlayer().moveUp();
  }
  if (Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
    this.mGame.getCharacterHandler().getPlayer().moveLeft();
  }
  if (Gdx.input.isKeyPressed(Input.Keys.DOWN)) {
    this.mGame.getCharacterHandler().getPlayer().moveDown();
  }
  if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
    this.mGame.getCharacterHandler().getPlayer().moveRight();
  }
  Gdx.gl.glClearColor(0,0,0,1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  Gdx.gl.glEnable(GL20.GL_BLEND);
  Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA,GL20.GL_ONE);
  this.mGame.getSpriteBatch().setProjectionMatrix(this.mGame.getCamera().combined);
  this.mGame.getCamera().update();
  this.mGame.getSpriteBatch().begin();
  this.mGame.getEngine().update(dt);
  this.mGame.getSpriteBatch().end();
  this.mGame.getSpriteBatch().setProjectionMatrix(this.mGame.getCamera().combined);
  this.mGame.getCamera().update();
  this.mGame.getEngine().updatePhysics(dt);
}
Program: 142390
Project: 142390
Buggy source:
/** 
 * This method returns the contents of the provided file as byte array. Null is returned iff file can not be found or is longer than Integer.MAX_VALUE. 
 * @param fileName the file to be read
 * @return the contents of the file to be read
 */
public static byte[] readFromFile(String fileName){
  RandomAccessFile raf=null;
  try {
    raf=new RandomAccessFile(fileName,"String_Node_Str");
    int length;
    long lengthLong=raf.length();
    if (lengthLong > Integer.MAX_VALUE) {
      raf.close();
      return null;
    }
 else {
      length=(int)lengthLong;
    }
    byte[] file=new byte[length];
    raf.readFully(file);
    raf.close();
    return file;
  }
 catch (  FileNotFoundException e) {
    System.out.println(e.getMessage());
    return null;
  }
catch (  IOException e) {
    return null;
  }
 finally {
    if (raf != null) {
      try {
        raf.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method returns the contents of the provided file as byte array. Null is returned iff file can not be found or is longer than Integer.MAX_VALUE. 
 * @param fileName the file to be read
 * @return the contents of the file to be read
 */
public static byte[] readFromFile(String fileName){
  try {
    return Files.readAllBytes(Paths.get(fileName));
  }
 catch (  IOException e) {
    BasicLogger.logException(PersonalizationFileHelper.class,e);
    return null;
  }
}
Program: 142391
Project: 142391
Buggy source:
/** 
 * (Recursively) search DF (identifed by DF name)
 * @param df
 * @param dfIdentifier
 * @return
 * @throws FileNotFoundException 
 */
private CardFile getFileForName(DedicatedFile df,DedicatedFileIdentifier dfIdentifier) throws FileNotFoundException {
  if (dfIdentifier.matches(df)) {
    return df;
  }
  for (  CardObject curChild : df.getChildren()) {
    if (curChild instanceof DedicatedFile) {
      try {
        return getFileForName((DedicatedFile)curChild,dfIdentifier);
      }
 catch (      FileNotFoundException e) {
        continue;
      }
    }
  }
  throw new FileNotFoundException();
}

Fixed version (ground truth):
/** 
 * (Recursively) search DF (identifed by DF name)
 * @param df
 * @param dfIdentifier
 * @return
 * @throws FileNotFoundException 
 */
private CardFile getFileForName(DedicatedFile df,DedicatedFileIdentifier dfIdentifier) throws FileNotFoundException {
  if (dfIdentifier.matches(df)) {
    return df;
  }
  for (  CardObject curChild : df.getChildren()) {
    if (curChild instanceof DedicatedFile) {
      CardFile candidate=getFileForName((DedicatedFile)curChild,dfIdentifier);
      if (candidate == null) {
        continue;
      }
 else {
        return candidate;
      }
    }
  }
  throw new FileNotFoundException("String_Node_Str" + dfIdentifier.toString());
}
Program: 142392
Project: 142392
Buggy source:
@Test public void testEraseFileOddInstructionInvalidOffsetDataObject() throws Exception {
  ProcessingData processingData=new ProcessingData();
  byte[] apduBytes=new byte[]{0x00,(byte)0x0F,0x00,0x00,0x02,0x54,0x00};
  processingData.updateCommandApdu(this,"String_Node_Str",CommandApduFactory.createCommandApdu(apduBytes));
  secStatus.updateMechanisms(new SecStatusMechanismUpdatePropagation(SecContext.GLOBAL,new CurrentFileSecMechanism(elementaryFileUnderMf)));
  fileProtocol.process(processingData);
  assertEquals(processingData.getResponseApdu().getStatusWord(),Iso7816.SW_6984_REFERENCE_DATA_NOT_USABLE);
  assertArrayEquals(new byte[]{1,2,3,4,5,6},elementaryFileContent);
}

Fixed version (ground truth):
@Test public void testEraseFileOddInstructionInvalidOffsetDataObject() throws Exception {
  ProcessingData processingData=new ProcessingData();
  byte[] apduBytes=new byte[]{0x00,(byte)0x0F,0x00,0x00,0x02,0x54,0x00};
  processingData.updateCommandApdu(this,"String_Node_Str",CommandApduFactory.createCommandApdu(apduBytes));
  secStatus.updateMechanisms(new SecStatusMechanismUpdatePropagation(SecContext.GLOBAL,new CurrentFileSecMechanism(elementaryFileUnderMf)));
  try {
    fileProtocol.process(processingData);
  }
 catch (  ProcessingException e) {
    assertEquals(Iso7816.SW_6984_REFERENCE_DATA_NOT_USABLE,e.getStatusWord());
    assertArrayEquals(new byte[]{1,2,3,4,5,6},elementaryFileContent);
    return;
  }
  fail("String_Node_Str");
}
Program: 142393
Project: 142393
Buggy source:
@Test public void testEraseFileEvenInstructionValidOffset() throws Exception {
  ProcessingData processingData=new ProcessingData();
  byte[] apduBytes=new byte[]{0x00,(byte)0x0E,0x00,0x00,0x01,0x02};
  processingData.updateCommandApdu(this,"String_Node_Str",CommandApduFactory.createCommandApdu(apduBytes));
  secStatus.updateMechanisms(new SecStatusMechanismUpdatePropagation(SecContext.GLOBAL,new CurrentFileSecMechanism(elementaryFileUnderMf)));
  fileProtocol.process(processingData);
  assertEquals("String_Node_Str",processingData.getResponseApdu().getStatusWord(),Iso7816.SW_9000_NO_ERROR);
  assertArrayEquals(new byte[]{1,2,0,0,0,0},elementaryFileContent);
}

Fixed version (ground truth):
@Test public void testEraseFileEvenInstructionValidOffset() throws Exception {
  ProcessingData processingData=new ProcessingData();
  byte[] apduBytes=new byte[]{0x00,(byte)0x0E,0x00,0x02};
  processingData.updateCommandApdu(this,"String_Node_Str",CommandApduFactory.createCommandApdu(apduBytes));
  secStatus.updateMechanisms(new SecStatusMechanismUpdatePropagation(SecContext.GLOBAL,new CurrentFileSecMechanism(elementaryFileUnderMf)));
  fileProtocol.process(processingData);
  assertEquals("String_Node_Str",processingData.getResponseApdu().getStatusWord(),Iso7816.SW_9000_NO_ERROR);
  assertArrayEquals(new byte[]{1,2,0,0,0,0},elementaryFileContent);
}
Program: 142395
Project: 142395
Buggy source:
protected void processCommandEraseBinary(){
  CardFile file;
  try {
    file=(CardFile)getFile(processingData.getCommandApdu(),cardState,false);
  }
 catch (  FileNotFoundException e) {
    ResponseApdu resp=new ResponseApdu(Iso7816.SW_6A82_FILE_NOT_FOUND);
    this.processingData.updateResponseAPDU(this,"String_Node_Str",resp);
    return;
  }
  ElementaryFile ef;
  if (!(file instanceof ElementaryFile)) {
    throw new ProcessingException(Iso7816.SW_6986_COMMAND_NOT_ALLOWED_NO_EF,"String_Node_Str");
  }
 else {
    ef=(ElementaryFile)file;
  }
  TlvValue apduData=processingData.getCommandApdu().getCommandData();
  try {
    if (apduData.getLength() > 0) {
      int startingOffset=Utils.getIntFromUnsignedByteArray(apduData.toByteArray());
      ef.erase(startingOffset);
    }
 else {
      ef.erase();
    }
    ResponseApdu resp=new ResponseApdu(Iso7816.SW_9000_NO_ERROR);
    this.processingData.updateResponseAPDU(this,"String_Node_Str",resp);
    processingData.addUpdatePropagation(this,"String_Node_Str",new ProtocolUpdate(true));
  }
 catch (  AccessDeniedException e) {
    throw new ProcessingException(Iso7816.SW_6982_SECURITY_STATUS_NOT_SATISFIED,"String_Node_Str");
  }
}

Fixed version (ground truth):
protected void processCommandEraseBinary(){
  CardFile file;
  try {
    file=(CardFile)getFile(processingData.getCommandApdu(),cardState,false);
  }
 catch (  FileNotFoundException e) {
    ResponseApdu resp=new ResponseApdu(Iso7816.SW_6A82_FILE_NOT_FOUND);
    this.processingData.updateResponseAPDU(this,"String_Node_Str",resp);
    return;
  }
  ElementaryFile ef;
  if (!(file instanceof ElementaryFile)) {
    throw new ProcessingException(Iso7816.SW_6986_COMMAND_NOT_ALLOWED_NO_EF,"String_Node_Str");
  }
 else {
    ef=(ElementaryFile)file;
  }
  int startingOffset=getOffset(processingData.getCommandApdu());
  TlvValue apduData=processingData.getCommandApdu().getCommandData();
  try {
    if (apduData.getLength() > 0) {
      int endingOffset=Utils.getIntFromUnsignedByteArray(apduData.toByteArray());
      ef.erase(startingOffset,endingOffset);
    }
 else {
      ef.erase(startingOffset);
    }
    ResponseApdu resp=new ResponseApdu(Iso7816.SW_9000_NO_ERROR);
    this.processingData.updateResponseAPDU(this,"String_Node_Str",resp);
    processingData.addUpdatePropagation(this,"String_Node_Str",new ProtocolUpdate(true));
  }
 catch (  AccessDeniedException e) {
    throw new ProcessingException(Iso7816.SW_6982_SECURITY_STATUS_NOT_SATISFIED,"String_Node_Str");
  }
}
Program: 142397
Project: 142397
Buggy source:
private boolean checkForRefresh(LinkedListLogListener listener){
  if (!txtOutput.isDisposed()) {
    if (listener.isRefreshNeeded()) {
      return true;
    }
 else     if (txtOutput.getText().equals("String_Node_Str") && listener.getNumberOfCachedLines() > 0) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean checkForRefresh(LinkedListLogListener listener){
  if (!txtOutput.isDisposed()) {
    if (listener.isRefreshNeeded() && !locked) {
      return true;
    }
 else     if (txtOutput.getText().equals("String_Node_Str") && listener.getNumberOfCachedLines() > 0) {
      return true;
    }
  }
  return false;
}
Program: 142398
Project: 142398
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  AuthorizationStore other=(AuthorizationStore)obj;
  Authorization currentAuthThis, currentAuthOther;
  for (  Oid currentOid : authorizations.keySet()) {
    currentAuthThis=getAuthorization(currentOid);
    currentAuthOther=other.getAuthorization(currentOid);
    if (currentAuthThis != currentAuthOther) {
      if (!currentAuthThis.equals(currentAuthOther)) {
        return false;
      }
    }
  }
  for (  Oid currentOid : other.authorizations.keySet()) {
    currentAuthThis=getAuthorization(currentOid);
    currentAuthOther=other.getAuthorization(currentOid);
    if (currentAuthThis != currentAuthOther) {
      if (!currentAuthThis.equals(currentAuthOther)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  AuthorizationStore other=(AuthorizationStore)obj;
  Authorization currentAuthThis, currentAuthOther;
  for (  Oid currentOid : authorizations.keySet()) {
    currentAuthThis=getAuthorization(currentOid);
    currentAuthOther=other.getAuthorization(currentOid);
    if (currentAuthThis != currentAuthOther) {
      if (!currentAuthThis.equals(currentAuthOther)) {
        return false;
      }
    }
  }
  for (  Oid currentOid : other.authorizations.keySet()) {
    currentAuthThis=getAuthorization(currentOid);
    currentAuthOther=other.getAuthorization(currentOid);
    if (currentAuthOther != currentAuthThis) {
      if (!currentAuthOther.equals(currentAuthThis)) {
        return false;
      }
    }
  }
  return true;
}
Program: 142399
Project: 142399
Buggy source:
@Override @PostConstruct public void createComposite(Composite parentComposite){
  super.createComposite(parentComposite);
  ;
  getSimAndConnectToNativeDriver();
}

Fixed version (ground truth):
@Override @PostConstruct public void createComposite(Composite parentComposite){
  super.createComposite(parentComposite);
  getSimAndConnectToNativeDriver();
}
Program: 142402
Project: 142402
Buggy source:
public int getInnermostActiveState(){
  if (isInWAITING_FOR_PROTOCOL_TO_PROCESS_APDU()) {
    return WAITING_FOR_PROTOCOL_TO_PROCESS_APDU;
  }
 else   if (isInSTART_OF_STACK()) {
    return START_OF_STACK;
  }
 else   if (isInWAITING_FOR_COMMAND()) {
    return WAITING_FOR_COMMAND;
  }
 else   if (isInPROTOCOL_FROM_LIST_ACTIVE()) {
    return PROTOCOL_FROM_LIST_ACTIVE;
  }
 else   if (isInPROTOCOL_PROCESSED()) {
    return PROTOCOL_PROCESSED;
  }
 else   if (isInPROTOCOL_FROM_STACK_ACTIVE()) {
    return PROTOCOL_FROM_STACK_ACTIVE;
  }
 else   if (isInPROTOCOL_INACTIVE()) {
    return PROTOCOL_INACTIVE;
  }
 else   if (isInEND_OF_STACK_OR_EMPTY()) {
    return END_OF_STACK_OR_EMPTY;
  }
 else   if (isInPROTOCOL_UNABLE_TO_PROCESS_APDU()) {
    return PROTOCOL_UNABLE_TO_PROCESS_APDU;
  }
 else   if (isInINITIALIZATION()) {
    return INITIALIZATION;
  }
 else {
    return __UNKNOWN_STATE__;
  }
}

Fixed version (ground truth):
public int getInnermostActiveState(){
  if (isInWAITING_FOR_PROTOCOL_TO_PROCESS_APDU()) {
    return WAITING_FOR_PROTOCOL_TO_PROCESS_APDU;
  }
 else   if (isInSTART_PROTOCOL_ITERATION()) {
    return START_PROTOCOL_ITERATION;
  }
 else   if (isInSTART_OF_STACK()) {
    return START_OF_STACK;
  }
 else   if (isInWAITING_FOR_COMMAND()) {
    return WAITING_FOR_COMMAND;
  }
 else   if (isInPROTOCOL_FROM_LIST_ACTIVE()) {
    return PROTOCOL_FROM_LIST_ACTIVE;
  }
 else   if (isInPROTOCOL_PROCESSED()) {
    return PROTOCOL_PROCESSED;
  }
 else   if (isInPROTOCOL_FROM_STACK_ACTIVE()) {
    return PROTOCOL_FROM_STACK_ACTIVE;
  }
 else   if (isInPROTOCOL_INACTIVE()) {
    return PROTOCOL_INACTIVE;
  }
 else   if (isInEND_OF_STACK_OR_EMPTY()) {
    return END_OF_STACK_OR_EMPTY;
  }
 else   if (isInPROTOCOL_UNABLE_TO_PROCESS_APDU()) {
    return PROTOCOL_UNABLE_TO_PROCESS_APDU;
  }
 else   if (isInINITIALIZATION()) {
    return INITIALIZATION;
  }
 else {
    return __UNKNOWN_STATE__;
  }
}
Program: 142403
Project: 142403
Buggy source:
/** 
 * Returns the kind of secure messaging the provided APDU's CLA byte indicates according to ISO 7816-4: <ul> <li>0  0  � No SM or no indication</li>  <li>0  1  � Proprietary SM format </li> <li>1  0  � SM according to 6, command header not processed according to 6.2.3.1</li> <li>1  1  � SM according to 6, command header authenticated according to 6.2.3.1</li> </ul> <p/>
 * @param apdu the APDU
 * @return the kind of secure messaging the provided APDU's CLA byte indicates one of{@link Iso7816#SM_OFF_OR_NO_INDICATION},<br/>  {@link Iso7816#SM_PROPRIETARY},<br/>  {@link Iso7816#SM_COMMAND_HEADER_NOT_PROCESSED},<br/>  {@link Iso7816#SM_COMMAND_HEADER_AUTHENTICATED},
 */
public static byte getSecureMessagingStatus(byte[] apdu){
  byte cla=apdu[OFFSET_CLA];
  byte isoFormat=getISOFormat(apdu);
  if (isoFormat == ISO_FORMAT_FIRSTINTERINDUSTRY) {
    cla=(byte)(cla & (byte)0x0C);
    return (byte)(cla >> 2);
  }
 else {
    if (isoFormat == ISO_FORMAT_FURTHERINTERINDUSTRY) {
      cla=(byte)(cla & (byte)0x20);
      return (byte)(cla >> 4);
    }
 else {
      if (isoFormat >= ISO_FORMAT_PROPRIETARY) {
        ISO7816Exception.throwIt(Iso7816.SW_6E00_CLA_NOT_SUPPORTED);
      }
 else {
      }
      return Byte.MIN_VALUE;
    }
  }
}

Fixed version (ground truth):
/** 
 * Returns the kind of secure messaging the provided APDU's CLA byte indicates according to ISO 7816-4: <ul> <li>0  0  - No SM or no indication</li>  <li>0  1  - Proprietary SM format </li> <li>1  0  - SM according to 6, command header not processed according to 6.2.3.1</li> <li>1  1  - SM according to 6, command header authenticated according to 6.2.3.1</li> </ul> <p/>
 * @param apdu the APDU
 * @return the kind of secure messaging the provided APDU's CLA byte indicates one of{@link Iso7816#SM_OFF_OR_NO_INDICATION},<br/>  {@link Iso7816#SM_PROPRIETARY},<br/>  {@link Iso7816#SM_COMMAND_HEADER_NOT_PROCESSED},<br/>  {@link Iso7816#SM_COMMAND_HEADER_AUTHENTICATED},
 */
public static byte getSecureMessagingStatus(byte[] apdu){
  byte cla=apdu[OFFSET_CLA];
  byte isoFormat=getISOFormat(apdu);
  if (isoFormat == ISO_FORMAT_FIRSTINTERINDUSTRY) {
    cla=(byte)(cla & (byte)0x0C);
    return (byte)(cla >> 2);
  }
 else {
    if (isoFormat == ISO_FORMAT_FURTHERINTERINDUSTRY) {
      cla=(byte)(cla & (byte)0x20);
      return (byte)(cla >> 4);
    }
 else {
      if (isoFormat >= ISO_FORMAT_PROPRIETARY) {
        ISO7816Exception.throwIt(Iso7816.SW_6E00_CLA_NOT_SUPPORTED);
      }
 else {
      }
      return Byte.MIN_VALUE;
    }
  }
}
Program: 142404
Project: 142404
Buggy source:
/** 
 * Returns whether the provided APDU matches the provided secure messaging indication according to ISO 7816-4: 0  0  � No SM or no indication  0  1  � Proprietary SM format  1  0  � SM according to 6, command header not processed according to 6.2.3.1 1  1  � SM according to 6, command header authenticated according to 6.2.3.1
 * @param apdu the APDU
 * @param specification some secure messaging status
 * @return whether the provided APDU matches the provided secure messaging status
 */
public static boolean isSecureMessagingCLA(byte[] apdu,byte specification){
  return specification == getSecureMessagingStatus(apdu);
}

Fixed version (ground truth):
/** 
 * Returns whether the provided APDU matches the provided secure messaging indication according to ISO 7816-4: 0  0  - No SM or no indication  0  1  - Proprietary SM format  1  0  - SM according to 6, command header not processed according to 6.2.3.1 1  1  - SM according to 6, command header authenticated according to 6.2.3.1
 * @param apdu the APDU
 * @param specification some secure messaging status
 * @return whether the provided APDU matches the provided secure messaging status
 */
public static boolean isSecureMessagingCLA(byte[] apdu,byte specification){
  return specification == getSecureMessagingStatus(apdu);
}