nus-yam/ex-repair huggingface dataset:
Program: 80001
Project: 80001
Buggy source:
@Override public void performDataSync(OSyncAdapter adapter,Bundle extras,OUser user){
  if (adapter.getModel().getModelName().equals("String_Node_Str")) {
    ODomain domain=new ODomain();
    SaleOrder saleOrder=new SaleOrder(getApplicationContext(),user);
    List<Integer> newIds=new ArrayList<>();
    for (    ODataRow row : saleOrder.select(new String[]{},"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"})) {
      newIds.add(row.getInt("String_Node_Str"));
    }
    if (newIds.size() > 0) {
      domain.add("String_Node_Str","String_Node_Str",newIds);
    }
    if (!firstSync)     adapter.onSyncFinish(this);
    domain.add("String_Node_Str","String_Node_Str",user.getUser_id());
    adapter.setDomain(domain);
  }
  if (adapter.getModel().getModelName().equals("String_Node_Str")) {
    adapter.onSyncFinish(syncFinishListener);
  }
}

Fixed version (ground truth):
@Override public void performDataSync(OSyncAdapter adapter,Bundle extras,OUser user){
  if (adapter.getModel().getModelName().equals("String_Node_Str")) {
    ODomain domain=new ODomain();
    SaleOrder saleOrder=new SaleOrder(getApplicationContext(),user);
    List<Integer> newIds=new ArrayList<>();
    for (    ODataRow row : saleOrder.select(new String[]{},"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"})) {
      newIds.add(row.getInt("String_Node_Str"));
    }
    if (newIds.size() > 0) {
      domain.add("String_Node_Str","String_Node_Str",newIds);
    }
    if (!firstSync)     adapter.onSyncFinish(this);
    domain.add("String_Node_Str","String_Node_Str",user.getUser_id());
    adapter.setDomain(domain).syncDataLimit(50);
  }
  if (adapter.getModel().getModelName().equals("String_Node_Str")) {
    adapter.onSyncFinish(syncFinishListener);
  }
}
Program: 80002
Project: 80002
Buggy source:
public OValues handleResult(int requestCode,int resultCode,Intent data){
  if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case REQUEST_CAMERA:
      OValues values=getURIDetails(newImageUri);
    if (values.getLong("String_Node_Str") < IMAGE_MAX_SIZE) {
      values.put("String_Node_Str",BitmapUtils.uriToBase64(newImageUri,mContext.getContentResolver()));
      return values;
    }
 else {
      values=new OValues();
      values.put("String_Node_Str",true);
    }
  break;
case REQUEST_IMAGE:
values=getURIDetails(data.getData());
if (values.getLong("String_Node_Str") < IMAGE_MAX_SIZE) {
values.put("String_Node_Str",BitmapUtils.uriToBase64(data.getData(),mContext.getContentResolver()));
return values;
}
 else {
values=new OValues();
values.put("String_Node_Str",true);
}
break;
}
}
return null;
}

Fixed version (ground truth):
public OValues handleResult(int requestCode,int resultCode,Intent data){
  if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case REQUEST_CAMERA:
      OValues values=getURIDetails(newImageUri);
    values.put("String_Node_Str",BitmapUtils.uriToBase64(newImageUri,mContext.getContentResolver(),true));
  return values;
case REQUEST_IMAGE:
values=getURIDetails(data.getData());
values.put("String_Node_Str",BitmapUtils.uriToBase64(data.getData(),mContext.getContentResolver(),true));
return values;
}
}
return null;
}
Program: 80003
Project: 80003
Buggy source:
public static String uriToBase64(Uri uri,ContentResolver resolver){
  String encodedBase64="String_Node_Str";
  try {
    byte[] bytes=readBytes(uri,resolver);
    encodedBase64=Base64.encodeToString(bytes,0);
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  return encodedBase64;
}

Fixed version (ground truth):
public static String uriToBase64(Uri uri,ContentResolver resolver,boolean thumbnail){
  String encodedBase64="String_Node_Str";
  try {
    byte[] bytes=readBytes(uri,resolver,thumbnail);
    encodedBase64=Base64.encodeToString(bytes,0);
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  return encodedBase64;
}
Program: 80004
Project: 80004
Buggy source:
/** 
 * Read bytes.
 * @param uri      the uri
 * @param resolver the resolver
 * @return the byte[]
 * @throws IOException Signals that an I/O exception has occurred.
 */
private static byte[] readBytes(Uri uri,ContentResolver resolver) throws IOException {
  InputStream inputStream=resolver.openInputStream(uri);
  ByteArrayOutputStream byteBuffer=new ByteArrayOutputStream();
  int bufferSize=1024;
  byte[] buffer=new byte[bufferSize];
  int len=0;
  while ((len=inputStream.read(buffer)) != -1) {
    byteBuffer.write(buffer,0,len);
  }
  return byteBuffer.toByteArray();
}

Fixed version (ground truth):
/** 
 * Read bytes.
 * @param uri      the uri
 * @param resolver the resolver
 * @return the byte[]
 * @throws IOException Signals that an I/O exception has occurred.
 */
private static byte[] readBytes(Uri uri,ContentResolver resolver,boolean thumbnail) throws IOException {
  InputStream inputStream=resolver.openInputStream(uri);
  ByteArrayOutputStream byteBuffer=new ByteArrayOutputStream();
  if (!thumbnail) {
    int bufferSize=1024;
    byte[] buffer=new byte[bufferSize];
    int len=0;
    while ((len=inputStream.read(buffer)) != -1) {
      byteBuffer.write(buffer,0,len);
    }
  }
 else {
    Bitmap imageBitmap=BitmapFactory.decodeStream(inputStream);
    int thumb_width=imageBitmap.getWidth() / 2;
    int thumb_height=imageBitmap.getHeight() / 2;
    if (thumb_width > THUMBNAIL_SIZE) {
      thumb_width=THUMBNAIL_SIZE;
    }
    if (thumb_width == THUMBNAIL_SIZE) {
      thumb_height=((imageBitmap.getHeight() / 2) * THUMBNAIL_SIZE) / (imageBitmap.getWidth() / 2);
    }
    imageBitmap=Bitmap.createScaledBitmap(imageBitmap,thumb_width,thumb_height,false);
    imageBitmap.compress(Bitmap.CompressFormat.JPEG,100,byteBuffer);
  }
  return byteBuffer.toByteArray();
}
Program: 80006
Project: 80006
Buggy source:
public OdooActivity parent(){
  return (OdooActivity)getActivity();
}

Fixed version (ground truth):
public OdooActivity parent(){
  return (OdooActivity)mContext;
}
Program: 80007
Project: 80007
Buggy source:
/** 
 * Callback invoked with the sync adapter status changes. 
 */
@Override public void onStatusChanged(int which){
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      boolean syncActive=ContentResolver.isSyncActive(OUser.current(getActivity()).getAccount(),syncStatusObserverModel.authority());
      boolean syncPending=ContentResolver.isSyncPending(OUser.current(getActivity()).getAccount(),syncStatusObserverModel.authority());
      boolean refreshing=syncActive | syncPending;
      if (!refreshing) {
      }
      mSyncStatusObserverListener.onStatusChange(refreshing);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Callback invoked with the sync adapter status changes. 
 */
@Override public void onStatusChanged(int which){
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      boolean syncActive=ContentResolver.isSyncActive(OUser.current(mContext).getAccount(),syncStatusObserverModel.authority());
      boolean syncPending=ContentResolver.isSyncPending(OUser.current(mContext).getAccount(),syncStatusObserverModel.authority());
      boolean refreshing=syncActive | syncPending;
      if (!refreshing) {
      }
      mSyncStatusObserverListener.onStatusChange(refreshing);
    }
  }
);
}
Program: 80008
Project: 80008
Buggy source:
public int _c(int res_id){
  return OResource.color(getActivity(),res_id);
}

