nus-yam/ex-repair huggingface dataset:
Program: 41132
Project: 41132
Buggy source:
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}

Fixed version (ground truth):
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    final int startPos=pos;
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9 || startPos != pos) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}
Program: 41134
Project: 41134
Buggy source:
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}

Fixed version (ground truth):
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    final int startPos=pos;
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9 || startPos != pos) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}
Program: 41135
Project: 41135
Buggy source:
@Override public Parcelable onSaveInstanceState(){
  dismissPopup();
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  boolean haveChildren=getChildCount() > 0;
  long selectedId=getSelectedItemId();
  ss.selectedId=selectedId;
  ss.height=getHeight();
  if (selectedId >= 0) {
    ss.viewTop=mSelectedTop;
    ss.position=getSelectedItemPosition();
    ss.firstId=INVALID_POSITION;
  }
 else {
    if (haveChildren) {
      View v=getChildAt(0);
      ss.viewTop=v.getTop();
      ss.position=mFirstPosition;
      ss.firstId=mAdapter.getItemId(mFirstPosition);
    }
 else {
      ss.viewTop=0;
      ss.firstId=INVALID_POSITION;
      ss.position=0;
    }
  }
  ss.filter=null;
  if (mFiltered) {
    final EditText textFilter=mTextFilter;
    if (textFilter != null) {
      Editable filterText=textFilter.getText();
      if (filterText != null) {
        ss.filter=filterText.toString();
      }
    }
  }
  return ss;
}

Fixed version (ground truth):
@Override public Parcelable onSaveInstanceState(){
  dismissPopup();
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  boolean haveChildren=getChildCount() > 0 && mItemCount > 0;
  long selectedId=getSelectedItemId();
  ss.selectedId=selectedId;
  ss.height=getHeight();
  if (selectedId >= 0) {
    ss.viewTop=mSelectedTop;
    ss.position=getSelectedItemPosition();
    ss.firstId=INVALID_POSITION;
  }
 else {
    if (haveChildren) {
      View v=getChildAt(0);
      ss.viewTop=v.getTop();
      int firstPos=mFirstPosition;
      if (firstPos >= mItemCount) {
        firstPos=mItemCount - 1;
      }
      ss.position=firstPos;
      ss.firstId=mAdapter.getItemId(firstPos);
    }
 else {
      ss.viewTop=0;
      ss.firstId=INVALID_POSITION;
      ss.position=0;
    }
  }
  ss.filter=null;
  if (mFiltered) {
    final EditText textFilter=mTextFilter;
    if (textFilter != null) {
      Editable filterText=textFilter.getText();
      if (filterText != null) {
        ss.filter=filterText.toString();
      }
    }
  }
  return ss;
}
Program: 41137
Project: 41137
Buggy source:
/** 
 * Lists all the installed packages.
 */
private void runListPackages(boolean showApplicationPackage){
  try {
    String opt;
    while ((opt=nextOption()) != null) {
      if (opt.equals("String_Node_Str")) {
      }
 else       if (opt.equals("String_Node_Str")) {
        showApplicationPackage=true;
      }
 else       if (opt.equals("String_Node_Str")) {
        showApplicationPackage=true;
      }
 else {
        System.err.println("String_Node_Str" + opt);
        showUsage();
        return;
      }
    }
  }
 catch (  RuntimeException ex) {
    System.err.println("String_Node_Str" + ex.toString());
    showUsage();
    return;
  }
  try {
    List<PackageInfo> packages=mPm.getInstalledPackages(0);
    int count=packages.size();
    for (int p=0; p < count; p++) {
      PackageInfo info=packages.get(p);
      System.out.print("String_Node_Str");
      if (showApplicationPackage) {
        System.out.print(info.applicationInfo.sourceDir);
        System.out.print("String_Node_Str");
      }
      System.out.println(info.packageName);
    }
  }
 catch (  RemoteException e) {
    System.err.println(e.toString());
    System.err.println(PM_NOT_RUNNING_ERR);
  }
}

Fixed version (ground truth):
/** 
 * Lists all the installed packages.
 */
private void runListPackages(boolean showApplicationPackage){
  int getFlags=0;
  boolean listDisabled=false, listEnabled=false;
  try {
    String opt;
    while ((opt=nextOption()) != null) {
      if (opt.equals("String_Node_Str")) {
      }
 else       if (opt.equals("String_Node_Str")) {
        showApplicationPackage=true;
      }
 else       if (opt.equals("String_Node_Str")) {
        showApplicationPackage=true;
      }
 else       if (opt.equals("String_Node_Str")) {
        listDisabled=true;
      }
 else       if (opt.equals("String_Node_Str")) {
        listEnabled=true;
      }
 else       if (opt.equals("String_Node_Str")) {
        getFlags|=PackageManager.GET_UNINSTALLED_PACKAGES;
      }
 else {
        System.err.println("String_Node_Str" + opt);
        showUsage();
        return;
      }
    }
  }
 catch (  RuntimeException ex) {
    System.err.println("String_Node_Str" + ex.toString());
    showUsage();
    return;
  }
  String filter=nextArg();
  try {
    List<PackageInfo> packages=mPm.getInstalledPackages(getFlags);
    int count=packages.size();
    for (int p=0; p < count; p++) {
      PackageInfo info=packages.get(p);
      if (filter != null && !info.packageName.contains(filter)) {
        continue;
      }
      if ((!listDisabled || !info.applicationInfo.enabled) && (!listEnabled || info.applicationInfo.enabled)) {
        System.out.print("String_Node_Str");
        if (showApplicationPackage) {
          System.out.print(info.applicationInfo.sourceDir);
          System.out.print("String_Node_Str");
        }
        System.out.println(info.packageName);
      }
    }
  }
 catch (  RemoteException e) {
    System.err.println(e.toString());
    System.err.println(PM_NOT_RUNNING_ERR);
  }
}
Program: 41138
Project: 41138
Buggy source:
/** 
 * Execute the list sub-command. pm list [package | packages] pm list permission-groups pm list permissions pm list features pm list instrumentation
 */
