Program: 11929
Project: 11929
Buggy source:
protected boolean saveFeatures(EObject o){
  EClass eClass=o.eClass();
  int contentKind=extendedMetaData == null ? ExtendedMetaData.UNSPECIFIED_CONTENT : extendedMetaData.getContentKind(eClass);
  if (!toDOM) {
switch (contentKind) {
case ExtendedMetaData.MIXED_CONTENT:
case ExtendedMetaData.SIMPLE_CONTENT:
{
        doc.setMixed(true);
        break;
      }
  }
}
EStructuralFeature[] features=featureTable.getFeatures(eClass);
int[] featureKinds=featureTable.getKinds(eClass,features);
int[] elementFeatures=null;
int elementCount=0;
String content=null;
LOOP: for (int i=0; i < features.length; i++) {
  int kind=featureKinds[i];
  EStructuralFeature f=features[i];
  boolean isSet=o.eIsSet(f);
  if (keepDefaults && !isSet) {
    if (f.getDefaultValueLiteral() != null) {
      isSet=true;
    }
  }
  if (kind != TRANSIENT && isSet) {
switch (kind) {
case DATATYPE_ELEMENT_SINGLE:
{
        if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
          content=getDataTypeElementSingleSimple(o,f);
          continue LOOP;
        }
        break;
      }
case DATATYPE_SINGLE:
{
      saveDataTypeSingle(o,f);
      continue LOOP;
    }
case DATATYPE_SINGLE_NILLABLE:
{
    if (!isNil(o,f)) {
      saveDataTypeSingle(o,f);
      continue LOOP;
    }
    break;
  }
case OBJECT_ATTRIBUTE_SINGLE:
{
  saveEObjectSingle(o,f);
  continue LOOP;
}
case OBJECT_ATTRIBUTE_MANY:
{
saveEObjectMany(o,f);
continue LOOP;
}
case OBJECT_ATTRIBUTE_IDREF_SINGLE:
{
saveIDRefSingle(o,f);
continue LOOP;
}
case OBJECT_ATTRIBUTE_IDREF_MANY:
{
saveIDRefMany(o,f);
continue LOOP;
}
case OBJECT_HREF_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
break;
}
}
case OBJECT_HREF_SINGLE:
{
if (useEncodedAttributeStyle) {
saveEObjectSingle(o,f);
continue LOOP;
}
 else {
switch (sameDocSingle(o,f)) {
case SAME_DOC:
{
saveIDRefSingle(o,f);
continue LOOP;
}
case CROSS_DOC:
{
break;
}
default :
{
continue LOOP;
}
}
}
break;
}
case OBJECT_HREF_MANY_UNSETTABLE:
{
if (isEmpty(o,f)) {
saveManyEmpty(o,f);
continue LOOP;
}
}
case OBJECT_HREF_MANY:
{
if (useEncodedAttributeStyle) {
saveEObjectMany(o,f);
continue LOOP;
}
 else {
switch (sameDocMany(o,f)) {
case SAME_DOC:
{
saveIDRefMany(o,f);
continue LOOP;
}
case CROSS_DOC:
{
break;
}
default :
{
continue LOOP;
}
}
}
break;
}
case OBJECT_ELEMENT_SINGLE_UNSETTABLE:
case OBJECT_ELEMENT_SINGLE:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementReferenceSingleSimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_ELEMENT_MANY:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementReferenceManySimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_ELEMENT_IDREF_SINGLE_UNSETTABLE:
case OBJECT_ELEMENT_IDREF_SINGLE:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementIDRefSingleSimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_ELEMENT_IDREF_MANY:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementIDRefManySimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_CONTAIN_MANY_UNSETTABLE:
case DATATYPE_MANY:
{
if (isEmpty(o,f)) {
saveManyEmpty(o,f);
continue LOOP;
}
break;
}
case OBJECT_CONTAIN_SINGLE_UNSETTABLE:
case OBJECT_CONTAIN_SINGLE:
case OBJECT_CONTAIN_MANY:
case ELEMENT_FEATURE_MAP:
{
break;
}
case ATTRIBUTE_FEATURE_MAP:
{
saveAttributeFeatureMap(o,f);
continue LOOP;
}
default :
{
continue LOOP;
}
}
if (elementFeatures == null) {
elementFeatures=new int[features.length];
}
elementFeatures[elementCount++]=i;
}
}
processAttributeExtensions(o);
if (elementFeatures == null) {
if (content == null) {
content=getContent(o,features);
}
if (content == null) {
endSaveFeatures(o,EMPTY_ELEMENT,null);
return false;
}
 else {
endSaveFeatures(o,CONTENT_ELEMENT,content);
return true;
}
}
for (int i=0; i < elementCount; i++) {
int kind=featureKinds[elementFeatures[i]];
EStructuralFeature f=features[elementFeatures[i]];
switch (kind) {
case DATATYPE_SINGLE_NILLABLE:
{
saveNil(o,f);
break;
}
case ELEMENT_FEATURE_MAP:
{
saveElementFeatureMap(o,f);
break;
}
case DATATYPE_MANY:
{
saveDataTypeMany(o,f);
break;
}
case DATATYPE_ELEMENT_SINGLE:
{
saveDataTypeElementSingle(o,f);
break;
}
case OBJECT_CONTAIN_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_CONTAIN_SINGLE:
{
saveContainedSingle(o,f);
break;
}
case OBJECT_CONTAIN_MANY_UNSETTABLE:
case OBJECT_CONTAIN_MANY:
{
saveContainedMany(o,f);
break;
}
case OBJECT_HREF_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_HREF_SINGLE:
{
saveHRefSingle(o,f);
break;
}
case OBJECT_HREF_MANY_UNSETTABLE:
case OBJECT_HREF_MANY:
{
saveHRefMany(o,f);
break;
}
case OBJECT_ELEMENT_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_ELEMENT_SINGLE:
{
saveElementReferenceSingle(o,f);
break;
}
case OBJECT_ELEMENT_MANY:
{
saveElementReferenceMany(o,f);
break;
}
case OBJECT_ELEMENT_IDREF_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_ELEMENT_IDREF_SINGLE:
{
saveElementIDRefSingle(o,f);
break;
}
case OBJECT_ELEMENT_IDREF_MANY:
{
saveElementIDRefMany(o,f);
break;
}
}
}
endSaveFeatures(o,0,null);
return true;
}