Fixed version (ground truth):
public int _c(int res_id){
  return OResource.color(mContext,res_id);
}
Program: 80009
Project: 80009
Buggy source:
public int _dim(int res_id){
  return OResource.dimen(getActivity(),res_id);
}

Fixed version (ground truth):
public int _dim(int res_id){
  return OResource.dimen(mContext,res_id);
}
Program: 80010
Project: 80010
Buggy source:
public boolean inNetwork(){
  App app=(App)getActivity().getApplicationContext();
  return app.inNetwork();
}

Fixed version (ground truth):
public boolean inNetwork(){
  App app=(App)mContext.getApplicationContext();
  return app.inNetwork();
}
Program: 80011
Project: 80011
Buggy source:
public String _s(int res_id){
  return OResource.string(getActivity(),res_id);
}

Fixed version (ground truth):
public String _s(int res_id){
  return OResource.string(mContext,res_id);
}
Program: 80012
Project: 80012
Buggy source:
public OUser user(){
  if (getActivity() != null)   return OUser.current(getActivity());
  return null;
}

Fixed version (ground truth):
public OUser user(){
  if (mContext != null)   return OUser.current(mContext);
  return null;
}
Program: 80013
Project: 80013
Buggy source:
public OModel db(){
  Class<?> model=database();
  if (model != null) {
    return new OModel(getActivity(),null,user()).createInstance(model);
  }
  return null;
}

Fixed version (ground truth):
public OModel db(){
  Class<?> model=database();
  if (model != null) {
    return new OModel(mContext,null,user()).createInstance(model);
  }
  return null;
}
Program: 80015
Project: 80015
Buggy source:
public OdooActivity parent(){
  return (OdooActivity)getActivity();
}

Fixed version (ground truth):
public OdooActivity parent(){
  return (OdooActivity)mContext;
}
Program: 80016
Project: 80016
Buggy source:
/** 
 * Callback invoked with the sync adapter status changes. 
 */
@Override public void onStatusChanged(int which){
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      boolean syncActive=ContentResolver.isSyncActive(OUser.current(getActivity()).getAccount(),syncStatusObserverModel.authority());
      boolean syncPending=ContentResolver.isSyncPending(OUser.current(getActivity()).getAccount(),syncStatusObserverModel.authority());
      boolean refreshing=syncActive | syncPending;
      if (!refreshing) {
      }
      mSyncStatusObserverListener.onStatusChange(refreshing);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Callback invoked with the sync adapter status changes. 
 */
@Override public void onStatusChanged(int which){
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      boolean syncActive=ContentResolver.isSyncActive(OUser.current(mContext).getAccount(),syncStatusObserverModel.authority());
      boolean syncPending=ContentResolver.isSyncPending(OUser.current(mContext).getAccount(),syncStatusObserverModel.authority());
      boolean refreshing=syncActive | syncPending;
      if (!refreshing) {
      }
      mSyncStatusObserverListener.onStatusChange(refreshing);
    }
  }
);
}
Program: 80017
Project: 80017
Buggy source:
public int _c(int res_id){
  return OResource.color(getActivity(),res_id);
}

Fixed version (ground truth):
public int _c(int res_id){
  return OResource.color(mContext,res_id);
}
Program: 80018
Project: 80018
Buggy source:
public int _dim(int res_id){
  return OResource.dimen(getActivity(),res_id);
}

Fixed version (ground truth):
public int _dim(int res_id){
  return OResource.dimen(mContext,res_id);
}
Program: 80019
Project: 80019
Buggy source:
public boolean inNetwork(){
  App app=(App)getActivity().getApplicationContext();
  return app.inNetwork();
}

Fixed version (ground truth):
public boolean inNetwork(){
  App app=(App)mContext.getApplicationContext();
  return app.inNetwork();
}
Program: 80020
Project: 80020
Buggy source:
public String _s(int res_id){
  return OResource.string(getActivity(),res_id);
}