private void runList(){
  String type=nextArg();
  if (type == null) {
    System.err.println("String_Node_Str");
    showUsage();
    return;
  }
  if ("String_Node_Str".equals(type) || "String_Node_Str".equals(type)) {
    runListPackages(false);
  }
 else   if ("String_Node_Str".equals(type)) {
    runListPermissionGroups();
  }
 else   if ("String_Node_Str".equals(type)) {
    runListPermissions();
  }
 else   if ("String_Node_Str".equals(type)) {
    runListFeatures();
  }
 else   if ("String_Node_Str".equals(type)) {
    runListInstrumentation();
  }
 else {
    System.err.println("String_Node_Str" + type + "String_Node_Str");
    showUsage();
  }
}

Fixed version (ground truth):
/** 
 * Execute the list sub-command. pm list [package | packages] pm list permission-groups pm list permissions pm list features pm list libraries pm list instrumentation
 */
private void runList(){
  String type=nextArg();
  if (type == null) {
    System.err.println("String_Node_Str");
    showUsage();
    return;
  }
  if ("String_Node_Str".equals(type) || "String_Node_Str".equals(type)) {
    runListPackages(false);
  }
 else   if ("String_Node_Str".equals(type)) {
    runListPermissionGroups();
  }
 else   if ("String_Node_Str".equals(type)) {
    runListPermissions();
  }
 else   if ("String_Node_Str".equals(type)) {
    runListFeatures();
  }
 else   if ("String_Node_Str".equals(type)) {
    runListLibraries();
  }
 else   if ("String_Node_Str".equals(type)) {
    runListInstrumentation();
  }
 else {
    System.err.println("String_Node_Str" + type + "String_Node_Str");
    showUsage();
  }
}
Program: 41141
Project: 41141
Buggy source:
@SuppressWarnings("String_Node_Str") public void dumpCheckinLocked(PrintWriter pw,String[] args){
  boolean isUnpluggedOnly=false;
  for (  String arg : args) {
    if ("String_Node_Str".equals(arg)) {
      if (LOCAL_LOGV)       Log.v("String_Node_Str","String_Node_Str");
      isUnpluggedOnly=true;
    }
  }
  if (isUnpluggedOnly) {
    dumpCheckinLocked(pw,STATS_SINCE_UNPLUGGED,-1);
  }
 else {
    dumpCheckinLocked(pw,STATS_SINCE_CHARGED,-1);
    dumpCheckinLocked(pw,STATS_SINCE_UNPLUGGED,-1);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void dumpCheckinLocked(PrintWriter pw,String[] args,List<ApplicationInfo> apps){
  boolean isUnpluggedOnly=false;
  for (  String arg : args) {
    if ("String_Node_Str".equals(arg)) {
      if (LOCAL_LOGV)       Log.v("String_Node_Str","String_Node_Str");
      isUnpluggedOnly=true;
    }
  }
  if (apps != null) {
    SparseArray<ArrayList<String>> uids=new SparseArray<ArrayList<String>>();
    for (int i=0; i < apps.size(); i++) {
      ApplicationInfo ai=apps.get(i);
      ArrayList<String> pkgs=uids.get(ai.uid);
      if (pkgs == null) {
        pkgs=new ArrayList<String>();
        uids.put(ai.uid,pkgs);
      }
      pkgs.add(ai.packageName);
    }
    SparseArray<? extends Uid> uidStats=getUidStats();
    final int NU=uidStats.size();
    String[] lineArgs=new String[2];
    for (int i=0; i < NU; i++) {
      int uid=uidStats.keyAt(i);
      ArrayList<String> pkgs=uids.get(uid);
      if (pkgs != null) {
        for (int j=0; j < pkgs.size(); j++) {
          lineArgs[0]=Integer.toString(uid);
          lineArgs[1]=pkgs.get(j);
          dumpLine(pw,0,"String_Node_Str",UID_DATA,(Object[])lineArgs);
        }
      }
    }
  }
  if (isUnpluggedOnly) {
    dumpCheckinLocked(pw,STATS_SINCE_UNPLUGGED,-1);
  }
 else {
    dumpCheckinLocked(pw,STATS_SINCE_CHARGED,-1);
    dumpCheckinLocked(pw,STATS_SINCE_UNPLUGGED,-1);
  }
}
Program: 41142
Project: 41142
Buggy source:
private Intent newGrantCredentialsPermissionIntent(Account account,int uid,AccountAuthenticatorResponse response,String authTokenType,String authTokenLabel){
  RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> serviceInfo=mAuthenticatorCache.getServiceInfo(AuthenticatorDescription.newKey(account.type));
  if (serviceInfo == null) {
    throw new IllegalArgumentException("String_Node_Str" + account.type);
  }
  final Context authContext;
  try {
    authContext=mContext.createPackageContext(serviceInfo.type.packageName,0);
  }
 catch (  PackageManager.NameNotFoundException e) {
    throw new IllegalArgumentException("String_Node_Str" + account.type);
  }
  Intent intent=new Intent(mContext,GrantCredentialsPermissionActivity.class);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intent.addCategory(String.valueOf(getCredentialPermissionNotificationId(account,authTokenType,uid)));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_ACCOUNT,account);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_LABEL,authTokenLabel);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_TYPE,authTokenType);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_RESPONSE,response);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_ACCOUNT_TYPE_LABEL,authContext.getString(serviceInfo.type.labelId));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_PACKAGES,mContext.getPackageManager().getPackagesForUid(uid));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_REQUESTING_UID,uid);
  return intent;
}

