nus-yam/ex-repair huggingface dataset:
Program: 42877
Project: 42877
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: 42878
Project: 42878
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: 42879
Project: 42879
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: 42881
Project: 42881
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: 42882
Project: 42882
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: 42883
Project: 42883
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: 42884
Project: 42884
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: 42885
Project: 42885
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: 42886
Project: 42886
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: 42887
Project: 42887
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: 42888
Project: 42888
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: 42889
Project: 42889
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: 42890
Project: 42890
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: 42891
Project: 42891
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: 42892
Project: 42892
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: 42893
Project: 42893
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: 42894
Project: 42894
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: 42895
Project: 42895
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: 42896
Project: 42896
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: 42897
Project: 42897
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: 42898
Project: 42898
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: 42900
Project: 42900
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: 42901
Project: 42901
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: 42902
Project: 42902
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: 42903
Project: 42903
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: 42904
Project: 42904
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: 42905
Project: 42905
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: 42906
Project: 42906
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: 42907
Project: 42907
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: 42908
Project: 42908
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: 42909
Project: 42909
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: 42910
Project: 42910
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: 42911
Project: 42911
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: 42912
Project: 42912
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: 42913
Project: 42913
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: 42914
Project: 42914
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: 42915
Project: 42915
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: 42916
Project: 42916
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: 42917
Project: 42917
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: 42918
Project: 42918
Buggy source:
public int getMaxPacketSize(){
  return mMaxPacketSize - 6;
}

Fixed version (ground truth):
public int getMaxPacketSize(){
  return mMaxPacketSize - 6 - getHeaderLength();
}
Program: 42919
Project: 42919
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: 42920
Project: 42920
Buggy source:
public int getMaxPacketSize(){
  return mMaxPacketLength - 6;
}

Fixed version (ground truth):
public int getMaxPacketSize(){
  return mMaxPacketLength - 6 - getHeaderLength();
}
Program: 42921
Project: 42921
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: 42925
Project: 42925
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: 42928
Project: 42928
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: 42929
Project: 42929
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: 42930
Project: 42930
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: 42931
Project: 42931
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: 42932
Project: 42932
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: 42933
Project: 42933
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: 42934
Project: 42934
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: 42935
Project: 42935
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: 42936
Project: 42936
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>();
}