nus-yam/ex-repair huggingface dataset:
Program: 182924
Project: 182924
Buggy source:
/** 
 * Construct the display name. The constructed data must not be null.
 */
private void constructDisplayName(){
  if (!TextUtils.isEmpty(mFullName)) {
    mDisplayName=mFullName;
  }
 else   if (!(TextUtils.isEmpty(mFamilyName) && TextUtils.isEmpty(mGivenName))) {
    StringBuilder builder=new StringBuilder();
    List<String> nameList;
switch (VCardConfig.getNameOrderType(mVCardType)) {
case VCardConfig.NAME_ORDER_JAPANESE:
      if (VCardUtils.containsOnlyPrintableAscii(mFamilyName) && VCardUtils.containsOnlyPrintableAscii(mGivenName)) {
        nameList=Arrays.asList(mPrefix,mGivenName,mMiddleName,mFamilyName,mSuffix);
      }
 else {
        nameList=Arrays.asList(mPrefix,mFamilyName,mMiddleName,mGivenName,mSuffix);
      }
    break;
case VCardConfig.NAME_ORDER_EUROPE:
  nameList=Arrays.asList(mPrefix,mMiddleName,mGivenName,mFamilyName,mSuffix);
break;
default :
nameList=Arrays.asList(mPrefix,mGivenName,mMiddleName,mFamilyName,mSuffix);
break;
}
boolean first=true;
for (String namePart : nameList) {
if (!TextUtils.isEmpty(namePart)) {
if (first) {
first=false;
}
 else {
builder.append(' ');
}
builder.append(namePart);
}
}
mDisplayName=builder.toString();
}
 else if (!(TextUtils.isEmpty(mPhoneticFamilyName) && TextUtils.isEmpty(mPhoneticGivenName))) {
mDisplayName=VCardUtils.constructNameFromElements(mVCardType,mPhoneticFamilyName,mPhoneticMiddleName,mPhoneticGivenName);
}
 else if (mEmailList != null && mEmailList.size() > 0) {
mDisplayName=mEmailList.get(0).data;
}
 else if (mPhoneList != null && mPhoneList.size() > 0) {
mDisplayName=mPhoneList.get(0).data;
}
 else if (mPostalList != null && mPostalList.size() > 0) {
mDisplayName=mPostalList.get(0).getFormattedAddress(mVCardType);
}
if (mDisplayName == null) {
mDisplayName="String_Node_Str";
}
}

Fixed version (ground truth):
/** 
 * Construct the display name. The constructed data must not be null.
 */
private void constructDisplayName(){
  if (!TextUtils.isEmpty(mFullName)) {
    mDisplayName=mFullName;
  }
 else   if (!(TextUtils.isEmpty(mFamilyName) && TextUtils.isEmpty(mGivenName))) {
    mDisplayName=VCardUtils.constructNameFromElements(mVCardType,mFamilyName,mMiddleName,mGivenName,mPrefix,mSuffix);
  }
 else   if (!(TextUtils.isEmpty(mPhoneticFamilyName) && TextUtils.isEmpty(mPhoneticGivenName))) {
    mDisplayName=VCardUtils.constructNameFromElements(mVCardType,mPhoneticFamilyName,mPhoneticMiddleName,mPhoneticGivenName);
  }
 else   if (mEmailList != null && mEmailList.size() > 0) {
    mDisplayName=mEmailList.get(0).data;
  }
 else   if (mPhoneList != null && mPhoneList.size() > 0) {
    mDisplayName=mPhoneList.get(0).data;
  }
 else   if (mPostalList != null && mPostalList.size() > 0) {
    mDisplayName=mPostalList.get(0).getFormattedAddress(mVCardType);
  }
  if (mDisplayName == null) {
    mDisplayName="String_Node_Str";
  }
}
Program: 182925
Project: 182925
Buggy source:
/** 
 * Returns true when the property line should contain charset parameter information. This method may return true even when vCard version is 3.0. Strictly, adding charset information is invalid in VCard 3.0. However we'll add the info only when charset we use is not UTF-8 in vCard 3.0 format, since parser side may be able to use the charset via this field, though we may encounter another problem by adding it. e.g. Japanese mobile phones use Shift_Jis while RFC 2426 recommends UTF-8. By adding this field, parsers may be able to know this text is NOT UTF-8 but Shift_Jis.
 */
private boolean shouldAppendCharsetParameter(final String propertyValue){
  return (!VCardUtils.containsOnlyPrintableAscii(propertyValue) && (!mIsV30 || !mUsesUtf8));
}

Fixed version (ground truth):
/** 
 * Returns true when the property line should contain charset parameter information. This method may return true even when vCard version is 3.0. Strictly, adding charset information is invalid in VCard 3.0. However we'll add the info only when charset we use is not UTF-8 in vCard 3.0 format, since parser side may be able to use the charset via this field, though we may encounter another problem by adding it. e.g. Japanese mobile phones use Shift_Jis while RFC 2426 recommends UTF-8. By adding this field, parsers may be able to know this text is NOT UTF-8 but Shift_Jis.
 */
private boolean shouldAppendCharsetParameter(final String propertyValue){
  return (!(mIsV30 && mUsesUtf8) && !VCardUtils.containsOnlyPrintableAscii(propertyValue));
}
Program: 182926
Project: 182926
Buggy source:
private boolean containsNonEmptyName(ContentValues contentValues){
  final String familyName=contentValues.getAsString(StructuredName.FAMILY_NAME);
  final String middleName=contentValues.getAsString(StructuredName.MIDDLE_NAME);
  final String givenName=contentValues.getAsString(StructuredName.GIVEN_NAME);
  final String prefix=contentValues.getAsString(StructuredName.PREFIX);
  final String suffix=contentValues.getAsString(StructuredName.SUFFIX);
  final String displayName=contentValues.getAsString(StructuredName.DISPLAY_NAME);
  return !(TextUtils.isEmpty(familyName) && TextUtils.isEmpty(middleName) && TextUtils.isEmpty(givenName)&& TextUtils.isEmpty(prefix)&& TextUtils.isEmpty(suffix)&& TextUtils.isEmpty(displayName));
}