Fixed version (ground truth):
public String _s(int res_id){
  return OResource.string(mContext,res_id);
}
Program: 80021
Project: 80021
Buggy source:
public OUser user(){
  if (getActivity() != null)   return OUser.current(getActivity());
  return null;
}

Fixed version (ground truth):
public OUser user(){
  if (mContext != null)   return OUser.current(mContext);
  return null;
}
Program: 80022
Project: 80022
Buggy source:
public OModel db(){
  Class<?> model=database();
  if (model != null) {
    return new OModel(getActivity(),null,user()).createInstance(model);
  }
  return null;
}

Fixed version (ground truth):
public OModel db(){
  Class<?> model=database();
  if (model != null) {
    return new OModel(mContext,null,user()).createInstance(model);
  }
  return null;
}
Program: 80023
Project: 80023
Buggy source:
public Odoo createInstance(){
  Odoo odoo=null;
  OUser user=OUser.current(getApplicationContext());
  if (user != null) {
    try {
      if (user.isOAauthLogin()) {
        odoo=new Odoo(user.getInstanceUrl(),user.isAllowSelfSignedSSL());
        OdooInstance instance=new OdooInstance();
        instance.setInstanceUrl(user.getInstanceUrl());
        instance.setDatabaseName(user.getInstanceDatabase());
        instance.setClientId(user.getClientId());
        odoo.oauth_authenticate(instance,user.getUsername(),user.getPassword());
      }
 else {
        odoo=new Odoo(user.getHost(),user.isAllowSelfSignedSSL());
        odoo.authenticate(user.getUsername(),user.getPassword(),user.getDatabase());
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return odoo;
}

Fixed version (ground truth):
public Odoo createInstance(){
  Odoo odoo=null;
  OUser user=OUser.current(getApplicationContext());
  if (user != null) {
    try {
      if (user.isOAauthLogin()) {
        odoo=new Odoo(user.getInstanceUrl(),user.isAllowSelfSignedSSL());
        OdooInstance instance=new OdooInstance();
        instance.setInstanceUrl(user.getInstanceUrl());
        instance.setDatabaseName(user.getInstanceDatabase());
        instance.setClientId(user.getClientId());
        odoo.oauth_authenticate(instance,user.getUsername(),user.getPassword());
      }
 else {
        odoo=new Odoo(user.getHost(),user.isAllowSelfSignedSSL());
        odoo.authenticate(user.getUsername(),user.getPassword(),user.getDatabase());
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  mOdooInstance=odoo;
  return odoo;
}
Program: 80024
Project: 80024
Buggy source:
/** 
 * Removes the account.
 * @param context the context
 * @param username the username
 */
public static void removeAccount(Context context,String username){
  AccountManager accMgr=AccountManager.get(context);
  accMgr.removeAccount(OpenERPAccountManager.getAccount(context,username),null,null);
  App app=(App)context.getApplicationContext();
  app.setOEInstance(null);
  current_user=null;
}

Fixed version (ground truth):
/** 
 * Removes the account.
 * @param context the context
 * @param username the username 
 */
public static void removeAccount(Context context,String username){
  AccountManager accMgr=AccountManager.get(context);
  accMgr.removeAccount(OpenERPAccountManager.getAccount(context,username),null,null);
  App app=(App)context.getApplicationContext();
  app.setOEInstance(null);
  current_user=null;
}
Program: 80025
Project: 80025
Buggy source:
private static boolean cancelAllSync(Account account){
  SyncWizardValues syncVals=new SyncWizardValues();
  boolean flag=false;
  for (  SyncValue sync : syncVals.syncValues()) {
    ContentResolver.cancelSync(account,sync.getAuthority());
    flag=true;
  }
  return flag;
}

Fixed version (ground truth):
private static boolean cancelAllSync(Account account){
  SyncWizardValues syncVals=new SyncWizardValues();
  for (  SyncValue sync : syncVals.syncValues()) {
    ContentResolver.cancelSync(account,sync.getAuthority());
  }
  return true;
}
Program: 80026
Project: 80026
Buggy source:
private void updateSyncSettings(){
  Log.d(TAG,"String_Node_Str");
  PreferenceManager mPref=new PreferenceManager(mContext);
  int sync_interval=mPref.getInt("String_Node_Str",1440);
  List<String> default_authorities=new ArrayList<String>();
  default_authorities.add("String_Node_Str");
  default_authorities.add("String_Node_Str");
  SyncAdapterType[] list=ContentResolver.getSyncAdapterTypes();
  Account mAccount=OpenERPAccountManager.getAccount(mContext,OEUser.current(mContext).getAndroidName());
  for (  SyncAdapterType lst : list) {
    if (lst.authority.contains("String_Node_Str")) {
      default_authorities.add(lst.authority);
    }
  }
  for (  String authority : default_authorities) {
    boolean isSyncActive=ContentResolver.getSyncAutomatically(mAccount,authority);
    if (isSyncActive) {
      setSyncPeriodic(authority,sync_interval,1,1);
    }
  }
  Toast.makeText(this,R.string.toast_setting_saved,Toast.LENGTH_LONG).show();
}

Fixed version (ground truth):
private void updateSyncSettings(){
  Log.d(TAG,"String_Node_Str");
  PreferenceManager mPref=new PreferenceManager(mContext);
  int sync_interval=mPref.getInt("String_Node_Str",1440);
  List<String> default_authorities=new ArrayList<String>();
  default_authorities.add("String_Node_Str");
  default_authorities.add("String_Node_Str");
  SyncAdapterType[] list=ContentResolver.getSyncAdapterTypes();
  Account mAccount=OpenERPAccountManager.getAccount(mContext,OEUser.current(mContext).getAndroidName());
  for (  SyncAdapterType lst : list) {
    if (lst.authority.contains("String_Node_Str") && lst.authority.contains("String_Node_Str")) {
      default_authorities.add(lst.authority);
    }
  }
  for (  String authority : default_authorities) {
    boolean isSyncActive=ContentResolver.getSyncAutomatically(mAccount,authority);
    if (isSyncActive) {
      setSyncPeriodic(authority,sync_interval,60,1);
    }
  }
  Toast.makeText(this,R.string.toast_setting_saved,Toast.LENGTH_LONG).show();
}
Program: 80027
Project: 80027
Buggy source:
private void initDrawer(List<DrawerItem> drawerItems){
  Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
  Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
  String user_name="String_Node_Str";
  if (obj instanceof Boolean) {
    user_name=OEUser.current(context).getUsername();
  }
 else {
    user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
  }
  mDrawerTitle=user_name;
  mDrawerSubtitle=OEUser.current(context).getHost();
  getActionBar().setHomeButtonEnabled(true);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setDrawerItems(drawerItems);
  if (mDrawerItemSelectedPosition > 0) {
    mAppTitle=mDrawerListItems.get(mDrawerItemSelectedPosition).getTitle();
    setTitle(mAppTitle);
  }
}

Fixed version (ground truth):
private void initDrawer(List<DrawerItem> drawerItems){
  if (OEUser.current(context) != null) {
    Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
    Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
    String user_name="String_Node_Str";
    if (obj instanceof Boolean) {
      user_name=OEUser.current(context).getUsername();
    }
 else {
      user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
    }
    mDrawerTitle=user_name;
    mDrawerSubtitle=OEUser.current(context).getHost();
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setDrawerItems(drawerItems);
    if (mDrawerItemSelectedPosition > 0) {
      mAppTitle=mDrawerListItems.get(mDrawerItemSelectedPosition).getTitle();
      setTitle(mAppTitle);
    }
  }
}
Program: 80028
Project: 80028
Buggy source:
private void initDrawer(List<DrawerItem> drawerItems){
  Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
  Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
  String user_name="String_Node_Str";
  if (obj instanceof Boolean) {
    user_name=OEUser.current(context).getUsername();
  }
 else {
    user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
  }
  mDrawerTitle=user_name;
  mDrawerSubtitle=OEUser.current(context).getHost();
  getActionBar().setHomeButtonEnabled(true);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setDrawerItems(drawerItems);
}

Fixed version (ground truth):
private void initDrawer(List<DrawerItem> drawerItems){
  Res_PartnerDBHelper partner=new Res_PartnerDBHelper(context);
  Object obj=partner.search(partner,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"},new String[]{OEUser.current(context).getPartner_id()}).get("String_Node_Str");
  String user_name="String_Node_Str";
  if (obj instanceof Boolean) {
    user_name=OEUser.current(context).getUsername();
  }
 else {
    user_name=((List<HashMap<String,Object>>)obj).get(0).get("String_Node_Str").toString();
  }
  mDrawerTitle=user_name;
  mDrawerSubtitle=OEUser.current(context).getHost();
  getActionBar().setHomeButtonEnabled(true);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setDrawerItems(drawerItems);
  if (mDrawerItemSelectedPosition > 0) {
    mAppTitle=mDrawerListItems.get(mDrawerItemSelectedPosition).getTitle();
    setTitle(mAppTitle);
  }
}
Program: 80029
Project: 80029
Buggy source:
@Override public void onStart(){
  super.onStart();
  mDrawerListView.setOnItemClickListener(this);
  int position=-1;
  if (mDrawerListItems.size() > 0) {
    if (!mDrawerListItems.get(0).isGroupTitle()) {
      mDrawerListView.setItemChecked(0,true);
      position=0;
    }
 else {
      mDrawerListView.setItemChecked(1,true);
      position=1;
    }
  }
  if (mDrawerItemSelectedPosition >= 0) {
    position=mDrawerItemSelectedPosition;
  }
  if (getIntent().getAction() != null && !getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,MessageComposeActivty.class));
    }
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,ComposeNoteActivity.class));
    }
  }
 else {
    if (position > 0) {
      loadFragment(mDrawerListItems.get(position));
    }
  }
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  mDrawerListView.setOnItemClickListener(this);
  int position=-1;
  if (mDrawerListItems.size() > 0) {
    if (!mDrawerListItems.get(0).isGroupTitle()) {
      mDrawerListView.setItemChecked(0,true);
      position=0;
    }
 else {
      mDrawerListView.setItemChecked(1,true);
      position=1;
    }
  }
  if (mDrawerItemSelectedPosition >= 0) {
    position=mDrawerItemSelectedPosition;
  }
  if (getIntent().getAction() != null && !getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,MessageComposeActivty.class));
    }
    if (getIntent().getAction().toString().equalsIgnoreCase("String_Node_Str")) {
      startActivity(new Intent(context,ComposeNoteActivity.class));
    }
  }
 else {
    if (position > 0) {
      if (position != mDrawerItemSelectedPosition) {
        loadFragment(mDrawerListItems.get(position));
      }
    }
  }
}
Program: 80031
Project: 80031
Buggy source:
@Override public OEMenu menuHelper(Context context){
  OEMenu menu=new OEMenu();
  menu.setId(1);
  menu.setMenuTitle("String_Node_Str");
  setNoteStages(context);
  List<OEMenuItems> items=new ArrayList<OEMenuItems>();
  items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),getCount("String_Node_Str",context)));
  items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),0));
  if (stages != null) {
    int i=0;
    for (    String key : stages.keySet()) {
      if (i > tag_colors.length - 1) {
        i=0;
      }
      OEMenuItems stageMenu=new OEMenuItems(stages.get(key).toString(),getFragBundle("String_Node_Str",key),getCount(key,context));
      stageMenu.setAutoMenuTagColor(true);
      stageMenu.setMenuTagColor(Color.parseColor(tag_colors[i]));
      stage_colors.put("String_Node_Str" + key,stageMenu.getMenuTagColor());
      items.add(stageMenu);
      i++;
    }
  }
  menu.setMenuItems(items);
  return menu;
}

