Program: 80182
Project: 80182
Buggy source:
private Object getSuperValue(Field field,Schema fieldSchema,Type type){
  Object value=null;
switch (type) {
case ARRAY:
    List<Object> array=new ArrayList<Object>();
  for (  HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
    Object memberValue=fromByteBuffer(fieldSchema.getElementType(),hColumn.getValue());
    array.add(memberValue);
  }
value=array;
break;
case MAP:
Map<CharSequence,Object> map=new HashMap<CharSequence,Object>();
for (HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
CharSequence mapKey=CharSequenceSerializer.get().fromByteBuffer(hColumn.getName());
if (mapKey.toString().indexOf(CassandraStore.UNION_COL_SUFIX) < 0) {
Object memberValue=null;
if (fieldSchema.getValueType().getType().equals(Type.UNION)) {
HColumn<ByteBuffer,ByteBuffer> cc=getUnionTypeColumn(mapKey + CassandraStore.UNION_COL_SUFIX,this.hSuperColumn.getColumns());
Integer unionIndex=getUnionIndex(mapKey.toString(),cc);
Schema realSchema=fieldSchema.getValueType().getTypes().get(unionIndex);
memberValue=fromByteBuffer(realSchema,hColumn.getValue());
}
 else {
memberValue=fromByteBuffer(fieldSchema.getValueType(),hColumn.getValue());
}
map.put(mapKey,memberValue);
}
}
value=map;
break;
case RECORD:
String fullName=fieldSchema.getFullName();
Class<?> claz=null;
try {
claz=Class.forName(fullName);
}
 catch (ClassNotFoundException cnfe) {
LOG.warn("String_Node_Str" + fullName,cnfe);
break;
}
try {
value=claz.newInstance();
}
 catch (InstantiationException ie) {
LOG.warn("String_Node_Str",ie);
break;
}
catch (IllegalAccessException iae) {
LOG.warn("String_Node_Str",iae);
break;
}
if (value instanceof PersistentBase) {
PersistentBase record=(PersistentBase)value;
for (HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
String memberName=StringSerializer.get().fromByteBuffer(hColumn.getName());
if (memberName.indexOf(CassandraStore.UNION_COL_SUFIX) < 0) {
if (memberName == null || memberName.length() == 0) {
LOG.warn("String_Node_Str");
continue;
}
Field memberField=fieldSchema.getField(memberName);
Schema memberSchema=memberField.schema();
Type memberType=memberSchema.getType();
CassandraSubColumn cassandraColumn=new CassandraSubColumn();
cassandraColumn.setField(memberField);
cassandraColumn.setValue(hColumn);
if (memberType.equals(Type.UNION)) {
HColumn<ByteBuffer,ByteBuffer> hc=getUnionTypeColumn(memberField.name() + CassandraStore.UNION_COL_SUFIX,this.hSuperColumn.getColumns().toArray());
Integer unionIndex=getUnionIndex(memberField.name(),hc);
cassandraColumn.setUnionType(unionIndex);
}
record.put(record.getSchema().getField(memberName).pos(),cassandraColumn.getValue());
}
}
}
break;
case UNION:
int schemaPos=this.getUnionType();
Schema unioSchema=fieldSchema.getTypes().get(schemaPos);
Type unionType=unioSchema.getType();
value=getSuperValue(field,unioSchema,unionType);
break;
default :
Object memberValue=null;
for (HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
memberValue=fromByteBuffer(fieldSchema,hColumn.getValue());
}
value=memberValue;
LOG.warn("String_Node_Str" + type.name() + "String_Node_Str"+ field.name());
}
return value;
}

Fixed version (ground truth):
private Object getSuperValue(Field field,Schema fieldSchema,Type type){
  Object value=null;
switch (type) {
case ARRAY:
    List<Object> array=new ArrayList<Object>();
  for (  HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
    Object memberValue=fromByteBuffer(fieldSchema.getElementType(),hColumn.getValue());
    array.add(memberValue);
  }
value=array;
break;
case MAP:
Map<CharSequence,Object> map=new HashMap<CharSequence,Object>();
for (HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
CharSequence mapKey=CharSequenceSerializer.get().fromByteBuffer(hColumn.getName());
if (mapKey.toString().indexOf(CassandraStore.UNION_COL_SUFIX) < 0) {
Object memberValue=null;
if (fieldSchema.getValueType().getType().equals(Type.UNION)) {
HColumn<ByteBuffer,ByteBuffer> cc=getUnionTypeColumn(mapKey + CassandraStore.UNION_COL_SUFIX,this.hSuperColumn.getColumns());
Integer unionIndex=getUnionIndex(mapKey.toString(),cc);
Schema realSchema=fieldSchema.getValueType().getTypes().get(unionIndex);
memberValue=fromByteBuffer(realSchema,hColumn.getValue());
}
 else {
memberValue=fromByteBuffer(fieldSchema.getValueType(),hColumn.getValue());
}
map.put(mapKey,memberValue);
}
}
value=map;
break;
case RECORD:
String fullName=fieldSchema.getFullName();
Class<?> claz=null;
try {
claz=Class.forName(fullName);
}
 catch (ClassNotFoundException cnfe) {
LOG.warn("String_Node_Str" + fullName,cnfe);
break;
}
try {
value=claz.newInstance();
}
 catch (InstantiationException ie) {
LOG.warn("String_Node_Str",ie);
break;
}
catch (IllegalAccessException iae) {
LOG.warn("String_Node_Str",iae);
break;
}
if (value instanceof PersistentBase) {
PersistentBase record=(PersistentBase)value;
for (HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
String memberName=StringSerializer.get().fromByteBuffer(hColumn.getName());
if (memberName == null || memberName.length() == 0) {
LOG.warn("String_Node_Str");
continue;
}
if (!memberName.contains(CassandraStore.UNION_COL_SUFIX)) {
Field memberField=fieldSchema.getField(memberName);
Schema memberSchema=memberField.schema();
Type memberType=memberSchema.getType();
CassandraSubColumn cassandraColumn=new CassandraSubColumn();
cassandraColumn.setField(memberField);
cassandraColumn.setValue(hColumn);
if (memberType.equals(Type.UNION)) {
HColumn<ByteBuffer,ByteBuffer> hc=getUnionTypeColumn(memberField.name() + CassandraStore.UNION_COL_SUFIX,this.hSuperColumn.getColumns().toArray());
Integer unionIndex=getUnionIndex(memberField.name(),hc);
cassandraColumn.setUnionType(unionIndex);
}
record.put(record.getSchema().getField(memberName).pos(),cassandraColumn.getValue());
}
}
}
break;
case UNION:
int schemaPos=this.getUnionType();
Schema unioSchema=fieldSchema.getTypes().get(schemaPos);
Type unionType=unioSchema.getType();
value=getSuperValue(field,unioSchema,unionType);
break;
default :
Object memberValue=null;
for (HColumn<ByteBuffer,ByteBuffer> hColumn : this.hSuperColumn.getColumns()) {
memberValue=fromByteBuffer(fieldSchema,hColumn.getValue());
}
value=memberValue;
LOG.warn("String_Node_Str" + type.name() + "String_Node_Str"+ field.name());
}
return value;
}