Fixed version (ground truth):
private boolean containsNonEmptyName(ContentValues contentValues){
  final String familyName=contentValues.getAsString(StructuredName.FAMILY_NAME);
  final String middleName=contentValues.getAsString(StructuredName.MIDDLE_NAME);
  final String givenName=contentValues.getAsString(StructuredName.GIVEN_NAME);
  final String prefix=contentValues.getAsString(StructuredName.PREFIX);
  final String suffix=contentValues.getAsString(StructuredName.SUFFIX);
  final String phoneticFamilyName=contentValues.getAsString(StructuredName.PHONETIC_FAMILY_NAME);
  final String phoneticMiddleName=contentValues.getAsString(StructuredName.PHONETIC_MIDDLE_NAME);
  final String phoneticGivenName=contentValues.getAsString(StructuredName.PHONETIC_GIVEN_NAME);
  final String displayName=contentValues.getAsString(StructuredName.DISPLAY_NAME);
  return !(TextUtils.isEmpty(familyName) && TextUtils.isEmpty(middleName) && TextUtils.isEmpty(givenName)&& TextUtils.isEmpty(prefix)&& TextUtils.isEmpty(suffix)&& TextUtils.isEmpty(phoneticFamilyName)&& TextUtils.isEmpty(phoneticMiddleName)&& TextUtils.isEmpty(phoneticGivenName)&& TextUtils.isEmpty(displayName));
}
Program: 182928
Project: 182928
Buggy source:
public static boolean usesQuotedPrintable(int vcardType){
  return !isV30(vcardType);
}

Fixed version (ground truth):
public static boolean usesQuotedPrintable(final int vcardType){
  return !isV30(vcardType);
}
Program: 182929
Project: 182929
Buggy source:
public static int getVCardTypeFromString(String vcardTypeString){
  String loweredKey=vcardTypeString.toLowerCase();
  if (sVCardTypeMap.containsKey(loweredKey)) {
    return sVCardTypeMap.get(loweredKey);
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str" + vcardTypeString + "String_Node_Str");
    return VCARD_TYPE_DEFAULT;
  }
}

Fixed version (ground truth):
public static int getVCardTypeFromString(final String vcardTypeString){
  final String loweredKey=vcardTypeString.toLowerCase();
  if (sVCardTypeMap.containsKey(loweredKey)) {
    return sVCardTypeMap.get(loweredKey);
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str" + vcardTypeString + "String_Node_Str");
    return VCARD_TYPE_DEFAULT;
  }
}
Program: 182930
Project: 182930
Buggy source:
public static boolean usesAndroidSpecificProperty(int vcardType){
  return ((vcardType & FLAG_USE_ANDROID_PROPERTY) != 0);
}

Fixed version (ground truth):
public static boolean usesAndroidSpecificProperty(final int vcardType){
  return ((vcardType & FLAG_USE_ANDROID_PROPERTY) != 0);
}
Program: 182931
Project: 182931
Buggy source:
public static boolean appendTypeParamName(int vcardType){
  return (isV30(vcardType) || ((vcardType & FLAG_APPEND_TYPE_PARAM) != 0));
}

Fixed version (ground truth):
public static boolean appendTypeParamName(final int vcardType){
  return (isV30(vcardType) || ((vcardType & FLAG_APPEND_TYPE_PARAM) != 0));
}
Program: 182932
Project: 182932
Buggy source:
public static boolean refrainsQPToPrimaryProperties(int vcardType){
  return (!usesQuotedPrintable(vcardType) || ((vcardType & FLAG_REFRAIN_QP_TO_PRIMARY_PROPERTIES) != 0));
}

Fixed version (ground truth):
public static boolean refrainsQPToPrimaryProperties(final int vcardType){
  return (!usesQuotedPrintable(vcardType) || ((vcardType & FLAG_REFRAIN_QP_TO_PRIMARY_PROPERTIES) != 0));
}
Program: 182933
Project: 182933
Buggy source:
public static boolean isDoCoMo(int vcardType){
  return ((vcardType & FLAG_DOCOMO) != 0);
}

Fixed version (ground truth):
public static boolean isDoCoMo(final int vcardType){
  return ((vcardType & FLAG_DOCOMO) != 0);
}
Program: 182934
Project: 182934
Buggy source:
public static boolean usesShiftJis(int vcardType){
  return ((vcardType & FLAG_CHARSET_SHIFT_JIS) != 0);
}

Fixed version (ground truth):
public static boolean usesShiftJis(final int vcardType){
  return ((vcardType & FLAG_CHARSET_MASK) == FLAG_CHARSET_SHIFT_JIS);
}
Program: 182935
Project: 182935
Buggy source:
/** 
 * @return true if the device is Japanese and some Japanese convension isapplied to creating "formatted" something like FORMATTED_ADDRESS.
 */
public static boolean isJapaneseDevice(int vcardType){
  return sJapaneseMobileTypeSet.contains(vcardType);
}

Fixed version (ground truth):
/** 
 * @return true if the device is Japanese and some Japanese convension isapplied to creating "formatted" something like FORMATTED_ADDRESS.
 */
public static boolean isJapaneseDevice(final int vcardType){
  return sJapaneseMobileTypeSet.contains(vcardType);
}
Program: 182936
Project: 182936
Buggy source:
public static boolean usesUtf8(int vcardType){
  return ((vcardType & FLAG_CHARSET_UTF8) != 0);
}

Fixed version (ground truth):
public static boolean usesUtf8(final int vcardType){
  return ((vcardType & FLAG_CHARSET_MASK) == FLAG_CHARSET_UTF8);
}
Program: 182937
Project: 182937
Buggy source:
public static boolean isV30(int vcardType){
  return ((vcardType & FLAG_V30) != 0);
}

Fixed version (ground truth):
public static boolean isV30(final int vcardType){
  return ((vcardType & FLAG_V30) != 0);
}
Program: 182938
Project: 182938
Buggy source:
public static int getNameOrderType(int vcardType){
  return vcardType & NAME_ORDER_MASK;
}

Fixed version (ground truth):
public static int getNameOrderType(final int vcardType){
  return vcardType & NAME_ORDER_MASK;
}
Program: 182939
Project: 182939
Buggy source:
public static boolean needsToConvertPhoneticString(int vcardType){
  return ((vcardType & FLAG_CONVERT_PHONETIC_NAME_STRINGS) != 0);
}

Fixed version (ground truth):
public static boolean needsToConvertPhoneticString(final int vcardType){
  return ((vcardType & FLAG_CONVERT_PHONETIC_NAME_STRINGS) != 0);
}
Program: 182940
Project: 182940
Buggy source:
public static boolean onlyOneNoteFieldIsAvailable(int vcardType){
  return vcardType == VCARD_TYPE_DOCOMO;
}