Fixed version (ground truth):
@Override public OEMenu menuHelper(Context context){
  db=(NoteDBHelper)databaseHelper(context);
  if (db.getOEInstance().isInstalled("String_Node_Str")) {
    OEMenu menu=new OEMenu();
    menu.setId(1);
    menu.setMenuTitle("String_Node_Str");
    setNoteStages(context);
    List<OEMenuItems> items=new ArrayList<OEMenuItems>();
    items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),getCount("String_Node_Str",context)));
    items.add(new OEMenuItems("String_Node_Str",getFragBundle("String_Node_Str","String_Node_Str"),0));
    if (stages != null) {
      int i=0;
      for (      String key : stages.keySet()) {
        if (i > tag_colors.length - 1) {
          i=0;
        }
        OEMenuItems stageMenu=new OEMenuItems(stages.get(key).toString(),getFragBundle("String_Node_Str",key),getCount(key,context));
        stageMenu.setAutoMenuTagColor(true);
        stageMenu.setMenuTagColor(Color.parseColor(tag_colors[i]));
        stage_colors.put("String_Node_Str" + key,stageMenu.getMenuTagColor());
        items.add(stageMenu);
        i++;
      }
    }
    menu.setMenuItems(items);
    return menu;
  }
 else {
    return null;
  }
}
Program: 80032
Project: 80032
Buggy source:
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  setHasOptionsMenu(true);
  scope=new AppScope(MainActivity.userContext,(MainActivity)getActivity());
  db=(NoteDBHelper)getModel();
  rootView=inflater.inflate(R.layout.fragment_note,container,false);
  lstNotes=(ListView)rootView.findViewById(R.id.lstNotes);
  emptyNotesText=(TextView)rootView.findViewById(R.id.txvNoteAllArchive);
  handleArguments((Bundle)getArguments());
  return rootView;
}