Fixed version (ground truth):
private Intent newGrantCredentialsPermissionIntent(Account account,int uid,AccountAuthenticatorResponse response,String authTokenType,String authTokenLabel){
  Intent intent=new Intent(mContext,GrantCredentialsPermissionActivity.class);
  intent.addCategory(String.valueOf(getCredentialPermissionNotificationId(account,authTokenType,uid)));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_ACCOUNT,account);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_TYPE,authTokenType);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_RESPONSE,response);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_REQUESTING_UID,uid);
  return intent;
}
Program: 41144
Project: 41144
Buggy source:
public void onClick(View v){
  final AccountManagerService accountManagerService=AccountManagerService.getSingleton();
switch (v.getId()) {
case R.id.allow_button:
    accountManagerService.grantAppPermission(mAccount,mAuthTokenType,mUid);
  Intent result=new Intent();
result.putExtra("String_Node_Str",true);
setResult(RESULT_OK,result);
setAccountAuthenticatorResult(result.getExtras());
break;
case R.id.deny_button:
accountManagerService.revokeAppPermission(mAccount,mAuthTokenType,mUid);
setResult(RESULT_CANCELED);
break;
}
finish();
}

Fixed version (ground truth):
public void onClick(View v){
switch (v.getId()) {
case R.id.allow_button:
    accountManagerService.grantAppPermission(mAccount,mAuthTokenType,mUid);
  Intent result=new Intent();
result.putExtra("String_Node_Str",true);
setResult(RESULT_OK,result);
setAccountAuthenticatorResult(result.getExtras());
break;
case R.id.deny_button:
accountManagerService.revokeAppPermission(mAccount,mAuthTokenType,mUid);
setResult(RESULT_CANCELED);
break;
}
finish();
}
Program: 41145
Project: 41145
Buggy source:
private Intent newGrantCredentialsPermissionIntent(Account account,int uid,AccountAuthenticatorResponse response,String authTokenType,String authTokenLabel){
  RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> serviceInfo=mAuthenticatorCache.getServiceInfo(AuthenticatorDescription.newKey(account.type));
  if (serviceInfo == null) {
    throw new IllegalArgumentException("String_Node_Str" + account.type);
  }
  final Context authContext;
  try {
    authContext=mContext.createPackageContext(serviceInfo.type.packageName,0);
  }
 catch (  PackageManager.NameNotFoundException e) {
    throw new IllegalArgumentException("String_Node_Str" + account.type);
  }
  Intent intent=new Intent(mContext,GrantCredentialsPermissionActivity.class);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intent.addCategory(String.valueOf(getCredentialPermissionNotificationId(account,authTokenType,uid)));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_ACCOUNT,account);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_LABEL,authTokenLabel);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_TYPE,authTokenType);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_RESPONSE,response);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_ACCOUNT_TYPE_LABEL,authContext.getString(serviceInfo.type.labelId));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_PACKAGES,mContext.getPackageManager().getPackagesForUid(uid));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_REQUESTING_UID,uid);
  return intent;
}

Fixed version (ground truth):
private Intent newGrantCredentialsPermissionIntent(Account account,int uid,AccountAuthenticatorResponse response,String authTokenType,String authTokenLabel){
  Intent intent=new Intent(mContext,GrantCredentialsPermissionActivity.class);
  intent.addCategory(String.valueOf(getCredentialPermissionNotificationId(account,authTokenType,uid)));
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_ACCOUNT,account);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_TYPE,authTokenType);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_RESPONSE,response);
  intent.putExtra(GrantCredentialsPermissionActivity.EXTRAS_REQUESTING_UID,uid);
  return intent;
}
Program: 41147
Project: 41147
Buggy source:
public void onClick(View v){
  final AccountManagerService accountManagerService=AccountManagerService.getSingleton();
switch (v.getId()) {
case R.id.allow_button:
    accountManagerService.grantAppPermission(mAccount,mAuthTokenType,mUid);
  Intent result=new Intent();
result.putExtra("String_Node_Str",true);
setResult(RESULT_OK,result);
setAccountAuthenticatorResult(result.getExtras());
break;
case R.id.deny_button:
accountManagerService.revokeAppPermission(mAccount,mAuthTokenType,mUid);
setResult(RESULT_CANCELED);
break;
}
finish();
}

Fixed version (ground truth):
public void onClick(View v){
switch (v.getId()) {
case R.id.allow_button:
    accountManagerService.grantAppPermission(mAccount,mAuthTokenType,mUid);
  Intent result=new Intent();
result.putExtra("String_Node_Str",true);
setResult(RESULT_OK,result);
setAccountAuthenticatorResult(result.getExtras());
break;
case R.id.deny_button:
accountManagerService.revokeAppPermission(mAccount,mAuthTokenType,mUid);
setResult(RESULT_CANCELED);
break;
}
finish();
}
Program: 41148
Project: 41148
Buggy source:
/** 
 * Gets the SIP URI string of this profile.
 * @return the SIP URI string of this profile
 */
public String getUriString(){
  return mAddress.getURI().toString();
}

Fixed version (ground truth):
/** 
 * Gets the SIP URI string of this profile.
 * @return the SIP URI string of this profile
 */
public String getUriString(){
  if (!TextUtils.isEmpty(mProxyAddress)) {
    return "String_Node_Str" + getUserName() + "String_Node_Str"+ mDomain;
  }
  return getUri().toString();
}
Program: 41149
Project: 41149
Buggy source:
/** 
 * Sets the protocol used to connect to the SIP server. Currently, only "UDP" and "TCP" are supported.
 * @param protocol the protocol string
 * @return this builder object
 * @throws IllegalArgumentException if the protocol is not recognized
 */