Fixed version (ground truth):
public static boolean onlyOneNoteFieldIsAvailable(final int vcardType){
  return vcardType == VCARD_TYPE_DOCOMO;
}
Program: 182941
Project: 182941
Buggy source:
public static boolean usesDefactProperty(int vcardType){
  return ((vcardType & FLAG_USE_DEFACT_PROPERTY) != 0);
}

Fixed version (ground truth):
public static boolean usesDefactProperty(final int vcardType){
  return ((vcardType & FLAG_USE_DEFACT_PROPERTY) != 0);
}
Program: 182942
Project: 182942
Buggy source:
/** 
 * Some Japanese mobile phones use this field for phonetic name, since vCard 2.1 does not have "SORT-STRING" type. Also, in some cases, the field has some ';'s in it. Assume the ';' means the same meaning in N property
 */
@SuppressWarnings("String_Node_Str") private void handlePhoneticNameFromSound(List<String> elems){
  int size;
  if (elems == null || (size=elems.size()) < 1) {
    return;
  }
  if (size > 3) {
    size=3;
  }
switch (size) {
case 3:
    mPhoneticMiddleName=elems.get(2);
case 2:
  mPhoneticGivenName=elems.get(1);
default :
mPhoneticFamilyName=elems.get(0);
}
}

Fixed version (ground truth):
/** 
 * Some Japanese mobile phones use this field for phonetic name, since vCard 2.1 does not have "SORT-STRING" type. Also, in some cases, the field has some ';'s in it. Assume the ';' means the same meaning in N property
 */
@SuppressWarnings("String_Node_Str") private void handlePhoneticNameFromSound(List<String> elems){
  if (!(TextUtils.isEmpty(mPhoneticFamilyName) && TextUtils.isEmpty(mPhoneticMiddleName) && TextUtils.isEmpty(mPhoneticGivenName))) {
    return;
  }
  int size;
  if (elems == null || (size=elems.size()) < 1) {
    return;
  }
  if (size > 3) {
    size=3;
  }
  if (elems.get(0).length() > 0) {
    boolean onlyFirstElemIsNonEmpty=true;
    for (int i=1; i < size; i++) {
      if (elems.get(i).length() > 0) {
        onlyFirstElemIsNonEmpty=false;
        break;
      }
    }
    if (onlyFirstElemIsNonEmpty) {
      final String[] namesArray=elems.get(0).split("String_Node_Str");
      final int nameArrayLength=namesArray.length;
      if (nameArrayLength == 3) {
        mPhoneticFamilyName=namesArray[0];
        mPhoneticMiddleName=namesArray[1];
        mPhoneticGivenName=namesArray[2];
      }
 else       if (nameArrayLength == 2) {
        mPhoneticFamilyName=namesArray[0];
        mPhoneticGivenName=namesArray[1];
      }
 else {
        mPhoneticFullName=elems.get(0);
      }
      return;
    }
  }
switch (size) {
case 3:
    mPhoneticMiddleName=elems.get(2);
case 2:
  mPhoneticGivenName=elems.get(1);
default :
mPhoneticFamilyName=elems.get(0);
}
}
Program: 182943
Project: 182943
Buggy source:
/** 
 * Construct the display name. The constructed data must not be null.
 */
private void constructDisplayName(){
  if (!TextUtils.isEmpty(mFullName)) {
    mDisplayName=mFullName;
  }
 else   if (!(TextUtils.isEmpty(mFamilyName) && TextUtils.isEmpty(mGivenName))) {
    StringBuilder builder=new StringBuilder();
    List<String> nameList;
switch (VCardConfig.getNameOrderType(mVCardType)) {
case VCardConfig.NAME_ORDER_JAPANESE:
      if (VCardUtils.containsOnlyPrintableAscii(mFamilyName) && VCardUtils.containsOnlyPrintableAscii(mGivenName)) {
        nameList=Arrays.asList(mPrefix,mGivenName,mMiddleName,mFamilyName,mSuffix);
      }
 else {
        nameList=Arrays.asList(mPrefix,mFamilyName,mMiddleName,mGivenName,mSuffix);
      }
    break;
case VCardConfig.NAME_ORDER_EUROPE:
  nameList=Arrays.asList(mPrefix,mMiddleName,mGivenName,mFamilyName,mSuffix);
break;
default :
nameList=Arrays.asList(mPrefix,mGivenName,mMiddleName,mFamilyName,mSuffix);
break;
}
boolean first=true;
for (String namePart : nameList) {
if (!TextUtils.isEmpty(namePart)) {
if (first) {
first=false;
}
 else {
builder.append(' ');
}
builder.append(namePart);
}
}
mDisplayName=builder.toString();
}
 else if (!(TextUtils.isEmpty(mPhoneticFamilyName) && TextUtils.isEmpty(mPhoneticGivenName))) {
mDisplayName=VCardUtils.constructNameFromElements(mVCardType,mPhoneticFamilyName,mPhoneticMiddleName,mPhoneticGivenName);
}
 else if (mEmailList != null && mEmailList.size() > 0) {
mDisplayName=mEmailList.get(0).data;
}
 else if (mPhoneList != null && mPhoneList.size() > 0) {
mDisplayName=mPhoneList.get(0).data;
}
 else if (mPostalList != null && mPostalList.size() > 0) {
mDisplayName=mPostalList.get(0).getFormattedAddress(mVCardType);
}
if (mDisplayName == null) {
mDisplayName="String_Node_Str";
}
}

Fixed version (ground truth):
/** 
 * Construct the display name. The constructed data must not be null.
 */
private void constructDisplayName(){
  if (!TextUtils.isEmpty(mFullName)) {
    mDisplayName=mFullName;
  }
 else   if (!(TextUtils.isEmpty(mFamilyName) && TextUtils.isEmpty(mGivenName))) {
    mDisplayName=VCardUtils.constructNameFromElements(mVCardType,mFamilyName,mMiddleName,mGivenName,mPrefix,mSuffix);
  }
 else   if (!(TextUtils.isEmpty(mPhoneticFamilyName) && TextUtils.isEmpty(mPhoneticGivenName))) {
    mDisplayName=VCardUtils.constructNameFromElements(mVCardType,mPhoneticFamilyName,mPhoneticMiddleName,mPhoneticGivenName);
  }
 else   if (mEmailList != null && mEmailList.size() > 0) {
    mDisplayName=mEmailList.get(0).data;
  }
 else   if (mPhoneList != null && mPhoneList.size() > 0) {
    mDisplayName=mPhoneList.get(0).data;
  }
 else   if (mPostalList != null && mPostalList.size() > 0) {
    mDisplayName=mPostalList.get(0).getFormattedAddress(mVCardType);
  }
  if (mDisplayName == null) {
    mDisplayName="String_Node_Str";
  }
}
Program: 182944
Project: 182944
Buggy source:
/** 
 * Returns true when the property line should contain charset parameter information. This method may return true even when vCard version is 3.0. Strictly, adding charset information is invalid in VCard 3.0. However we'll add the info only when charset we use is not UTF-8 in vCard 3.0 format, since parser side may be able to use the charset via this field, though we may encounter another problem by adding it. e.g. Japanese mobile phones use Shift_Jis while RFC 2426 recommends UTF-8. By adding this field, parsers may be able to know this text is NOT UTF-8 but Shift_Jis.
 */