Fixed version (ground truth):
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  scope=new AppScope(MainActivity.userContext,(MainActivity)getActivity());
  db=(NoteDBHelper)getModel();
  setHasOptionsMenu(true);
  rootView=inflater.inflate(R.layout.fragment_note,container,false);
  lstNotes=(ListView)rootView.findViewById(R.id.lstNotes);
  emptyNotesText=(TextView)rootView.findViewById(R.id.txvNoteAllArchive);
  handleArguments((Bundle)getArguments());
  return rootView;
}
Program: 80033
Project: 80033
Buggy source:
/** 
 * Load base modules.
 */
private void loadBaseModules(){
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new ResFragment(),0));
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new AttachmentFragment(),0));
}

Fixed version (ground truth):
/** 
 * Load base modules.
 */
private void loadBaseModules(){
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new ResFragment(),0));
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new AttachmentFragment(),0));
  this.modules.add(new Module("String_Node_Str","String_Node_Str",new Ir_modelFragment(),0));
}
Program: 80034
Project: 80034
Buggy source:
/** 
 * Sets the stroke that will be used to draw shapes.  
 * @param s  the stroke ({@code null} not permitted).
 * @see #getStroke() 
 */
@Override public void setStroke(Stroke s){
  nullNotPermitted(s,"String_Node_Str");
  if (s == this.stroke) {
    return;
  }
  if (stroke instanceof BasicStroke) {
    BasicStroke bs=(BasicStroke)s;
    if (bs.equals(this.stroke)) {
      return;
    }
    double lineWidth=bs.getLineWidth();
    if (lineWidth == 0.0) {
      lineWidth=this.zeroStrokeWidth;
    }
    this.gc.setLineWidth(lineWidth);
    this.gc.setLineCap(awtToJavaFXLineCap(bs.getEndCap()));
    this.gc.setLineJoin(awtToJavaFXLineJoin(bs.getLineJoin()));
    this.gc.setMiterLimit(bs.getMiterLimit());
    this.gc.setLineDashes(floatToDoubleArray(bs.getDashArray()));
    this.gc.setLineDashOffset(bs.getDashPhase());
  }
  this.stroke=s;
}

Fixed version (ground truth):
/** 
 * Sets the stroke that will be used to draw shapes.  
 * @param s  the stroke ({@code null} not permitted).
 * @see #getStroke() 
 */
@Override public void setStroke(Stroke s){
  nullNotPermitted(s,"String_Node_Str");
  if (s == this.stroke) {
    return;
  }
  if (stroke instanceof BasicStroke) {
    BasicStroke bs=(BasicStroke)s;
    if (bs.equals(this.stroke)) {
      return;
    }
  }
  this.stroke=s;
  applyStroke(s);
}
Program: 80036
Project: 80036
Buggy source:
private void reapplyAttributes(){
  if (!paintsAreEqual(this.paint,this.savedPaint)) {
    setPaint(this.savedPaint);
  }
  if (!this.color.equals(this.savedColor)) {
    setColor(this.savedColor);
  }
  if (!this.stroke.equals(this.savedColor)) {
    setStroke(this.savedStroke);
  }
  if (!this.font.equals(this.savedFont)) {
    setFont(this.savedFont);
  }
  if (!this.transform.equals(this.savedTransform)) {
    setTransform(this.transform);
  }
  this.savedColor=null;
  this.savedFont=null;
  this.savedPaint=null;
  this.savedStroke=null;
  this.savedTransform=null;
}

Fixed version (ground truth):
private void reapplyAttributes(){
  if (!paintsAreEqual(this.paint,this.savedPaint)) {
    applyPaint(this.paint);
  }
  if (!this.color.equals(this.savedColor)) {
    applyColor(this.color);
  }
  if (!this.stroke.equals(this.savedStroke)) {
    applyStroke(this.stroke);
  }
  if (!this.font.equals(this.savedFont)) {
    applyFont(this.font);
  }
  if (!this.transform.equals(this.savedTransform)) {
    setTransform(this.transform);
  }
  this.savedColor=null;
  this.savedFont=null;
  this.savedPaint=null;
  this.savedStroke=null;
  this.savedTransform=null;
}
Program: 80037
Project: 80037
Buggy source:
/** 
 * Sets the foreground color.  This method exists for backwards  compatibility in AWT, you should use the   {@link #setPaint(java.awt.Paint)} method.
 * @param c  the color ({@code null} permitted but ignored). 
 * @see #setPaint(java.awt.Paint) 
 */