public Builder setProtocol(String protocol) throws IllegalArgumentException {
  if (protocol == null) {
    throw new NullPointerException("String_Node_Str");
  }
  protocol=protocol.toUpperCase();
  if (!protocol.equals("String_Node_Str") && !protocol.equals("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + protocol);
  }
  mProfile.mProtocol=protocol;
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the protocol used to connect to the SIP server. Currently, only "UDP" and "TCP" are supported.
 * @param protocol the protocol string
 * @return this builder object
 * @throws IllegalArgumentException if the protocol is not recognized
 */
public Builder setProtocol(String protocol) throws IllegalArgumentException {
  if (protocol == null) {
    throw new NullPointerException("String_Node_Str");
  }
  protocol=protocol.toUpperCase();
  if (!protocol.equals(UDP) && !protocol.equals(TCP)) {
    throw new IllegalArgumentException("String_Node_Str" + protocol);
  }
  mProfile.mProtocol=protocol;
  return this;
}
Program: 41150
Project: 41150
Buggy source:
/** 
 * Sets the port number of the server. By default, it is 5060.
 * @param port port number of the server
 * @return this builder object
 * @throws IllegalArgumentException if the port number is out of range
 */
public Builder setPort(int port) throws IllegalArgumentException {
  try {
    mUri.setPort(port);
    return this;
  }
 catch (  InvalidArgumentException e) {
    throw new IllegalArgumentException(e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the port number of the server. By default, it is 5060.
 * @param port port number of the server
 * @return this builder object
 * @throws IllegalArgumentException if the port number is out of range
 */
public Builder setPort(int port) throws IllegalArgumentException {
  if ((port > 65535) || (port < 1000)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mProfile.mPort=port;
  return this;
}
Program: 41151
Project: 41151
Buggy source:
private SipProfile(Parcel in){
  mAddress=(Address)in.readSerializable();
  mProxyAddress=in.readString();
  mPassword=in.readString();
  mDomain=in.readString();
  mProtocol=in.readString();
  mProfileName=in.readString();
  mSendKeepAlive=(in.readInt() == 0) ? false : true;
  mAutoRegistration=(in.readInt() == 0) ? false : true;
  mCallingUid=in.readInt();
}

Fixed version (ground truth):
private SipProfile(Parcel in){
  mAddress=(Address)in.readSerializable();
  mProxyAddress=in.readString();
  mPassword=in.readString();
  mDomain=in.readString();
  mProtocol=in.readString();
  mProfileName=in.readString();
  mSendKeepAlive=(in.readInt() == 0) ? false : true;
  mAutoRegistration=(in.readInt() == 0) ? false : true;
  mCallingUid=in.readInt();
  mPort=in.readInt();
}
Program: 41152
Project: 41152
Buggy source:
/** 
 * Gets the port number of the SIP server.
 * @return the port number of the SIP server
 */
public int getPort(){
  int port=getUri().getPort();
  return (port == -1) ? DEFAULT_PORT : port;
}

Fixed version (ground truth):
/** 
 * Gets the port number of the SIP server.
 * @return the port number of the SIP server
 */
public int getPort(){
  return mPort;
}
Program: 41153
Project: 41153
Buggy source:
/** 
 * Builds and returns the SIP profile object.
 * @return the profile object created
 */
public SipProfile build(){
  mProfile.mPassword=mUri.getUserPassword();
  mUri.setUserPassword(null);
  try {
    mProfile.mAddress=mAddressFactory.createAddress(mDisplayName,mUri);
    if (!TextUtils.isEmpty(mProxyAddress)) {
      SipURI uri=(SipURI)mAddressFactory.createURI(fix(mProxyAddress));
      mProfile.mProxyAddress=uri.getHost();
    }
  }
 catch (  ParseException e) {
    throw new RuntimeException(e);
  }
  return mProfile;
}

Fixed version (ground truth):
/** 
 * Builds and returns the SIP profile object.
 * @return the profile object created
 */
public SipProfile build(){
  mProfile.mPassword=mUri.getUserPassword();
  mUri.setUserPassword(null);
  try {
    if (!TextUtils.isEmpty(mProxyAddress)) {
      SipURI uri=(SipURI)mAddressFactory.createURI(fix(mProxyAddress));
      mProfile.mProxyAddress=uri.getHost();
    }
 else {
      if (!mProfile.mProtocol.equals(UDP)) {
        mUri.setTransportParam(mProfile.mProtocol);
      }
      if (mProfile.mPort != DEFAULT_PORT) {
        mUri.setPort(mProfile.mPort);
      }
    }
    mProfile.mAddress=mAddressFactory.createAddress(mDisplayName,mUri);
  }
 catch (  InvalidArgumentException e) {
    throw new RuntimeException(e);
  }
catch (  ParseException e) {
    throw new RuntimeException(e);
  }
  return mProfile;
}
Program: 41154
Project: 41154
Buggy source:
@Override public void writeToParcel(Parcel out,int flags){
  out.writeSerializable(mAddress);
  out.writeString(mProxyAddress);
  out.writeString(mPassword);
  out.writeString(mDomain);
  out.writeString(mProtocol);
  out.writeString(mProfileName);
  out.writeInt(mSendKeepAlive ? 1 : 0);
  out.writeInt(mAutoRegistration ? 1 : 0);
  out.writeInt(mCallingUid);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel out,int flags){
  out.writeSerializable(mAddress);
  out.writeString(mProxyAddress);
  out.writeString(mPassword);
  out.writeString(mDomain);
  out.writeString(mProtocol);
  out.writeString(mProfileName);
  out.writeInt(mSendKeepAlive ? 1 : 0);
  out.writeInt(mAutoRegistration ? 1 : 0);
  out.writeInt(mCallingUid);
  out.writeInt(mPort);
}
Program: 41155
Project: 41155
Buggy source:
private Request createRequest(String requestType,SipProfile userProfile,String tag) throws ParseException, SipException {
  FromHeader fromHeader=createFromHeader(userProfile,tag);
  ToHeader toHeader=createToHeader(userProfile);
  SipURI requestURI=mAddressFactory.createSipURI("String_Node_Str" + userProfile.getSipDomain());
  List<ViaHeader> viaHeaders=createViaHeaders();
  CallIdHeader callIdHeader=createCallIdHeader();
  CSeqHeader cSeqHeader=createCSeqHeader(requestType);
  MaxForwardsHeader maxForwards=createMaxForwardsHeader();
  Request request=mMessageFactory.createRequest(requestURI,requestType,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwards);
  Header userAgentHeader=mHeaderFactory.createHeader("String_Node_Str","String_Node_Str");
  request.addHeader(userAgentHeader);
  return request;
}

Fixed version (ground truth):
private Request createRequest(String requestType,SipProfile userProfile,String tag) throws ParseException, SipException {
  FromHeader fromHeader=createFromHeader(userProfile,tag);
  ToHeader toHeader=createToHeader(userProfile);
  SipURI requestURI=mAddressFactory.createSipURI(userProfile.getUriString().replaceFirst(userProfile.getUserName() + "String_Node_Str","String_Node_Str"));
  List<ViaHeader> viaHeaders=createViaHeaders();
  CallIdHeader callIdHeader=createCallIdHeader();
  CSeqHeader cSeqHeader=createCSeqHeader(requestType);
  MaxForwardsHeader maxForwards=createMaxForwardsHeader();
  Request request=mMessageFactory.createRequest(requestURI,requestType,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwards);
  Header userAgentHeader=mHeaderFactory.createHeader("String_Node_Str","String_Node_Str");
  request.addHeader(userAgentHeader);
  return request;
}
Program: 41156
Project: 41156
Buggy source:
/** 
 * Gets the SIP URI string of this profile.
 * @return the SIP URI string of this profile
 */
public String getUriString(){
  return mAddress.getURI().toString();
}

Fixed version (ground truth):
/** 
 * Gets the SIP URI string of this profile.
 * @return the SIP URI string of this profile
 */
public String getUriString(){
  if (!TextUtils.isEmpty(mProxyAddress)) {
    return "String_Node_Str" + getUserName() + "String_Node_Str"+ mDomain;
  }
  return getUri().toString();
}
Program: 41157
Project: 41157
Buggy source:
/** 
 * Sets the protocol used to connect to the SIP server. Currently, only "UDP" and "TCP" are supported.
 * @param protocol the protocol string
 * @return this builder object
 * @throws IllegalArgumentException if the protocol is not recognized
 */
public Builder setProtocol(String protocol) throws IllegalArgumentException {
  if (protocol == null) {
    throw new NullPointerException("String_Node_Str");
  }
  protocol=protocol.toUpperCase();
  if (!protocol.equals("String_Node_Str") && !protocol.equals("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + protocol);
  }
  mProfile.mProtocol=protocol;
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the protocol used to connect to the SIP server. Currently, only "UDP" and "TCP" are supported.
 * @param protocol the protocol string
 * @return this builder object
 * @throws IllegalArgumentException if the protocol is not recognized
 */
public Builder setProtocol(String protocol) throws IllegalArgumentException {
  if (protocol == null) {
    throw new NullPointerException("String_Node_Str");
  }
  protocol=protocol.toUpperCase();
  if (!protocol.equals(UDP) && !protocol.equals(TCP)) {
    throw new IllegalArgumentException("String_Node_Str" + protocol);
  }
  mProfile.mProtocol=protocol;
  return this;
}
Program: 41158
Project: 41158
Buggy source:
/** 
 * Sets the port number of the server. By default, it is 5060.
 * @param port port number of the server
 * @return this builder object
 * @throws IllegalArgumentException if the port number is out of range
 */
public Builder setPort(int port) throws IllegalArgumentException {
  try {
    mUri.setPort(port);
    return this;
  }
 catch (  InvalidArgumentException e) {
    throw new IllegalArgumentException(e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the port number of the server. By default, it is 5060.
 * @param port port number of the server
 * @return this builder object
 * @throws IllegalArgumentException if the port number is out of range
 */
public Builder setPort(int port) throws IllegalArgumentException {
  if ((port > 65535) || (port < 1000)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mProfile.mPort=port;
  return this;
}
Program: 41159
Project: 41159
Buggy source:
private SipProfile(Parcel in){
  mAddress=(Address)in.readSerializable();
  mProxyAddress=in.readString();
  mPassword=in.readString();
  mDomain=in.readString();
  mProtocol=in.readString();
  mProfileName=in.readString();
  mSendKeepAlive=(in.readInt() == 0) ? false : true;
  mAutoRegistration=(in.readInt() == 0) ? false : true;
  mCallingUid=in.readInt();
}

Fixed version (ground truth):
private SipProfile(Parcel in){
  mAddress=(Address)in.readSerializable();
  mProxyAddress=in.readString();
  mPassword=in.readString();
  mDomain=in.readString();
  mProtocol=in.readString();
  mProfileName=in.readString();
  mSendKeepAlive=(in.readInt() == 0) ? false : true;
  mAutoRegistration=(in.readInt() == 0) ? false : true;
  mCallingUid=in.readInt();
  mPort=in.readInt();
}
Program: 41160
Project: 41160
Buggy source:
/** 
 * Gets the port number of the SIP server.
 * @return the port number of the SIP server
 */
public int getPort(){
  int port=getUri().getPort();
  return (port == -1) ? DEFAULT_PORT : port;
}

Fixed version (ground truth):
/** 
 * Gets the port number of the SIP server.
 * @return the port number of the SIP server
 */
public int getPort(){
  return mPort;
}
Program: 41161
Project: 41161
Buggy source:
/** 
 * Builds and returns the SIP profile object.
 * @return the profile object created
 */
public SipProfile build(){
  mProfile.mPassword=mUri.getUserPassword();
  mUri.setUserPassword(null);
  try {
    mProfile.mAddress=mAddressFactory.createAddress(mDisplayName,mUri);
    if (!TextUtils.isEmpty(mProxyAddress)) {
      SipURI uri=(SipURI)mAddressFactory.createURI(fix(mProxyAddress));
      mProfile.mProxyAddress=uri.getHost();
    }
  }
 catch (  ParseException e) {
    throw new RuntimeException(e);
  }
  return mProfile;
}

Fixed version (ground truth):
/** 
 * Builds and returns the SIP profile object.
 * @return the profile object created
 */
public SipProfile build(){
  mProfile.mPassword=mUri.getUserPassword();
  mUri.setUserPassword(null);
  try {
    if (!TextUtils.isEmpty(mProxyAddress)) {
      SipURI uri=(SipURI)mAddressFactory.createURI(fix(mProxyAddress));
      mProfile.mProxyAddress=uri.getHost();
    }
 else {
      if (!mProfile.mProtocol.equals(UDP)) {
        mUri.setTransportParam(mProfile.mProtocol);
      }
      if (mProfile.mPort != DEFAULT_PORT) {
        mUri.setPort(mProfile.mPort);
      }
    }
    mProfile.mAddress=mAddressFactory.createAddress(mDisplayName,mUri);
  }
 catch (  InvalidArgumentException e) {
    throw new RuntimeException(e);
  }
catch (  ParseException e) {
    throw new RuntimeException(e);
  }
  return mProfile;
}
Program: 41162
Project: 41162
Buggy source:
@Override public void writeToParcel(Parcel out,int flags){
  out.writeSerializable(mAddress);
  out.writeString(mProxyAddress);
  out.writeString(mPassword);
  out.writeString(mDomain);
  out.writeString(mProtocol);
  out.writeString(mProfileName);
  out.writeInt(mSendKeepAlive ? 1 : 0);
  out.writeInt(mAutoRegistration ? 1 : 0);
  out.writeInt(mCallingUid);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel out,int flags){
  out.writeSerializable(mAddress);
  out.writeString(mProxyAddress);
  out.writeString(mPassword);
  out.writeString(mDomain);
  out.writeString(mProtocol);
  out.writeString(mProfileName);
  out.writeInt(mSendKeepAlive ? 1 : 0);
  out.writeInt(mAutoRegistration ? 1 : 0);
  out.writeInt(mCallingUid);
  out.writeInt(mPort);
}
Program: 41163
Project: 41163
Buggy source:
private Request createRequest(String requestType,SipProfile userProfile,String tag) throws ParseException, SipException {
  FromHeader fromHeader=createFromHeader(userProfile,tag);
  ToHeader toHeader=createToHeader(userProfile);
  SipURI requestURI=mAddressFactory.createSipURI("String_Node_Str" + userProfile.getSipDomain());
  List<ViaHeader> viaHeaders=createViaHeaders();
  CallIdHeader callIdHeader=createCallIdHeader();
  CSeqHeader cSeqHeader=createCSeqHeader(requestType);
  MaxForwardsHeader maxForwards=createMaxForwardsHeader();
  Request request=mMessageFactory.createRequest(requestURI,requestType,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwards);
  Header userAgentHeader=mHeaderFactory.createHeader("String_Node_Str","String_Node_Str");
  request.addHeader(userAgentHeader);
  return request;
}

Fixed version (ground truth):
private Request createRequest(String requestType,SipProfile userProfile,String tag) throws ParseException, SipException {
  FromHeader fromHeader=createFromHeader(userProfile,tag);
  ToHeader toHeader=createToHeader(userProfile);
  SipURI requestURI=mAddressFactory.createSipURI(userProfile.getUriString().replaceFirst(userProfile.getUserName() + "String_Node_Str","String_Node_Str"));
  List<ViaHeader> viaHeaders=createViaHeaders();
  CallIdHeader callIdHeader=createCallIdHeader();
  CSeqHeader cSeqHeader=createCSeqHeader(requestType);
  MaxForwardsHeader maxForwards=createMaxForwardsHeader();
  Request request=mMessageFactory.createRequest(requestURI,requestType,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwards);
  Header userAgentHeader=mHeaderFactory.createHeader("String_Node_Str","String_Node_Str");
  request.addHeader(userAgentHeader);
  return request;
}
Program: 41164
Project: 41164
Buggy source:
private void startTextSelectionMode(){
  if (!mIsInTextSelectionMode) {
    if (mSelectionModifierCursorController == null) {
      Log.w(LOG_TAG,"String_Node_Str");
      return;
    }
    if (!requestFocus()) {
      return;
    }
    selectCurrentWord();
    mSelectionModifierCursorController.show();
    mIsInTextSelectionMode=true;
  }
}

Fixed version (ground truth):
private void startTextSelectionMode(){
  if (!mIsInTextSelectionMode) {
    if (!hasSelectionController()) {
      Log.w(LOG_TAG,"String_Node_Str");
      return;
    }
    if (!requestFocus()) {
      return;
    }
    selectCurrentWord();
    mIsInTextSelectionMode=true;
  }
}
Program: 41165
Project: 41165
Buggy source:
public void beginBatchEdit(){
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=++ims.mBatchEditNesting;
    if (nesting == 1) {
      ims.mCursorChanged=false;
      ims.mChangedDelta=0;
      if (ims.mContentChanged) {
        ims.mChangedStart=0;
        ims.mChangedEnd=mText.length();
      }
 else {
        ims.mChangedStart=EXTRACT_UNKNOWN;
        ims.mChangedEnd=EXTRACT_UNKNOWN;
        ims.mContentChanged=false;
      }
      onBeginBatchEdit();
    }
  }
}

Fixed version (ground truth):
public void beginBatchEdit(){
  mInBatchEditControllers=true;
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=++ims.mBatchEditNesting;
    if (nesting == 1) {
      ims.mCursorChanged=false;
      ims.mChangedDelta=0;
      if (ims.mContentChanged) {
        ims.mChangedStart=0;
        ims.mChangedEnd=mText.length();
      }
 else {
        ims.mChangedStart=EXTRACT_UNKNOWN;
        ims.mChangedEnd=EXTRACT_UNKNOWN;
        ims.mContentChanged=false;
      }
      onBeginBatchEdit();
    }
  }
}
Program: 41167
Project: 41167
Buggy source:
private void onTapUpEvent(int prevStart,int prevEnd){
  final int start=getSelectionStart();
  final int end=getSelectionEnd();
  if (start == end) {
    if (start >= prevStart && start < prevEnd) {
      Selection.setSelection((Spannable)mText,prevStart,prevEnd);
      if (mSelectionModifierCursorController != null && !mSelectionModifierCursorController.isShowing()) {
        mSelectionModifierCursorController.show();
      }
 else {
        showContextMenu();
      }
      return;
    }
 else {
      stopTextSelectionMode();
      if (mInsertionPointCursorController != null && mText.length() > 0) {
        mInsertionPointCursorController.show();
      }
    }
  }
 else   if (hasSelection() && mSelectionModifierCursorController != null) {
    mSelectionModifierCursorController.show();
  }
}

Fixed version (ground truth):
private void onTapUpEvent(int prevStart,int prevEnd){
  final int start=getSelectionStart();
  final int end=getSelectionEnd();
  if (start == end) {
    if (start >= prevStart && start < prevEnd) {
      Selection.setSelection((Spannable)mText,prevStart,prevEnd);
      if (hasSelectionController() && !getSelectionController().isShowing()) {
        getSelectionController().show();
      }
 else {
        showContextMenu();
      }
      return;
    }
 else {
      stopTextSelectionMode();
      if (hasInsertionController() && mText.length() > 0) {
        getInsertionController().show();
      }
    }
  }
 else   if (hasSelection() && hasSelectionController()) {
    getSelectionController().show();
  }
}
Program: 41168
Project: 41168
Buggy source:
public void show(){
  mIsShowing=true;
  updatePosition();
  mStartHandle.show();
  mEndHandle.show();
  hideInsertionPointCursorController();
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}

Fixed version (ground truth):
public void show(){
  if (isInBatchEditMode()) {
    return;
  }
  mIsShowing=true;
  updatePosition();
  mStartHandle.show();
  mEndHandle.show();
  hideInsertionPointCursorController();
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}
Program: 41169
Project: 41169
Buggy source:
public void endBatchEdit(){
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=--ims.mBatchEditNesting;
    if (nesting == 0) {
      finishBatchEdit(ims);
    }
  }
}

Fixed version (ground truth):
public void endBatchEdit(){
  mInBatchEditControllers=false;
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=--ims.mBatchEditNesting;
    if (nesting == 0) {
      finishBatchEdit(ims);
    }
  }
}
Program: 41170
Project: 41170
Buggy source:
private void prepareCursorControllers(){
  boolean windowSupportsHandles=false;
  ViewGroup.LayoutParams params=getRootView().getLayoutParams();
  if (params instanceof WindowManager.LayoutParams) {
    WindowManager.LayoutParams windowParams=(WindowManager.LayoutParams)params;
    windowSupportsHandles=windowParams.type < WindowManager.LayoutParams.FIRST_SUB_WINDOW || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
  }
  if (windowSupportsHandles && mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (windowSupportsHandles && textCanBeSelected() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}

Fixed version (ground truth):
private void prepareCursorControllers(){
  boolean windowSupportsHandles=false;
  ViewGroup.LayoutParams params=getRootView().getLayoutParams();
  if (params instanceof WindowManager.LayoutParams) {
    WindowManager.LayoutParams windowParams=(WindowManager.LayoutParams)params;
    windowSupportsHandles=windowParams.type < WindowManager.LayoutParams.FIRST_SUB_WINDOW || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
  }
  mInsertionControllerEnabled=windowSupportsHandles && mCursorVisible && mLayout != null;
  mSelectionControllerEnabled=windowSupportsHandles && textCanBeSelected() && mLayout != null;
  if (!mInsertionControllerEnabled) {
    mInsertionPointCursorController=null;
  }
  if (!mSelectionControllerEnabled) {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}
Program: 41171
Project: 41171
Buggy source:
/** 
 * {@inheritDoc}
 */
public boolean onPreDraw(){
  if (mPreDrawState != PREDRAW_PENDING) {
    return true;
  }
  if (mLayout == null) {
    assumeLayout();
  }
  boolean changed=false;
  SelectionModifierCursorController selectionController=null;
  if (mSelectionModifierCursorController != null) {
    selectionController=(SelectionModifierCursorController)mSelectionModifierCursorController;
  }
  if (mMovement != null) {
    int curs=getSelectionEnd();
    if (selectionController != null && selectionController.isSelectionStartDragged()) {
      curs=getSelectionStart();
    }
    if (curs < 0 && (mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
      curs=mText.length();
    }
    if (curs >= 0) {
      changed=bringPointIntoView(curs);
    }
  }
 else {
    changed=bringTextIntoView();
  }
  if (selectionController != null && hasSelection()) {
    startTextSelectionMode();
  }
  mPreDrawState=PREDRAW_DONE;
  return !changed;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public boolean onPreDraw(){
  if (mPreDrawState != PREDRAW_PENDING) {
    return true;
  }
  if (mLayout == null) {
    assumeLayout();
  }
  boolean changed=false;
  SelectionModifierCursorController selectionController=null;
  if (mSelectionModifierCursorController != null) {
    selectionController=(SelectionModifierCursorController)mSelectionModifierCursorController;
  }
  if (mMovement != null) {
    int curs=getSelectionEnd();
    if (selectionController != null && selectionController.isSelectionStartDragged()) {
      curs=getSelectionStart();
    }
    if (curs < 0 && (mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
      curs=mText.length();
    }
    if (curs >= 0) {
      changed=bringPointIntoView(curs);
    }
  }
 else {
    changed=bringTextIntoView();
  }
  if (this instanceof ExtractEditText && selectionController != null && hasSelection()) {
    startTextSelectionMode();
  }
  mPreDrawState=PREDRAW_DONE;
  return !changed;
}
Program: 41172
Project: 41172
Buggy source:
public void updatePosition(){
  final int selectionStart=getSelectionStart();
  final int selectionEnd=getSelectionEnd();
  if ((selectionStart < 0) || (selectionEnd < 0)) {
    Log.w(LOG_TAG,"String_Node_Str");
    hide();
    return;
  }
  mStartHandle.positionAtCursor(selectionStart,true);
  mEndHandle.positionAtCursor(selectionEnd,true);
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}

Fixed version (ground truth):
public void updatePosition(){
  if (!isShowing()) {
    return;
  }
  final int selectionStart=getSelectionStart();
  final int selectionEnd=getSelectionEnd();
  if ((selectionStart < 0) || (selectionEnd < 0)) {
    Log.w(LOG_TAG,"String_Node_Str");
    hide();
    return;
  }
  mStartHandle.positionAtCursor(selectionStart,true);
  mEndHandle.positionAtCursor(selectionEnd,true);
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}
Program: 41173
Project: 41173
Buggy source:
private boolean isPositionVisible(){
  if (mIsDragging) {
    return true;
  }
  final int extendedPaddingTop=getExtendedPaddingTop();
  final int extendedPaddingBottom=getExtendedPaddingBottom();
  final int compoundPaddingLeft=getCompoundPaddingLeft();
  final int compoundPaddingRight=getCompoundPaddingRight();
  final TextView hostView=TextView.this;
  final int left=0;
  final int right=hostView.getWidth();
  final int top=0;
  final int bottom=hostView.getHeight();
  if (mTempRect == null) {
    mTempRect=new Rect();
  }
  final Rect clip=mTempRect;
  clip.left=left + compoundPaddingLeft;
  clip.top=top + extendedPaddingTop;
  clip.right=right - compoundPaddingRight;
  clip.bottom=bottom - extendedPaddingBottom;
  final ViewParent parent=hostView.getParent();
  if (parent == null || !parent.getChildVisibleRect(hostView,clip,null)) {
    return false;
  }
  final int[] coords=mTempCoords;
  hostView.getLocationInWindow(coords);
  final int posX=coords[0] + mPositionX + (int)mHotspotX;
  final int posY=coords[1] + mPositionY + (int)mHotspotY;
  return posX >= clip.left && posX <= clip.right && posY >= clip.top && posY <= clip.bottom;
}

Fixed version (ground truth):
private boolean isPositionVisible(){
  if (mIsDragging) {
    return true;
  }
  if (isInBatchEditMode()) {
    return false;
  }
  final int extendedPaddingTop=getExtendedPaddingTop();
  final int extendedPaddingBottom=getExtendedPaddingBottom();
  final int compoundPaddingLeft=getCompoundPaddingLeft();
  final int compoundPaddingRight=getCompoundPaddingRight();
  final TextView hostView=TextView.this;
  final int left=0;
  final int right=hostView.getWidth();
  final int top=0;
  final int bottom=hostView.getHeight();
  if (mTempRect == null) {
    mTempRect=new Rect();
  }
  final Rect clip=mTempRect;
  clip.left=left + compoundPaddingLeft;
  clip.top=top + extendedPaddingTop;
  clip.right=right - compoundPaddingRight;
  clip.bottom=bottom - extendedPaddingBottom;
  final ViewParent parent=hostView.getParent();
  if (parent == null || !parent.getChildVisibleRect(hostView,clip,null)) {
    return false;
  }
  final int[] coords=mTempCoords;
  hostView.getLocationInWindow(coords);
  final int posX=coords[0] + mPositionX + (int)mHotspotX;
  final int posY=coords[1] + mPositionY + (int)mHotspotY;
  return posX >= clip.left && posX <= clip.right && posY >= clip.top && posY <= clip.bottom;
}
Program: 41176
Project: 41176
Buggy source:
private void startTextSelectionMode(){
  if (!mIsInTextSelectionMode) {
    if (mSelectionModifierCursorController == null) {
      Log.w(LOG_TAG,"String_Node_Str");
      return;
    }
    if (!requestFocus()) {
      return;
    }
    selectCurrentWord();
    mSelectionModifierCursorController.show();
    mIsInTextSelectionMode=true;
  }
}

Fixed version (ground truth):
private void startTextSelectionMode(){
  if (!mIsInTextSelectionMode) {
    if (!hasSelectionController()) {
      Log.w(LOG_TAG,"String_Node_Str");
      return;
    }
    if (!requestFocus()) {
      return;
    }
    selectCurrentWord();
    mIsInTextSelectionMode=true;
  }
}
Program: 41177
Project: 41177
Buggy source:
public void beginBatchEdit(){
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=++ims.mBatchEditNesting;
    if (nesting == 1) {
      ims.mCursorChanged=false;
      ims.mChangedDelta=0;
      if (ims.mContentChanged) {
        ims.mChangedStart=0;
        ims.mChangedEnd=mText.length();
      }
 else {
        ims.mChangedStart=EXTRACT_UNKNOWN;
        ims.mChangedEnd=EXTRACT_UNKNOWN;
        ims.mContentChanged=false;
      }
      onBeginBatchEdit();
    }
  }
}

Fixed version (ground truth):
public void beginBatchEdit(){
  mInBatchEditControllers=true;
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=++ims.mBatchEditNesting;
    if (nesting == 1) {
      ims.mCursorChanged=false;
      ims.mChangedDelta=0;
      if (ims.mContentChanged) {
        ims.mChangedStart=0;
        ims.mChangedEnd=mText.length();
      }
 else {
        ims.mChangedStart=EXTRACT_UNKNOWN;
        ims.mChangedEnd=EXTRACT_UNKNOWN;
        ims.mContentChanged=false;
      }
      onBeginBatchEdit();
    }
  }
}