private boolean shouldAppendCharsetParameter(final String propertyValue){
  return (!VCardUtils.containsOnlyPrintableAscii(propertyValue) && (!mIsV30 || !mUsesUtf8));
}

Fixed version (ground truth):
/** 
 * Returns true when the property line should contain charset parameter information. This method may return true even when vCard version is 3.0. Strictly, adding charset information is invalid in VCard 3.0. However we'll add the info only when charset we use is not UTF-8 in vCard 3.0 format, since parser side may be able to use the charset via this field, though we may encounter another problem by adding it. e.g. Japanese mobile phones use Shift_Jis while RFC 2426 recommends UTF-8. By adding this field, parsers may be able to know this text is NOT UTF-8 but Shift_Jis.
 */
private boolean shouldAppendCharsetParameter(final String propertyValue){
  return (!(mIsV30 && mUsesUtf8) && !VCardUtils.containsOnlyPrintableAscii(propertyValue));
}
Program: 182945
Project: 182945
Buggy source:
private boolean containsNonEmptyName(ContentValues contentValues){
  final String familyName=contentValues.getAsString(StructuredName.FAMILY_NAME);
  final String middleName=contentValues.getAsString(StructuredName.MIDDLE_NAME);
  final String givenName=contentValues.getAsString(StructuredName.GIVEN_NAME);
  final String prefix=contentValues.getAsString(StructuredName.PREFIX);
  final String suffix=contentValues.getAsString(StructuredName.SUFFIX);
  final String displayName=contentValues.getAsString(StructuredName.DISPLAY_NAME);
  return !(TextUtils.isEmpty(familyName) && TextUtils.isEmpty(middleName) && TextUtils.isEmpty(givenName)&& TextUtils.isEmpty(prefix)&& TextUtils.isEmpty(suffix)&& TextUtils.isEmpty(displayName));
}

Fixed version (ground truth):
private boolean containsNonEmptyName(ContentValues contentValues){
  final String familyName=contentValues.getAsString(StructuredName.FAMILY_NAME);
  final String middleName=contentValues.getAsString(StructuredName.MIDDLE_NAME);
  final String givenName=contentValues.getAsString(StructuredName.GIVEN_NAME);
  final String prefix=contentValues.getAsString(StructuredName.PREFIX);
  final String suffix=contentValues.getAsString(StructuredName.SUFFIX);
  final String phoneticFamilyName=contentValues.getAsString(StructuredName.PHONETIC_FAMILY_NAME);
  final String phoneticMiddleName=contentValues.getAsString(StructuredName.PHONETIC_MIDDLE_NAME);
  final String phoneticGivenName=contentValues.getAsString(StructuredName.PHONETIC_GIVEN_NAME);
  final String displayName=contentValues.getAsString(StructuredName.DISPLAY_NAME);
  return !(TextUtils.isEmpty(familyName) && TextUtils.isEmpty(middleName) && TextUtils.isEmpty(givenName)&& TextUtils.isEmpty(prefix)&& TextUtils.isEmpty(suffix)&& TextUtils.isEmpty(phoneticFamilyName)&& TextUtils.isEmpty(phoneticMiddleName)&& TextUtils.isEmpty(phoneticGivenName)&& TextUtils.isEmpty(displayName));
}
Program: 182947
Project: 182947
Buggy source:
public static boolean usesQuotedPrintable(int vcardType){
  return !isV30(vcardType);
}

Fixed version (ground truth):
public static boolean usesQuotedPrintable(final int vcardType){
  return !isV30(vcardType);
}
Program: 182948
Project: 182948
Buggy source:
public static int getVCardTypeFromString(String vcardTypeString){
  String loweredKey=vcardTypeString.toLowerCase();
  if (sVCardTypeMap.containsKey(loweredKey)) {
    return sVCardTypeMap.get(loweredKey);
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str" + vcardTypeString + "String_Node_Str");
    return VCARD_TYPE_DEFAULT;
  }
}

Fixed version (ground truth):
public static int getVCardTypeFromString(final String vcardTypeString){
  final String loweredKey=vcardTypeString.toLowerCase();
  if (sVCardTypeMap.containsKey(loweredKey)) {
    return sVCardTypeMap.get(loweredKey);
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str" + vcardTypeString + "String_Node_Str");
    return VCARD_TYPE_DEFAULT;
  }
}
Program: 182949
Project: 182949
Buggy source:
public static boolean usesAndroidSpecificProperty(int vcardType){
  return ((vcardType & FLAG_USE_ANDROID_PROPERTY) != 0);
}

Fixed version (ground truth):
public static boolean usesAndroidSpecificProperty(final int vcardType){
  return ((vcardType & FLAG_USE_ANDROID_PROPERTY) != 0);
}
Program: 182950
Project: 182950
Buggy source:
public static boolean appendTypeParamName(int vcardType){
  return (isV30(vcardType) || ((vcardType & FLAG_APPEND_TYPE_PARAM) != 0));
}

Fixed version (ground truth):
public static boolean appendTypeParamName(final int vcardType){
  return (isV30(vcardType) || ((vcardType & FLAG_APPEND_TYPE_PARAM) != 0));
}
Program: 182951
Project: 182951
Buggy source:
public static boolean refrainsQPToPrimaryProperties(int vcardType){
  return (!usesQuotedPrintable(vcardType) || ((vcardType & FLAG_REFRAIN_QP_TO_PRIMARY_PROPERTIES) != 0));
}

Fixed version (ground truth):
public static boolean refrainsQPToPrimaryProperties(final int vcardType){
  return (!usesQuotedPrintable(vcardType) || ((vcardType & FLAG_REFRAIN_QP_TO_PRIMARY_PROPERTIES) != 0));
}
Program: 182952
Project: 182952
Buggy source:
public static boolean isDoCoMo(int vcardType){
  return ((vcardType & FLAG_DOCOMO) != 0);
}

