Program: 44713
Project: 44713
Buggy source:
static <T>T unserialize(Class<T> clazz,ByteArrayInputStream stream) throws IllegalArgumentException, IllegalAccessException, InstantiationException {
  List<TLV> values=Marshaller.unmarshall(stream);
  T result=clazz.newInstance();
  for (  java.lang.reflect.Field property : result.getClass().getDeclaredFields()) {
    Field field=property.getAnnotation(Field.class);
    if (field == null) {
      throw new UnsupportedOperationException("String_Node_Str");
    }
    boolean optional=(property.getType() == Optional.class);
    boolean found=false;
    for (    TLV value : values) {
      if (value.type == field.value()) {
        final Class<?> type=optional ? (Class<?>)((ParameterizedType)(property.getGenericType())).getActualTypeArguments()[0] : property.getType();
        if (type == String.class) {
          String content=new String(value.content);
          property.set(result,!optional ? content : Optional.of(content));
        }
 else         if (type == int.class) {
          int content=ByteBuffer.wrap(value.content).getInt();
          property.set(result,!optional ? content : Optional.of(content));
        }
 else         if (type == long.class) {
          long content=ByteBuffer.wrap(value.content).getLong();
          property.set(result,!optional ? content : Optional.of(content));
        }
 else {
          Object content=unserialize(type,new ByteArrayInputStream(value.content));
          property.set(result,!optional ? content : Optional.of(content));
        }
        found=true;
        break;
      }
    }
    if (!found) {
      if (optional) {
        property.set(result,Optional.absent());
      }
 else {
        throw new UnsupportedOperationException("String_Node_Str" + property);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
static <T>T unserialize(Class<T> clazz,ByteArrayInputStream stream) throws IllegalArgumentException, IllegalAccessException, InstantiationException {
  Type annotation=clazz.getAnnotation(Type.class);
  Preconditions.checkNotNull(annotation,"String_Node_Str" + clazz);
  int container=annotation.value();
  TLV data=unmarshall(stream);
  Preconditions.checkArgument(data.type == container,"String_Node_Str" + data.type + "String_Node_Str"+ container);
  T result=clazz.newInstance();
  ByteArrayInputStream body=new ByteArrayInputStream(data.content);
  for (  java.lang.reflect.Field property : result.getClass().getDeclaredFields()) {
    boolean optional=property.getType().equals(Optional.class);
    if (optional) {
      property.set(result,Optional.absent());
    }
  }
  while (body.available() != 0) {
    long id=decode(body);
    int length=(int)decode(body);
    ByteBuffer buffer=ByteBuffer.allocate(length);
    body.read(buffer.array(),0,length);
    byte[] content=buffer.array();
    for (    java.lang.reflect.Field property : result.getClass().getDeclaredFields()) {
      int match;
      Field field=property.getAnnotation(Field.class);
      boolean optional=property.getType().equals(Optional.class);
      Class<?> type=optional ? (Class<?>)((ParameterizedType)(property.getGenericType())).getActualTypeArguments()[0] : property.getType();
      if (field != null) {
        match=field.value();
        Preconditions.checkArgument(property.getType().getAnnotation(Type.class) == null,"String_Node_Str");
      }
 else       if (type != null) {
        match=type.getAnnotation(Type.class).value();
      }
 else {
        throw new UnsupportedOperationException("String_Node_Str" + "String_Node_Str" + property);
      }
      if (match != id) {
        continue;
      }
      if (type == String.class) {
        String value=new String(content);
        property.set(result,!optional ? value : Optional.of(value));
      }
 else       if (type == int.class) {
        int value=ByteBuffer.wrap(content).getInt();
        property.set(result,!optional ? value : Optional.of(value));
      }
 else       if (type == long.class) {
        long value=ByteBuffer.wrap(content).getLong();
        property.set(result,!optional ? value : Optional.of(value));
      }
 else {
        byte[] header1=encode(id);
        byte[] header2=encode(length);
        ByteBuffer buf=ByteBuffer.allocate(header1.length + header2.length + content.length);
        buf.put(header1);
        buf.put(header2);
        buf.put(content);
        Object value=unserialize(type,new ByteArrayInputStream(buf.array()));
        property.set(result,!optional ? value : Optional.of(value));
      }
    }
  }
  return result;
}