@Override public void setColor(Color c){
  if (c == null || c.equals(this.color)) {
    return;
  }
  this.color=c;
  this.paint=c;
  javafx.scene.paint.Color fxcolor=awtColorToJavaFX(c);
  this.gc.setFill(fxcolor);
  this.gc.setStroke(fxcolor);
}

Fixed version (ground truth):
/** 
 * Sets the foreground color.  This method exists for backwards  compatibility in AWT, you should use the   {@link #setPaint(java.awt.Paint)} method.
 * @param c  the color ({@code null} permitted but ignored). 
 * @see #setPaint(java.awt.Paint) 
 */
@Override public void setColor(Color c){
  if (c == null || c.equals(this.color)) {
    return;
  }
  applyColor(c);
}
Program: 80038
Project: 80038
Buggy source:
/** 
 * Creates a new   {@link GraphiteReporter}.
 * @param metricsRegistry the metrics registry
 * @param prefix          is prepended to all names reported to graphite
 * @param predicate       filters metrics to be reported
 * @param dimensions      enum of enabled dimensions to include
 * @param socketProvider  a {@link SocketProvider} instance
 * @param clock           a {@link Clock} instance
 * @throws IOException if there is an error connecting to the Graphite server
 */
public FilteredGraphiteReporter(MetricsRegistry metricsRegistry,String prefix,MetricPredicate predicate,EnumSet<Dimension> dimensions,SocketProvider socketProvider,Clock clock) throws IOException {
  super(metricsRegistry,prefix,predicate,socketProvider,clock);
  this.dimensions=dimensions;
  LOGGER.error("String_Node_Str",dimensions);
}

Fixed version (ground truth):
/** 
 * Creates a new   {@link GraphiteReporter}.
 * @param metricsRegistry the metrics registry
 * @param prefix          is prepended to all names reported to graphite
 * @param predicate       filters metrics to be reported
 * @param dimensions      enum of enabled dimensions to include
 * @param socketProvider  a {@link SocketProvider} instance
 * @param clock           a {@link Clock} instance
 * @throws IOException if there is an error connecting to the Graphite server
 */
public FilteredGraphiteReporter(MetricsRegistry metricsRegistry,String prefix,MetricPredicate predicate,EnumSet<Dimension> dimensions,SocketProvider socketProvider,Clock clock) throws IOException {
  super(metricsRegistry,prefix,predicate,socketProvider,clock);
  this.dimensions=dimensions;
  LOGGER.debug("String_Node_Str",dimensions);
}
Program: 80039
Project: 80039
Buggy source:
private static void processEvent3(String raw){
  Optional<RawEvent> rawEvent=RawEvent.parse(raw);
  rawEvent.ifPresent(r -> {
    String[] conditions={};
    EnrichedEvent enriched=new EnrichedEvent(r,20.0d,conditions);
    System.out.println(enriched.asJson());
  }
);
}

Fixed version (ground truth):
private static void processEvent3(String raw){
  Optional<RawEvent> rawEvent=RawEvent.parse(raw);
  rawEvent.ifPresent(r -> {
    List<String> conditions=new ArrayList<String>();
    EnrichedEvent enriched=new EnrichedEvent(r,20.0d,conditions);
    System.out.println(enriched.asJson());
  }
);
}
Program: 80040
Project: 80040
Buggy source:
protected <T>T readObject(JsonReaderI<T> mapper) throws ParseException, IOException {
  if (c != '{')   throw new RuntimeException("String_Node_Str");
  Object current=mapper.createObject();
  boolean needData=false;
  boolean acceptData=true;
  for (; ; ) {
    read();
switch (c) {
case ' ':
case '\r':
case '\t':
case '\n':
      continue;
case ':':
case ']':
case '[':
case '{':
    throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,c);
case '}':
  if (needData && !acceptUselessComma)   throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
read();
return mapper.convert(current);
case ',':
if (needData && !acceptUselessComma) throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
acceptData=needData=true;
continue;
case '"':
case '\'':
default :
if (c == '\"' || c == '\'') {
readString();
}
 else {
readNQString(stopKey);
if (!acceptNonQuote) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,xs);
}
String key=xs;
if (!acceptData) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,key);
skipSpace();
if (c != ':') {
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
throw new ParseException(pos - 1,ERROR_UNEXPECTED_CHAR,c);
}
readNoEnd();
lastKey=key;
Object value=readMain(mapper,stopValue);
mapper.setValue(current,key,value);
lastKey=null;
if (c == '}') {
read();
return mapper.convert(current);
}
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
if (c == ',') acceptData=needData=true;
 else acceptData=needData=false;
continue;
}
}
}