Fixed version (ground truth):
public static boolean isDoCoMo(final int vcardType){
  return ((vcardType & FLAG_DOCOMO) != 0);
}
Program: 182953
Project: 182953
Buggy source:
public static boolean usesShiftJis(int vcardType){
  return ((vcardType & FLAG_CHARSET_SHIFT_JIS) != 0);
}

Fixed version (ground truth):
public static boolean usesShiftJis(final int vcardType){
  return ((vcardType & FLAG_CHARSET_MASK) == FLAG_CHARSET_SHIFT_JIS);
}
Program: 182954
Project: 182954
Buggy source:
/** 
 * @return true if the device is Japanese and some Japanese convension isapplied to creating "formatted" something like FORMATTED_ADDRESS.
 */
public static boolean isJapaneseDevice(int vcardType){
  return sJapaneseMobileTypeSet.contains(vcardType);
}

Fixed version (ground truth):
/** 
 * @return true if the device is Japanese and some Japanese convension isapplied to creating "formatted" something like FORMATTED_ADDRESS.
 */
public static boolean isJapaneseDevice(final int vcardType){
  return sJapaneseMobileTypeSet.contains(vcardType);
}
Program: 182955
Project: 182955
Buggy source:
public static boolean usesUtf8(int vcardType){
  return ((vcardType & FLAG_CHARSET_UTF8) != 0);
}

Fixed version (ground truth):
public static boolean usesUtf8(final int vcardType){
  return ((vcardType & FLAG_CHARSET_MASK) == FLAG_CHARSET_UTF8);
}
Program: 182956
Project: 182956
Buggy source:
public static boolean isV30(int vcardType){
  return ((vcardType & FLAG_V30) != 0);
}

Fixed version (ground truth):
public static boolean isV30(final int vcardType){
  return ((vcardType & FLAG_V30) != 0);
}
Program: 182957
Project: 182957
Buggy source:
public static int getNameOrderType(int vcardType){
  return vcardType & NAME_ORDER_MASK;
}

Fixed version (ground truth):
public static int getNameOrderType(final int vcardType){
  return vcardType & NAME_ORDER_MASK;
}
Program: 182958
Project: 182958
Buggy source:
public static boolean needsToConvertPhoneticString(int vcardType){
  return ((vcardType & FLAG_CONVERT_PHONETIC_NAME_STRINGS) != 0);
}

Fixed version (ground truth):
public static boolean needsToConvertPhoneticString(final int vcardType){
  return ((vcardType & FLAG_CONVERT_PHONETIC_NAME_STRINGS) != 0);
}
Program: 182959
Project: 182959
Buggy source:
public static boolean onlyOneNoteFieldIsAvailable(int vcardType){
  return vcardType == VCARD_TYPE_DOCOMO;
}

Fixed version (ground truth):
public static boolean onlyOneNoteFieldIsAvailable(final int vcardType){
  return vcardType == VCARD_TYPE_DOCOMO;
}
Program: 182960
Project: 182960
Buggy source:
public static boolean usesDefactProperty(int vcardType){
  return ((vcardType & FLAG_USE_DEFACT_PROPERTY) != 0);
}

Fixed version (ground truth):
public static boolean usesDefactProperty(final int vcardType){
  return ((vcardType & FLAG_USE_DEFACT_PROPERTY) != 0);
}
Program: 182961
Project: 182961
Buggy source:
public Bitmap peekWallpaperBitmap(Context context,boolean returnDefault){
synchronized (this) {
    if (mWallpaper != null) {
      return mWallpaper;
    }
    if (mDefaultWallpaper != null) {
      return mDefaultWallpaper;
    }
    mWallpaper=getCurrentWallpaperLocked(context);
    if (mWallpaper == null && returnDefault) {
      mDefaultWallpaper=getDefaultWallpaperLocked(context);
      return mDefaultWallpaper;
    }
    return mWallpaper;
  }
}

Fixed version (ground truth):
public Bitmap peekWallpaperBitmap(Context context,boolean returnDefault){
synchronized (this) {
    if (mWallpaper != null) {
      return mWallpaper;
    }
    if (mDefaultWallpaper != null) {
      return mDefaultWallpaper;
    }
    mWallpaper=null;
    try {
      mWallpaper=getCurrentWallpaperLocked(context);
    }
 catch (    OutOfMemoryError e) {
      Log.w(TAG,"String_Node_Str",e);
    }
    if (mWallpaper == null && returnDefault) {
      mDefaultWallpaper=getDefaultWallpaperLocked(context);
      return mDefaultWallpaper;
    }
    return mWallpaper;
  }
}
Program: 182962
Project: 182962
Buggy source:
private Bitmap getDefaultWallpaperLocked(Context context){
  try {
    InputStream is=context.getResources().openRawResource(com.android.internal.R.drawable.default_wallpaper);
    if (is != null) {
      int width=mService.getWidthHint();
      int height=mService.getHeightHint();
      if (width <= 0 || height <= 0) {
        Bitmap bm=BitmapFactory.decodeStream(is,null,null);
        try {
          is.close();
        }
 catch (        IOException e) {
        }
        if (bm != null) {
          bm.setDensity(DisplayMetrics.DENSITY_DEVICE);
        }
        return bm;
      }
      BitmapFactory.Options options=new BitmapFactory.Options();
      options.inDither=false;
      options.inPreferredConfig=Bitmap.Config.ARGB_8888;
      Bitmap bm=BitmapFactory.decodeStream(is,null,options);
      try {
        is.close();
      }
 catch (      IOException e) {
      }
      return generateBitmap(context,bm,width,height);
    }
  }
 catch (  RemoteException e) {
  }
  return null;
}