Fixed version (ground truth):
protected boolean saveFeatures(EObject o){
  EClass eClass=o.eClass();
  int contentKind=extendedMetaData == null ? ExtendedMetaData.UNSPECIFIED_CONTENT : extendedMetaData.getContentKind(eClass);
  if (!toDOM) {
switch (contentKind) {
case ExtendedMetaData.MIXED_CONTENT:
case ExtendedMetaData.SIMPLE_CONTENT:
{
        doc.setMixed(true);
        break;
      }
  }
}
EStructuralFeature[] features=featureTable.getFeatures(eClass);
int[] featureKinds=featureTable.getKinds(eClass,features);
int[] elementFeatures=null;
int elementCount=0;
String content=null;
LOOP: for (int i=0; i < features.length; i++) {
  int kind=featureKinds[i];
  EStructuralFeature f=features[i];
  if (kind != TRANSIENT && (o.eIsSet(f) || keepDefaults && f.getDefaultValueLiteral() != null)) {
switch (kind) {
case DATATYPE_ELEMENT_SINGLE:
{
        if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
          content=getDataTypeElementSingleSimple(o,f);
          continue LOOP;
        }
        break;
      }
case DATATYPE_SINGLE:
{
      saveDataTypeSingle(o,f);
      continue LOOP;
    }
case DATATYPE_SINGLE_NILLABLE:
{
    if (!isNil(o,f)) {
      saveDataTypeSingle(o,f);
      continue LOOP;
    }
    break;
  }
case OBJECT_ATTRIBUTE_SINGLE:
{
  saveEObjectSingle(o,f);
  continue LOOP;
}
case OBJECT_ATTRIBUTE_MANY:
{
saveEObjectMany(o,f);
continue LOOP;
}
case OBJECT_ATTRIBUTE_IDREF_SINGLE:
{
saveIDRefSingle(o,f);
continue LOOP;
}
case OBJECT_ATTRIBUTE_IDREF_MANY:
{
saveIDRefMany(o,f);
continue LOOP;
}
case OBJECT_HREF_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
break;
}
}
case OBJECT_HREF_SINGLE:
{
if (useEncodedAttributeStyle) {
saveEObjectSingle(o,f);
continue LOOP;
}
 else {
switch (sameDocSingle(o,f)) {
case SAME_DOC:
{
saveIDRefSingle(o,f);
continue LOOP;
}
case CROSS_DOC:
{
break;
}
default :
{
continue LOOP;
}
}
}
break;
}
case OBJECT_HREF_MANY_UNSETTABLE:
{
if (isEmpty(o,f)) {
saveManyEmpty(o,f);
continue LOOP;
}
}
case OBJECT_HREF_MANY:
{
if (useEncodedAttributeStyle) {
saveEObjectMany(o,f);
continue LOOP;
}
 else {
switch (sameDocMany(o,f)) {
case SAME_DOC:
{
saveIDRefMany(o,f);
continue LOOP;
}
case CROSS_DOC:
{
break;
}
default :
{
continue LOOP;
}
}
}
break;
}
case OBJECT_ELEMENT_SINGLE_UNSETTABLE:
case OBJECT_ELEMENT_SINGLE:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementReferenceSingleSimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_ELEMENT_MANY:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementReferenceManySimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_ELEMENT_IDREF_SINGLE_UNSETTABLE:
case OBJECT_ELEMENT_IDREF_SINGLE:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementIDRefSingleSimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_ELEMENT_IDREF_MANY:
{
if (contentKind == ExtendedMetaData.SIMPLE_CONTENT) {
content=getElementIDRefManySimple(o,f);
continue LOOP;
}
break;
}
case OBJECT_CONTAIN_MANY_UNSETTABLE:
case DATATYPE_MANY:
{
if (isEmpty(o,f)) {
saveManyEmpty(o,f);
continue LOOP;
}
break;
}
case OBJECT_CONTAIN_SINGLE_UNSETTABLE:
case OBJECT_CONTAIN_SINGLE:
case OBJECT_CONTAIN_MANY:
case ELEMENT_FEATURE_MAP:
{
break;
}
case ATTRIBUTE_FEATURE_MAP:
{
saveAttributeFeatureMap(o,f);
continue LOOP;
}
default :
{
continue LOOP;
}
}
if (elementFeatures == null) {
elementFeatures=new int[features.length];
}
elementFeatures[elementCount++]=i;
}
}
processAttributeExtensions(o);
if (elementFeatures == null) {
if (content == null) {
content=getContent(o,features);
}
if (content == null) {
endSaveFeatures(o,EMPTY_ELEMENT,null);
return false;
}
 else {
endSaveFeatures(o,CONTENT_ELEMENT,content);
return true;
}
}
for (int i=0; i < elementCount; i++) {
int kind=featureKinds[elementFeatures[i]];
EStructuralFeature f=features[elementFeatures[i]];
switch (kind) {
case DATATYPE_SINGLE_NILLABLE:
{
saveNil(o,f);
break;
}
case ELEMENT_FEATURE_MAP:
{
saveElementFeatureMap(o,f);
break;
}
case DATATYPE_MANY:
{
saveDataTypeMany(o,f);
break;
}
case DATATYPE_ELEMENT_SINGLE:
{
saveDataTypeElementSingle(o,f);
break;
}
case OBJECT_CONTAIN_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_CONTAIN_SINGLE:
{
saveContainedSingle(o,f);
break;
}
case OBJECT_CONTAIN_MANY_UNSETTABLE:
case OBJECT_CONTAIN_MANY:
{
saveContainedMany(o,f);
break;
}
case OBJECT_HREF_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_HREF_SINGLE:
{
saveHRefSingle(o,f);
break;
}
case OBJECT_HREF_MANY_UNSETTABLE:
case OBJECT_HREF_MANY:
{
saveHRefMany(o,f);
break;
}
case OBJECT_ELEMENT_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_ELEMENT_SINGLE:
{
saveElementReferenceSingle(o,f);
break;
}
case OBJECT_ELEMENT_MANY:
{
saveElementReferenceMany(o,f);
break;
}
case OBJECT_ELEMENT_IDREF_SINGLE_UNSETTABLE:
{
if (isNil(o,f)) {
saveNil(o,f);
break;
}
}
case OBJECT_ELEMENT_IDREF_SINGLE:
{
saveElementIDRefSingle(o,f);
break;
}
case OBJECT_ELEMENT_IDREF_MANY:
{
saveElementIDRefMany(o,f);
break;
}
}
}
endSaveFeatures(o,0,null);
return true;
}