Fixed version (ground truth):
protected <T>T readObject(JsonReaderI<T> mapper) throws ParseException, IOException {
  if (c != '{')   throw new RuntimeException("String_Node_Str");
  Object current=mapper.createObject();
  boolean needData=false;
  boolean acceptData=true;
  for (; ; ) {
    read();
switch (c) {
case ' ':
case '\r':
case '\t':
case '\n':
      continue;
case ':':
case ']':
case '[':
case '{':
    throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,c);
case '}':
  if (needData && !acceptUselessComma)   throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
read();
return mapper.convert(current);
case ',':
if (needData && !acceptUselessComma) throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
acceptData=needData=true;
continue;
case '"':
case '\'':
default :
if (c == '\"' || c == '\'') {
readString();
}
 else {
readNQString(stopKey);
if (!acceptNonQuote) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,xs);
}
String key=xs;
if (!acceptData) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,key);
skipSpace();
if (c != ':') {
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
throw new ParseException(pos - 1,ERROR_UNEXPECTED_CHAR,c);
}
readNoEnd();
lastKey=key;
Object value=readMain(mapper,stopValue);
mapper.setValue(current,key,value);
lastKey=null;
skipSpace();
if (c == '}') {
read();
return mapper.convert(current);
}
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
if (c == ',') acceptData=needData=true;
 else throw new ParseException(pos - 1,ERROR_UNEXPECTED_TOKEN,c);
}
}
}
Program: 80041
Project: 80041
Buggy source:
public boolean mustBeProtect(final String s){
  if (s == null)   return false;
  int len=s.length();
  if (len == 0)   return true;
  if (s.trim() != s)   return true;
  char ch=s.charAt(0);
  if (isSpecial(ch) || isUnicode(ch))   return true;
  for (int i=1; i < len; i++) {
    ch=s.charAt(i);
    if (isSpecialClose(ch) || isUnicode(ch))     return true;
  }
  if (isKeyword(s))   return true;
  ch=s.charAt(0);
  if (ch >= '0' && ch <= '9' || ch == '-') {
    int p=1;
    for (; p < len; p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == len)     return true;
    if (ch == '.') {
      p++;
      for (; p < len; p++) {
        ch=s.charAt(p);
        if (ch < '0' || ch > '9')         break;
      }
    }
    if (p == len)     return true;
    if (ch != 'E' || ch != 'e')     return false;
    p++;
    if (p == len)     return false;
    ch=s.charAt(p);
    if (ch == '+' || ch == '-') {
      ch++;
      if (p == len)       return false;
      ch=s.charAt(p);
    }
    if (ch == '+' || ch == '-') {
      ch++;
      if (p == len)       return false;
    }
    for (; p < len; p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == len)     return true;
    return false;
  }
  return false;
}

Fixed version (ground truth):
public boolean mustBeProtect(final String s){
  if (s == null)   return false;
  int len=s.length();
  if (len == 0)   return true;
  if (s.trim() != s)   return true;
  char ch=s.charAt(0);
  if (isSpecial(ch) || isUnicode(ch))   return true;
  for (int i=1; i < len; i++) {
    ch=s.charAt(i);
    if (isSpecialClose(ch) || isUnicode(ch))     return true;
  }
  if (isKeyword(s))   return true;
  ch=s.charAt(0);
  if (ch >= '0' && ch <= '9' || ch == '-') {
    int p=1;
    for (; p < len; p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == len)     return true;
    if (ch == '.') {
      p++;
    }
    for (; p < len; p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == len)     return true;
    if (ch == 'E' || ch == 'e') {
      p++;
      if (p == len)       return false;
      ch=s.charAt(p);
      if (ch == '+' || ch == '-') {
        p++;
        ch=s.charAt(p);
      }
    }
    if (p == len)     return false;
    for (; p < len; p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == len)     return true;
    return false;
  }
  return false;
}
Program: 80042
Project: 80042
Buggy source:
public static void testInvalidJson(String json,int permissifMode,int execptionType,Class<?> cls) throws Exception {
  JSONParser p=new JSONParser(execptionType);
  try {
    if (cls == null)     p.parse(json);
 else     p.parse(json,cls);
    TestCase.assertFalse("String_Node_Str" + json,true);
  }
 catch (  ParseException e) {
    if (execptionType == -1)     execptionType=e.getErrorType();
    TestCase.assertEquals(execptionType,e.getErrorType());
  }
}

Fixed version (ground truth):
public static void testInvalidJson(String json,int permissifMode,int execptionType,Class<?> cls) throws Exception {
  JSONParser p=new JSONParser(permissifMode);
  try {
    if (cls == null)     p.parse(json);
 else     p.parse(json,cls);
    TestCase.assertFalse("String_Node_Str" + json,true);
  }
 catch (  ParseException e) {
    if (execptionType == -1)     execptionType=e.getErrorType();
    TestCase.assertEquals(execptionType,e.getErrorType());
  }
}
Program: 80043
Project: 80043
Buggy source:
/** 
 * called when json-smart done parssing a value
 */
public void setValue(Object current,String key,Object value) throws ParseException, IOException {
  throw new RuntimeException(ERR_MSG);
}

Fixed version (ground truth):
/** 
 * called when json-smart done parsing a value
 */
public void setValue(Object current,String key,Object value) throws ParseException, IOException {
  throw new RuntimeException(ERR_MSG);
}
Program: 80044
Project: 80044
Buggy source:
/** 
 * called when json-smart done parssing a value
 */
public void setValue(Object current,String key,Object value) throws ParseException, IOException {
  mapper.setValue(current,key,value);
}

Fixed version (ground truth):
/** 
 * called when json-smart done parsing a value
 */
public void setValue(Object current,String key,Object value) throws ParseException, IOException {
  mapper.setValue(current,key,value);
}
Program: 80045
Project: 80045
Buggy source:
protected <T>T readObject(AMapper<T> mapper) throws ParseException, IOException {
  if (c != '{')   throw new RuntimeException("String_Node_Str");
  Object current=mapper.createObject();
  boolean needData=false;
  boolean acceptData=true;
  for (; ; ) {
    read();
switch (c) {
case ' ':
case '\r':
case '\t':
case '\n':
      continue;
case ':':
case ']':
case '[':
case '{':
    throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,c);
case '}':
  if (needData && !acceptUselessComma)   throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
read();
return mapper.convert(current);
case ',':
if (needData && !acceptUselessComma) throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
acceptData=needData=true;
continue;
case '"':
case '\'':
default :
if (c == '\"' || c == '\'') {
readString();
}
 else {
readNQString(stopKey);
if (!acceptNonQuote) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,xs);
}
String key=xs;
if (!acceptData) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,key);
while (c != ':' && c != EOI) {
read();
}
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
readNoEnd();
lastKey=key;
Object value=readMain(mapper,stopValue);
mapper.setValue(current,key,value);
lastKey=null;
if (c == '}') {
read();
return mapper.convert(current);
}
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
if (c == ',') acceptData=needData=true;
 else acceptData=needData=false;