Fixed version (ground truth):
private Bitmap getDefaultWallpaperLocked(Context context){
  try {
    InputStream is=context.getResources().openRawResource(com.android.internal.R.drawable.default_wallpaper);
    if (is != null) {
      int width=mService.getWidthHint();
      int height=mService.getHeightHint();
      if (width <= 0 || height <= 0) {
        Bitmap bm=BitmapFactory.decodeStream(is,null,null);
        try {
          is.close();
        }
 catch (        IOException e) {
        }
        if (bm != null) {
          bm.setDensity(DisplayMetrics.DENSITY_DEVICE);
        }
        return bm;
      }
      BitmapFactory.Options options=new BitmapFactory.Options();
      options.inDither=false;
      options.inPreferredConfig=Bitmap.Config.ARGB_8888;
      Bitmap bm=BitmapFactory.decodeStream(is,null,options);
      try {
        is.close();
      }
 catch (      IOException e) {
      }
      try {
        return generateBitmap(context,bm,width,height);
      }
 catch (      OutOfMemoryError e) {
        Log.w(TAG,"String_Node_Str",e);
        return bm;
      }
    }
  }
 catch (  RemoteException e) {
  }
  return null;
}
Program: 182963
Project: 182963
Buggy source:
void drawFrame(){
  SurfaceHolder sh=getSurfaceHolder();
  Canvas c=sh.lockCanvas();
  if (c != null) {
    final Rect frame=sh.getSurfaceFrame();
synchronized (mLock) {
      final Drawable background=mBackground;
      final int dw=frame.width();
      final int dh=frame.height();
      final int bw=mBackground.getIntrinsicWidth();
      final int bh=mBackground.getIntrinsicHeight();
      final int availw=dw - bw;
      final int availh=dh - bh;
      int xPixels=availw < 0 ? (int)(availw * mXOffset + .5f) : (availw / 2);
      int yPixels=availh < 0 ? (int)(availh * mYOffset + .5f) : (availh / 2);
      c.translate(xPixels,yPixels);
      if (availw < 0 || availh < 0) {
        c.save(Canvas.CLIP_SAVE_FLAG);
        c.clipRect(0,0,bw,bh,Op.DIFFERENCE);
        c.drawColor(0xff000000);
        c.restore();
      }
      background.draw(c);
    }
    sh.unlockCanvasAndPost(c);
  }
}

Fixed version (ground truth):
void drawFrame(){
  SurfaceHolder sh=getSurfaceHolder();
  Canvas c=sh.lockCanvas();
  if (c != null) {
    final Rect frame=sh.getSurfaceFrame();
synchronized (mLock) {
      final Drawable background=mBackground;
      final int dw=frame.width();
      final int dh=frame.height();
      final int bw=background != null ? background.getIntrinsicWidth() : 0;
      final int bh=background != null ? background.getIntrinsicHeight() : 0;
      final int availw=dw - bw;
      final int availh=dh - bh;
      int xPixels=availw < 0 ? (int)(availw * mXOffset + .5f) : (availw / 2);
      int yPixels=availh < 0 ? (int)(availh * mYOffset + .5f) : (availh / 2);
      c.translate(xPixels,yPixels);
      if (availw < 0 || availh < 0) {
        c.save(Canvas.CLIP_SAVE_FLAG);
        c.clipRect(0,0,bw,bh,Op.DIFFERENCE);
        c.drawColor(0xff000000);
        c.restore();
      }
      if (background != null) {
        background.draw(c);
      }
    }
    sh.unlockCanvasAndPost(c);
  }
}
Program: 182964
Project: 182964
Buggy source:
void updateWallpaper(){
synchronized (mLock) {
    mBackground=mWallpaperManager.getFastDrawable();
  }
}

Fixed version (ground truth):
void updateWallpaper(){
synchronized (mLock) {
    try {
      mBackground=mWallpaperManager.getFastDrawable();
    }
 catch (    RuntimeException e) {
      Log.w("String_Node_Str","String_Node_Str",e);
    }
  }
}
Program: 182965
Project: 182965
Buggy source:
public int getMaxPacketSize(){
  return mMaxPacketSize - 6;
}

Fixed version (ground truth):
public int getMaxPacketSize(){
  return mMaxPacketSize - 6 - getHeaderLength();
}
Program: 182966
Project: 182966
Buggy source:
/** 
 * Open and return an output stream for a connection.
 * @return an output stream
 * @throws IOException if an I/O error occurs
 */
public OutputStream openOutputStream() throws IOException {
  ensureOpen();
  ensureNotDone();
  if (mPrivateOutputOpen)   throw new IOException("String_Node_Str");
  if (mPrivateOutput == null) {
    mPrivateOutput=new PrivateOutputStream(this,mMaxPacketSize - 6);
  }
  mPrivateOutputOpen=true;
  return mPrivateOutput;
}

Fixed version (ground truth):
/** 
 * Open and return an output stream for a connection.
 * @return an output stream
 * @throws IOException if an I/O error occurs
 */
public OutputStream openOutputStream() throws IOException {
  ensureOpen();
  ensureNotDone();
  if (mPrivateOutputOpen)   throw new IOException("String_Node_Str");
  if (mPrivateOutput == null) {
    mPrivateOutput=new PrivateOutputStream(this,getMaxPacketSize());
  }
  mPrivateOutputOpen=true;
  return mPrivateOutput;
}
Program: 182967
Project: 182967
Buggy source:
public int getMaxPacketSize(){
  return mMaxPacketLength - 6;
}

Fixed version (ground truth):
public int getMaxPacketSize(){
  return mMaxPacketLength - 6 - getHeaderLength();
}
Program: 182968
Project: 182968
Buggy source:
/** 
 * Open and return an output stream for a connection.
 * @return an output stream
 * @throws IOException if an I/O error occurs
 */
public OutputStream openOutputStream() throws IOException {
  ensureOpen();
  if (mPrivateOutputOpen) {
    throw new IOException("String_Node_Str");
  }
  if (!mRequestFinished) {
    throw new IOException("String_Node_Str");
  }
  if (mPrivateOutput == null) {
    mPrivateOutput=new PrivateOutputStream(this,mMaxPacketLength - 6);
  }
  mPrivateOutputOpen=true;
  return mPrivateOutput;
}

Fixed version (ground truth):
/** 
 * Open and return an output stream for a connection.
 * @return an output stream
 * @throws IOException if an I/O error occurs
 */