continue;
}
}
}

Fixed version (ground truth):
protected <T>T readObject(AMapper<T> mapper) throws ParseException, IOException {
  if (c != '{')   throw new RuntimeException("String_Node_Str");
  Object current=mapper.createObject();
  boolean needData=false;
  boolean acceptData=true;
  for (; ; ) {
    read();
switch (c) {
case ' ':
case '\r':
case '\t':
case '\n':
      continue;
case ':':
case ']':
case '[':
case '{':
    throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,c);
case '}':
  if (needData && !acceptUselessComma)   throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
read();
return mapper.convert(current);
case ',':
if (needData && !acceptUselessComma) throw new ParseException(pos,ERROR_UNEXPECTED_CHAR,(char)c);
acceptData=needData=true;
continue;
case '"':
case '\'':
default :
if (c == '\"' || c == '\'') {
readString();
}
 else {
readNQString(stopKey);
if (!acceptNonQuote) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,xs);
}
String key=xs;
if (!acceptData) throw new ParseException(pos,ERROR_UNEXPECTED_TOKEN,key);
skipSpace();
if (c != ':') {
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
throw new ParseException(pos - 1,ERROR_UNEXPECTED_CHAR,c);
}
readNoEnd();
lastKey=key;
Object value=readMain(mapper,stopValue);
mapper.setValue(current,key,value);
lastKey=null;
if (c == '}') {
read();
return mapper.convert(current);
}
if (c == EOI) throw new ParseException(pos - 1,ERROR_UNEXPECTED_EOF,null);
if (c == ',') acceptData=needData=true;
 else acceptData=needData=false;
continue;
}
}
}
Program: 80046
Project: 80046
Buggy source:
/** 
 * Same as read() in memory parssing
 */
protected void readS(){
  if (++pos >= len)   this.c=EOI;
 else   this.c=(char)in[pos];
}

Fixed version (ground truth):
/** 
 * Same as read() in memory parsing
 */
protected void readS(){
  if (++pos >= len)   this.c=EOI;
 else   this.c=(char)in[pos];
}
Program: 80047
Project: 80047
Buggy source:
protected void read(){
  if (++pos >= len)   this.c=EOI;
 else   this.c=in.charAt(pos);
}

Fixed version (ground truth):
/** 
 * Read next char or END OF INPUT
 */
protected void read(){
  if (++pos >= len)   this.c=EOI;
 else   this.c=in.charAt(pos);
}
Program: 80048
Project: 80048
Buggy source:
/** 
 * Same as read() in memory parssing
 */
protected void readS(){
  if (++pos >= len)   this.c=EOI;
 else   this.c=in.charAt(pos);
}

Fixed version (ground truth):
/** 
 * Same as read() in memory parsing
 */
protected void readS(){
  if (++pos >= len)   this.c=EOI;
 else   this.c=in.charAt(pos);
}
Program: 80049
Project: 80049
Buggy source:
public boolean mustBeProtect(String s){
  if (s == null)   return false;
  int len=s.length();
  if (len == 0)   return true;
  if (s.trim() != s)   return true;
  char ch=s.charAt(0);
  if (isSpecial(ch) || isUnicode(ch))   return true;
  for (int i=1; i < len; i++) {
    ch=s.charAt(i);
    if (isSpecialClose(ch) || isUnicode(ch))     return true;
  }
  if (isKeyword(s))   return true;
  ch=s.charAt(0);
  if (ch >= '0' && ch <= '9' || ch == '-') {
    int p=1;
    for (; p < s.length(); p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == s.length())     return true;
    if (ch == '.') {
      p++;
      for (; p < s.length(); p++) {
        ch=s.charAt(p);
        if (ch < '0' || ch > '9')         break;
      }
    }
    if (p == s.length())     return true;
    if (ch != 'E' || ch != 'e')     return false;
    p++;
    if (p == s.length())     return false;
    ch=s.charAt(p);
    if (ch == '+' || ch == '-') {
      ch++;
      if (p == s.length())       return false;
      ch=s.charAt(p);
    }
    if (ch == '+' || ch == '-') {
      ch++;
      if (p == s.length())       return false;
    }
    for (; p < s.length(); p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == s.length())     return true;
    return false;
  }
  return false;
}

Fixed version (ground truth):
public boolean mustBeProtect(final String s){
  if (s == null)   return false;
  int len=s.length();
  if (len == 0)   return true;
  if (s.trim() != s)   return true;
  char ch=s.charAt(0);
  if (isSpecial(ch) || isUnicode(ch))   return true;
  for (int i=1; i < len; i++) {
    ch=s.charAt(i);
    if (isSpecialClose(ch) || isUnicode(ch))     return true;
  }
  if (isKeyword(s))   return true;
  ch=s.charAt(0);
  if (ch >= '0' && ch <= '9' || ch == '-') {
    int p=1;
    for (; p < len; p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == len)     return true;
    if (ch == '.') {
      p++;
      for (; p < len; p++) {
        ch=s.charAt(p);
        if (ch < '0' || ch > '9')         break;
      }
    }
    if (p == len)     return true;
    if (ch != 'E' || ch != 'e')     return false;
    p++;
    if (p == len)     return false;
    ch=s.charAt(p);
    if (ch == '+' || ch == '-') {
      ch++;
      if (p == len)       return false;
      ch=s.charAt(p);
    }
    if (ch == '+' || ch == '-') {
      ch++;
      if (p == len)       return false;
    }
    for (; p < len; p++) {
      ch=s.charAt(p);
      if (ch < '0' || ch > '9')       break;
    }
    if (p == len)     return true;
    return false;
  }
  return false;
}