public OutputStream openOutputStream() throws IOException {
  ensureOpen();
  if (mPrivateOutputOpen) {
    throw new IOException("String_Node_Str");
  }
  if (!mRequestFinished) {
    throw new IOException("String_Node_Str");
  }
  if (mPrivateOutput == null) {
    mPrivateOutput=new PrivateOutputStream(this,getMaxPacketSize());
  }
  mPrivateOutputOpen=true;
  return mPrivateOutput;
}
Program: 182972
Project: 182972
Buggy source:
private final void handleCreateService(CreateServiceData data){
  unscheduleGcIdler();
  PackageInfo packageInfo=getPackageInfoNoCheck(data.info.applicationInfo);
  Service service=null;
  try {
    java.lang.ClassLoader cl=packageInfo.getClassLoader();
    service=(Service)cl.loadClass(data.info.name).newInstance();
  }
 catch (  Exception e) {
    if (!mInstrumentation.onException(service,e)) {
      throw new RuntimeException("String_Node_Str" + data.info.name + "String_Node_Str"+ e.toString(),e);
    }
  }
  try {
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + data.info.name);
    ApplicationContext context=new ApplicationContext();
    context.init(packageInfo,null,this);
    Application app=packageInfo.makeApplication(false);
    context.setOuterContext(service);
    service.attach(context,this,data.info.name,data.token,app,ActivityManagerNative.getDefault());
    service.onCreate();
    mServices.put(data.token,service);
    try {
      ActivityManagerNative.getDefault().serviceDoneExecuting(data.token,0,0,0);
    }
 catch (    RemoteException e) {
    }
  }
 catch (  Exception e) {
    if (!mInstrumentation.onException(service,e)) {
      throw new RuntimeException("String_Node_Str" + data.info.name + "String_Node_Str"+ e.toString(),e);
    }
  }
}

Fixed version (ground truth):
private final void handleCreateService(CreateServiceData data){
  unscheduleGcIdler();
  PackageInfo packageInfo=getPackageInfoNoCheck(data.info.applicationInfo);
  Service service=null;
  try {
    java.lang.ClassLoader cl=packageInfo.getClassLoader();
    service=(Service)cl.loadClass(data.info.name).newInstance();
  }
 catch (  Exception e) {
    if (!mInstrumentation.onException(service,e)) {
      throw new RuntimeException("String_Node_Str" + data.info.name + "String_Node_Str"+ e.toString(),e);
    }
  }
  try {
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + data.info.name);
    ApplicationContext context=new ApplicationContext();
    context.init(packageInfo,null,this);
    Application app=packageInfo.makeApplication(false,mInstrumentation);
    context.setOuterContext(service);
    service.attach(context,this,data.info.name,data.token,app,ActivityManagerNative.getDefault());
    service.onCreate();
    mServices.put(data.token,service);
    try {
      ActivityManagerNative.getDefault().serviceDoneExecuting(data.token,0,0,0);
    }
 catch (    RemoteException e) {
    }
  }
 catch (  Exception e) {
    if (!mInstrumentation.onException(service,e)) {
      throw new RuntimeException("String_Node_Str" + data.info.name + "String_Node_Str"+ e.toString(),e);
    }
  }
}
Program: 182975
Project: 182975
Buggy source:
public Application makeApplication(boolean forceDefaultAppClass){
  if (mApplication != null) {
    return mApplication;
  }
  Application app=null;
  String appClass=mApplicationInfo.className;
  if (forceDefaultAppClass || (appClass == null)) {
    appClass="String_Node_Str";
  }
  try {
    java.lang.ClassLoader cl=getClassLoader();
    ApplicationContext appContext=new ApplicationContext();
    appContext.init(this,null,mActivityThread);
    app=mActivityThread.mInstrumentation.newApplication(cl,appClass,appContext);
    appContext.setOuterContext(app);
  }
 catch (  Exception e) {
    if (!mActivityThread.mInstrumentation.onException(app,e)) {
      throw new RuntimeException("String_Node_Str" + appClass + "String_Node_Str"+ e.toString(),e);
    }
  }
  mActivityThread.mAllApplications.add(app);
  return mApplication=app;
}

Fixed version (ground truth):
public Application makeApplication(boolean forceDefaultAppClass,Instrumentation instrumentation){
  if (mApplication != null) {
    return mApplication;
  }
  Application app=null;
  String appClass=mApplicationInfo.className;
  if (forceDefaultAppClass || (appClass == null)) {
    appClass="String_Node_Str";
  }
  try {
    java.lang.ClassLoader cl=getClassLoader();
    ApplicationContext appContext=new ApplicationContext();
    appContext.init(this,null,mActivityThread);
    app=mActivityThread.mInstrumentation.newApplication(cl,appClass,appContext);
    appContext.setOuterContext(app);
  }
 catch (  Exception e) {
    if (!mActivityThread.mInstrumentation.onException(app,e)) {
      throw new RuntimeException("String_Node_Str" + appClass + "String_Node_Str"+ e.toString(),e);
    }
  }
  mActivityThread.mAllApplications.add(app);
  mApplication=app;
  if (instrumentation != null) {
    try {
      instrumentation.callApplicationOnCreate(app);
    }
 catch (    Exception e) {
      if (!instrumentation.onException(app,e)) {
        throw new RuntimeException("String_Node_Str" + app.getClass().getName() + "String_Node_Str"+ e.toString(),e);
      }
    }
  }
  return app;
}
Program: 182976
Project: 182976
Buggy source:
public void start(GLThread thread) throws InterruptedException {
  GLThread oldThread=null;
synchronized (this) {
    mMostRecentGLThread=thread;
    oldThread=mMostRecentGLThread;
  }
  if (oldThread != null) {
synchronized (oldThread) {
      oldThread.notifyAll();
    }
  }
  sEglSemaphore.acquire();
}

Fixed version (ground truth):
public void start(GLThread thread) throws InterruptedException {
  GLThread oldThread=null;
synchronized (this) {
    oldThread=mMostRecentGLThread;
    mMostRecentGLThread=thread;
  }
  if (oldThread != null) {
synchronized (oldThread) {
      oldThread.notifyAll();
    }
  }
  sEglSemaphore.acquire();
}
Program: 182977
Project: 182977
Buggy source:
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param force ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param force ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}
Program: 182978
Project: 182978
Buggy source:
private boolean signaturesMatch(Signature[] storedSigs,Signature[] deviceSigs){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + storedSigs + "String_Node_Str"+ deviceSigs);
  if ((storedSigs == null || storedSigs.length == 0) && (deviceSigs == null || deviceSigs.length == 0)) {
    return true;
  }
  if (storedSigs == null || deviceSigs == null) {
    return false;
  }
  int nStored=storedSigs.length;
  int nDevice=deviceSigs.length;
  for (int i=0; i < nStored; i++) {
    boolean match=false;
    for (int j=0; j < nDevice; j++) {
      if (storedSigs[i].equals(deviceSigs[j])) {
        match=true;
        break;
      }
    }
    if (!match) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean signaturesMatch(Signature[] storedSigs,PackageInfo target){
  if ((target.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + target.packageName + "String_Node_Str");
    return true;
  }
  Signature[] deviceSigs=target.signatures;
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + storedSigs + "String_Node_Str"+ deviceSigs);
  if ((storedSigs == null || storedSigs.length == 0) && (deviceSigs == null || deviceSigs.length == 0)) {
    return true;
  }
  if (storedSigs == null || deviceSigs == null) {
    return false;
  }
  int nStored=storedSigs.length;
  int nDevice=deviceSigs.length;
  for (int i=0; i < nStored; i++) {
    boolean match=false;
    for (int j=0; j < nDevice; j++) {
      if (storedSigs[i].equals(deviceSigs[j])) {
        match=true;
        break;
      }
    }
    if (!match) {
      return false;
    }
  }
  return true;
}
Program: 182979
Project: 182979
Buggy source:
private void forceUserActivityLocked(){
  boolean savedActivityAllowed=mUserActivityAllowed;
  mUserActivityAllowed=true;
  userActivity(SystemClock.uptimeMillis(),false);
  mUserActivityAllowed=savedActivityAllowed;
}

Fixed version (ground truth):
private void forceUserActivityLocked(){
  mScreenBrightness.animating=false;
  boolean savedActivityAllowed=mUserActivityAllowed;
  mUserActivityAllowed=true;
  userActivity(SystemClock.uptimeMillis(),false);
  mUserActivityAllowed=savedActivityAllowed;
}
Program: 182980
Project: 182980
Buggy source:
private void setScreenBrightnessMode(int mode){
  mAutoBrightessEnabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  mLightSensorBrightness=-1;
  if (mHasHardwareAutoBrightness) {
    mHardware.setAutoBrightness_UNCHECKED(mAutoBrightessEnabled);
    setBacklightBrightness((int)mScreenBrightness.curValue);
  }
 else {
    enableLightSensor(screenIsOn() && mAutoBrightessEnabled);
  }
}

Fixed version (ground truth):
private void setScreenBrightnessMode(int mode){
  boolean enabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  if (mAutoBrightessEnabled != enabled) {
    mAutoBrightessEnabled=enabled;
    mLightSensorBrightness=-1;
    if (mHasHardwareAutoBrightness) {
      mHardware.setAutoBrightness_UNCHECKED(enabled);
      if (screenIsOn()) {
        setBacklightBrightness((int)mScreenBrightness.curValue);
      }
    }
 else {
      enableLightSensor(screenIsOn() && enabled);
    }
  }
}
Program: 182981
Project: 182981
Buggy source:
private void setScreenBrightnessMode(int mode){
  mAutoBrightessEnabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  mLightSensorBrightness=-1;
  if (mHasHardwareAutoBrightness) {
    mHardware.setAutoBrightness_UNCHECKED(mAutoBrightessEnabled);
    setBacklightBrightness((int)mScreenBrightness.curValue);
  }
 else {
    enableLightSensor(screenIsOn() && mAutoBrightessEnabled);
  }
}

Fixed version (ground truth):
private void setScreenBrightnessMode(int mode){
  boolean enabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  if (mAutoBrightessEnabled != enabled) {
    mAutoBrightessEnabled=enabled;
    mLightSensorBrightness=-1;
    if (mHasHardwareAutoBrightness) {
      mHardware.setAutoBrightness_UNCHECKED(enabled);
      if (screenIsOn()) {
        setBacklightBrightness((int)mScreenBrightness.curValue);
      }
    }
 else {
      enableLightSensor(screenIsOn() && enabled);
    }
  }
}
Program: 182982
Project: 182982
Buggy source:
private void setScreenBrightnessMode(int mode){
  mAutoBrightessEnabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  mLightSensorBrightness=-1;
  if (mHasHardwareAutoBrightness) {
    mHardware.setAutoBrightness_UNCHECKED(mAutoBrightessEnabled);
    setBacklightBrightness((int)mScreenBrightness.curValue);
  }
 else {
    enableLightSensor(screenIsOn() && mAutoBrightessEnabled);
  }
}

Fixed version (ground truth):
private void setScreenBrightnessMode(int mode){
  boolean enabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  if (mAutoBrightessEnabled != enabled) {
    mAutoBrightessEnabled=enabled;
    mLightSensorBrightness=-1;
    if (mHasHardwareAutoBrightness) {
      mHardware.setAutoBrightness_UNCHECKED(enabled);
      if (screenIsOn()) {
        setBacklightBrightness((int)mScreenBrightness.curValue);
      }
    }
 else {
      enableLightSensor(screenIsOn() && enabled);
    }
  }
}
Program: 182983
Project: 182983
Buggy source:
private VolumeStreamState(String settingName,int streamType){
  mVolumeIndexSettingName=settingName;
  mLastAudibleVolumeIndexSettingName=settingName + System.APPEND_FOR_LAST_AUDIBLE;
  mStreamType=streamType;
  final ContentResolver cr=mContentResolver;
  mIndexMax=MAX_STREAM_VOLUME[streamType];
  mIndex=Settings.System.getInt(cr,mVolumeIndexSettingName,AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  mLastAudibleIndex=Settings.System.getInt(cr,mLastAudibleVolumeIndexSettingName,(mIndex > 0) ? mIndex : AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  AudioSystem.initStreamVolume(streamType,0,mIndexMax);
  mIndexMax*=10;
  mIndex=getValidIndex(10 * mIndex);
  mLastAudibleIndex=getValidIndex(10 * mLastAudibleIndex);
  setStreamVolumeIndex(streamType,mIndex);
  mDeathHandlers=new ArrayList<VolumeDeathHandler>();
}

Fixed version (ground truth):
private VolumeStreamState(String settingName,int streamType){
  setVolumeIndexSettingName(settingName);
  mStreamType=streamType;
  final ContentResolver cr=mContentResolver;
  mIndexMax=MAX_STREAM_VOLUME[streamType];
  mIndex=Settings.System.getInt(cr,mVolumeIndexSettingName,AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  mLastAudibleIndex=Settings.System.getInt(cr,mLastAudibleVolumeIndexSettingName,(mIndex > 0) ? mIndex : AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  AudioSystem.initStreamVolume(streamType,0,mIndexMax);
  mIndexMax*=10;
  mIndex=getValidIndex(10 * mIndex);
  mLastAudibleIndex=getValidIndex(10 * mLastAudibleIndex);
  setStreamVolumeIndex(streamType,mIndex);
  mDeathHandlers=new ArrayList<VolumeDeathHandler>();
}