nus-yam/ex-repair huggingface dataset:
Program: 179289
Project: 179289
Buggy source:
/** 
 * This method serializes the specified object, including those of generic types, into its equivalent Json representation. This method must be used if the specified object is a generic type. For non-generic objects, use   {@link #toJson(Object,Writer)} instead.
 * @param src the object for which JSON representation is to be created
 * @param typeOfSrc The specific genericized type of src. You can obtainthis type by using the  {@link com.google.gson.reflect.TypeToken} class. For example,to get the type for  {@code Collection<Foo>}, you should use: <pre> Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre>
 * @param writer Writer to which the Json representation of src needs to be written.
 * @since 1.2
 */
public void toJson(Object src,Type typeOfSrc,Writer writer){
  if (src != null) {
    JsonSerializationContext context=new JsonSerializationContextDefault(createDefaultObjectNavigatorFactory(),serializeNulls,serializers);
    JsonElement jsonElement=context.serialize(src,typeOfSrc);
    formatter.format(jsonElement,new PrintWriter(writer),serializeNulls);
  }
 else {
    if (serializeNulls) {
      writeOutNullString(writer);
    }
  }
}

Fixed version (ground truth):
/** 
 * This method serializes the specified object, including those of generic types, into its equivalent Json representation. This method must be used if the specified object is a generic type. For non-generic objects, use   {@link #toJson(Object,Appendable)} instead.
 * @param src the object for which JSON representation is to be created
 * @param typeOfSrc The specific genericized type of src. You can obtainthis type by using the  {@link com.google.gson.reflect.TypeToken} class. For example,to get the type for  {@code Collection<Foo>}, you should use: <pre> Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre>
 * @param writer Writer to which the Json representation of src needs to be written.
 * @since 1.2
 */
public void toJson(Object src,Type typeOfSrc,Appendable writer){
  try {
    if (src != null) {
      JsonSerializationContext context=new JsonSerializationContextDefault(createDefaultObjectNavigatorFactory(),serializeNulls,serializers);
      JsonElement jsonElement=context.serialize(src,typeOfSrc);
      formatter.format(jsonElement,writer,serializeNulls);
    }
 else {
      if (serializeNulls) {
        writeOutNullString(writer);
      }
    }
  }
 catch (  IOException ioe) {
    throw new RuntimeException(ioe);
  }
}
Program: 179290
Project: 179290
Buggy source:
public void startObject(JsonObject object){
  writer.append('{');
}

Fixed version (ground truth):
public void startObject(JsonObject object) throws IOException {
  writer.append('{');
}
Program: 179291
Project: 179291
Buggy source:
public void visitPrimitive(JsonPrimitive primitive){
  writer.append(primitive.toString());
}

Fixed version (ground truth):
public void visitPrimitive(JsonPrimitive primitive) throws IOException {
  writer.append(primitive.toString());
}
Program: 179292
Project: 179292
Buggy source:
public void startArray(JsonArray array){
  writer.append('[');
}

Fixed version (ground truth):
public void startArray(JsonArray array) throws IOException {
  writer.append('[');
}
Program: 179293
Project: 179293
Buggy source:
public void visitNullArrayMember(JsonArray parent,boolean isFirst){
  if (!isFirst) {
    writer.append(',');
  }
}

Fixed version (ground truth):
public void visitNullArrayMember(JsonArray parent,boolean isFirst) throws IOException {
  if (!isFirst) {
    writer.append(',');
  }
}
Program: 179294
Project: 179294
Buggy source:
public void visitNull(){
  writer.append("String_Node_Str");
}

Fixed version (ground truth):
public void visitNull() throws IOException {
  writer.append("String_Node_Str");
}
Program: 179295
Project: 179295
Buggy source:
public void format(JsonElement root,PrintWriter writer,boolean serializeNulls){
  if (root == null) {
    return;
  }
  JsonElementVisitor visitor=new JsonEscapingVisitor(new FormattingVisitor(writer,serializeNulls));
  JsonTreeNavigator navigator=new JsonTreeNavigator(visitor,serializeNulls);
  navigator.navigate(root);
}

Fixed version (ground truth):
public void format(JsonElement root,Appendable writer,boolean serializeNulls) throws IOException {
  if (root == null) {
    return;
  }
  JsonElementVisitor visitor=new JsonEscapingVisitor(new FormattingVisitor(writer,serializeNulls));
  JsonTreeNavigator navigator=new JsonTreeNavigator(visitor,serializeNulls);
  navigator.navigate(root);
}
Program: 179296
Project: 179296
Buggy source:
public void visitObjectMember(JsonObject parent,String memberName,JsonObject member,boolean isFirst){
  if (!isFirst) {
    writer.append(',');
  }
  writer.append('"');
  writer.append(memberName);
  writer.append("String_Node_Str");
}

Fixed version (ground truth):
public void visitObjectMember(JsonObject parent,String memberName,JsonObject member,boolean isFirst) throws IOException {
  if (!isFirst) {
    writer.append(',');
  }
  writer.append('"');
  writer.append(memberName);
  writer.append("String_Node_Str");
}
Program: 179297
Project: 179297
Buggy source:
public void visitNullObjectMember(JsonObject parent,String memberName,boolean isFirst){
  if (serializeNulls) {
    visitObjectMember(parent,memberName,(JsonObject)null,isFirst);
  }
}

Fixed version (ground truth):
public void visitNullObjectMember(JsonObject parent,String memberName,boolean isFirst) throws IOException {
  if (serializeNulls) {
    visitObjectMember(parent,memberName,(JsonObject)null,isFirst);
  }
}
Program: 179298
Project: 179298
Buggy source:
public void visitArrayMember(JsonArray parent,JsonObject member,boolean isFirst){
  if (!isFirst) {
    writer.append(',');
  }
}

Fixed version (ground truth):
public void visitArrayMember(JsonArray parent,JsonObject member,boolean isFirst) throws IOException {
  if (!isFirst) {
    writer.append(',');
  }
}
Program: 179299
Project: 179299
Buggy source:
public void endArray(JsonArray array){
  writer.append(']');
}

Fixed version (ground truth):
public void endArray(JsonArray array) throws IOException {
  writer.append(']');
}
Program: 179300
Project: 179300
Buggy source:
FormattingVisitor(PrintWriter writer,boolean serializeNulls){
  this.writer=writer;
  this.serializeNulls=serializeNulls;
}

Fixed version (ground truth):
FormattingVisitor(Appendable writer,boolean serializeNulls){
  this.writer=writer;
  this.serializeNulls=serializeNulls;
}
Program: 179301
Project: 179301
Buggy source:
public void endObject(JsonObject object){
  writer.append('}');
}

Fixed version (ground truth):
public void endObject(JsonObject object) throws IOException {
  writer.append('}');
}
Program: 179302
Project: 179302
Buggy source:
void startObject(JsonObject object);

Fixed version (ground truth):
void startObject(JsonObject object) throws IOException ;
Program: 179303
Project: 179303
Buggy source:
void visitPrimitive(JsonPrimitive primitive);

Fixed version (ground truth):
void visitPrimitive(JsonPrimitive primitive) throws IOException ;
Program: 179304
Project: 179304
Buggy source:
void startArray(JsonArray array);

Fixed version (ground truth):
void startArray(JsonArray array) throws IOException ;
Program: 179305
Project: 179305
Buggy source:
void visitNullArrayMember(JsonArray parent,boolean isFirst);

Fixed version (ground truth):
void visitNullArrayMember(JsonArray parent,boolean isFirst) throws IOException ;
Program: 179306
Project: 179306
Buggy source:
void visitNull();

Fixed version (ground truth):
void visitNull() throws IOException ;
Program: 179307
Project: 179307
Buggy source:
void visitObjectMember(JsonObject parent,String memberName,JsonObject member,boolean isFirst);

Fixed version (ground truth):
void visitObjectMember(JsonObject parent,String memberName,JsonObject member,boolean isFirst) throws IOException ;
Program: 179308
Project: 179308
Buggy source:
void visitNullObjectMember(JsonObject parent,String memberName,boolean isFirst);

Fixed version (ground truth):
void visitNullObjectMember(JsonObject parent,String memberName,boolean isFirst) throws IOException ;
Program: 179309
Project: 179309
Buggy source:
void visitArrayMember(JsonArray parent,JsonObject member,boolean isFirst);

Fixed version (ground truth):
void visitArrayMember(JsonArray parent,JsonObject member,boolean isFirst) throws IOException ;
Program: 179310
Project: 179310
Buggy source:
void endArray(JsonArray array);

Fixed version (ground truth):
void endArray(JsonArray array) throws IOException ;
Program: 179311
Project: 179311
Buggy source:
void endObject(JsonObject object);

Fixed version (ground truth):
void endObject(JsonObject object) throws IOException ;
Program: 179312
Project: 179312
Buggy source:
@SuppressWarnings("String_Node_Str") public boolean visitUsingCustomHandler(Object obj,Type objType){
  JsonSerializer serializer=serializers.getHandlerFor(objType);
  if (serializer == null && obj instanceof Map) {
    serializer=serializers.getHandlerFor(Map.class);
  }
  if (serializer != null) {
    assignToRoot(serializer.serialize(obj,objType,context));
    return true;
  }
  return false;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public boolean visitUsingCustomHandler(Object obj,Type objType){
  JsonSerializer serializer=serializers.getHandlerFor(objType);
  if (serializer == null && obj instanceof Map) {
    serializer=serializers.getHandlerFor(Map.class);
  }
  if (serializer != null) {
    if (obj == null) {
      assignToRoot(JsonNull.INSTANCE);
    }
 else {
      assignToRoot(serializer.serialize(obj,objType,context));
    }
    return true;
  }
  return false;
}
Program: 179313
Project: 179313
Buggy source:
private void navigateClassFields(Object obj,Class<?> clazz,Visitor visitor){
  Field[] fields=clazz.getDeclaredFields();
  AccessibleObject.setAccessible(fields,true);
  for (  Field f : fields) {
    TypeInfo fieldTypeInfo=TypeInfoFactory.getTypeInfoForField(f,objType);
    Type actualTypeOfField=fieldTypeInfo.getActualType();
    if (exclusionStrategy.shouldSkipField(f)) {
      continue;
    }
 else     if (fieldTypeInfo.isCollectionOrArray()) {
      if (fieldTypeInfo.isArray()) {
        visitor.visitArrayField(f,actualTypeOfField,obj);
      }
 else {
        visitor.visitCollectionField(f,actualTypeOfField,obj);
      }
    }
 else     if (fieldTypeInfo.isPrimitiveOrStringAndNotAnArray()) {
      visitor.visitPrimitiveField(f,actualTypeOfField,obj);
    }
 else {
      visitor.visitObjectField(f,actualTypeOfField,obj);
    }
  }
}

Fixed version (ground truth):
private void navigateClassFields(Object obj,Class<?> clazz,Visitor visitor){
  Field[] fields=clazz.getDeclaredFields();
  AccessibleObject.setAccessible(fields,true);
  for (  Field f : fields) {
    TypeInfo fieldTypeInfo=TypeInfoFactory.getTypeInfoForField(f,objType);
    Type actualTypeOfField=fieldTypeInfo.getActualType();
    if (exclusionStrategy.shouldSkipField(f)) {
      continue;
    }
 else {
      boolean visitedWithCustomHandler=visitor.visitFieldUsingCustomHandler(f,actualTypeOfField,obj);
      if (!visitedWithCustomHandler) {
        if (fieldTypeInfo.isCollectionOrArray()) {
          if (fieldTypeInfo.isArray()) {
            visitor.visitArrayField(f,actualTypeOfField,obj);
          }
 else {
            visitor.visitCollectionField(f,actualTypeOfField,obj);
          }
        }
 else         if (fieldTypeInfo.isPrimitiveOrStringAndNotAnArray()) {
          visitor.visitPrimitiveField(f,actualTypeOfField,obj);
        }
 else {
          visitor.visitObjectField(f,actualTypeOfField,obj);
        }
      }
    }
  }
}
Program: 179314
Project: 179314
Buggy source:
/** 
 * Navigate all the fields of the specified object. If a field is null, it does not get visited.
 */
public void accept(Visitor visitor){
  if (obj == null) {
    return;
  }
  TypeInfo objTypeInfo=new TypeInfo(objType);
  if (exclusionStrategy.shouldSkipClass(objTypeInfo.getRawClass())) {
    return;
  }
  if (ancestors.contains(obj)) {
    throw new IllegalStateException("String_Node_Str" + obj);
  }
  ancestors.push(obj);
  try {
    if (objTypeInfo.isCollectionOrArray()) {
      if (objTypeInfo.isArray()) {
        visitor.visitArray(obj,objType);
      }
 else {
        visitor.visitCollection((Collection<?>)obj,objType);
      }
    }
 else     if (objTypeInfo.isEnum()) {
      visitor.visitEnum(obj,objType);
    }
 else     if (objTypeInfo.isPrimitiveOrStringAndNotAnArray()) {
      visitor.visitPrimitiveValue(obj);
    }
 else {
      if (!visitor.visitUsingCustomHandler(obj,objType)) {
        visitor.startVisitingObject(obj);
        for (Class<?> curr=objTypeInfo.getRawClass(); curr != null && !curr.equals(Object.class); curr=curr.getSuperclass()) {
          if (!curr.isSynthetic()) {
            navigateClassFields(obj,curr,visitor);
          }
        }
        visitor.endVisitingObject(obj);
      }
    }
  }
  finally {
    ancestors.pop();
  }
}

Fixed version (ground truth):
/** 
 * Navigate all the fields of the specified object. If a field is null, it does not get visited.
 */
public void accept(Visitor visitor){
  if (obj == null) {
    return;
  }
  TypeInfo objTypeInfo=new TypeInfo(objType);
  if (exclusionStrategy.shouldSkipClass(objTypeInfo.getRawClass())) {
    return;
  }
  if (ancestors.contains(obj)) {
    throw new IllegalStateException("String_Node_Str" + obj);
  }
  ancestors.push(obj);
  try {
    boolean visitedWithCustomHandler=visitor.visitUsingCustomHandler(obj,objType);
    if (!visitedWithCustomHandler) {
      if (objTypeInfo.isCollectionOrArray()) {
        if (objTypeInfo.isArray()) {
          visitor.visitArray(obj,objType);
        }
 else {
          visitor.visitCollection((Collection<?>)obj,objType);
        }
      }
 else       if (objTypeInfo.isEnum()) {
        visitor.visitEnum(obj,objType);
      }
 else       if (objTypeInfo.isPrimitiveOrStringAndNotAnArray()) {
        visitor.visitPrimitiveValue(obj);
      }
 else {
        visitor.startVisitingObject(obj);
        for (Class<?> curr=objTypeInfo.getRawClass(); curr != null && !curr.equals(Object.class); curr=curr.getSuperclass()) {
          if (!curr.isSynthetic()) {
            navigateClassFields(obj,curr,visitor);
          }
        }
        visitor.endVisitingObject(obj);
      }
    }
  }
  finally {
    ancestors.pop();
  }
}
Program: 179315
Project: 179315
Buggy source:
public JsonElement serialize(Foo src,Type typeOfSrc,JsonSerializationContext context){
  return context.serialize(src,typeOfSrc);
}

Fixed version (ground truth):
public JsonElement serialize(Long src,Type typeOfSrc,JsonSerializationContext context){
  customSerializerInvoked.value=true;
  return src == null ? new JsonNull() : new JsonPrimitive(src);
}
Program: 179316
Project: 179316
Buggy source:
public Long deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
  customDeserializerInvoked.value=true;
  String str=json.getAsJsonPrimitive().getAsString();
  return str.length() == 0 ? null : Long.parseLong(str);
}

Fixed version (ground truth):
public Long deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
  customDeserializerInvoked.value=true;
  if (json == null || json.isJsonNull()) {
    return null;
  }
 else {
    Number number=json.getAsJsonPrimitive().getAsNumber();
    return number == null ? null : number.longValue();
  }
}
Program: 179317
Project: 179317
Buggy source:
public void testCustomDeserializerForLong(){
  final ClassWithBooleanField customDeserializerInvoked=new ClassWithBooleanField();
  customDeserializerInvoked.value=false;
  Gson gson=new GsonBuilder().registerTypeAdapter(Long.class,new JsonDeserializer<Long>(){
    public Long deserialize(    JsonElement json,    Type typeOfT,    JsonDeserializationContext context) throws JsonParseException {
      customDeserializerInvoked.value=true;
      String str=json.getAsJsonPrimitive().getAsString();
      return str.length() == 0 ? null : Long.parseLong(str);
    }
  }
).create();
  String json="String_Node_Str";
  ClassWithWrapperLongField target=gson.fromJson(json,ClassWithWrapperLongField.class);
  assertNull(target.value);
  assertTrue(customDeserializerInvoked.value);
}

Fixed version (ground truth):
public void testCustomDeserializerForLong(){
  final ClassWithBooleanField customDeserializerInvoked=new ClassWithBooleanField();
  customDeserializerInvoked.value=false;
  Gson gson=new GsonBuilder().registerTypeAdapter(Long.class,new JsonDeserializer<Long>(){
    public Long deserialize(    JsonElement json,    Type typeOfT,    JsonDeserializationContext context) throws JsonParseException {
      customDeserializerInvoked.value=true;
      if (json == null || json.isJsonNull()) {
        return null;
      }
 else {
        Number number=json.getAsJsonPrimitive().getAsNumber();
        return number == null ? null : number.longValue();
      }
    }
  }
).create();
  String json="String_Node_Str";
  ClassWithWrapperLongField target=gson.fromJson(json,ClassWithWrapperLongField.class);
  assertNull(target.value);
  assertTrue(customDeserializerInvoked.value);
  customDeserializerInvoked.value=false;
  json="String_Node_Str";
  target=gson.fromJson(json,ClassWithWrapperLongField.class);
  assertEquals(10L,target.value.longValue());
  assertTrue(customDeserializerInvoked.value);
}
Program: 179318
Project: 179318
Buggy source:
public void visitObjectField(Field f,Type typeOfF,Object obj){
  if (isFieldNull(f,obj)) {
    if (serializeNulls) {
      addChildAsElement(f,new JsonNull());
    }
  }
 else {
    Object fieldValue=getFieldValue(f,obj);
    if (fieldValue != null && typeOfF instanceof Class) {
      Class<?> classOfF=(Class<?>)typeOfF;
      Class<?> actualClassOfF=fieldValue.getClass();
      if (classOfF.isAssignableFrom(actualClassOfF)) {
        typeOfF=actualClassOfF;
      }
    }
    addAsChildOfObject(f,typeOfF,fieldValue);
  }
}

Fixed version (ground truth):
public void visitObjectField(Field f,Type typeOfF,Object obj){
  if (isFieldNull(f,obj)) {
    if (serializeNulls) {
      addChildAsElement(f,new JsonNull());
    }
  }
 else {
    Object fieldValue=getFieldValue(f,obj);
    if (fieldValue != null && typeOfF == Object.class) {
      typeOfF=fieldValue.getClass();
    }
    addAsChildOfObject(f,typeOfF,fieldValue);
  }
}
Program: 179319
Project: 179319
Buggy source:
/** 
 * This method serializes the specified object, including those of generic types, into its equivalent Json representation. This method must be used if the specified object is a generic type. For non-generic objects, use   {@link #toJson(Object,Writer)} instead.
 * @param src the object for which JSON representation is to be created
 * @param typeOfSrc The specific genericized type of src. You can obtainthis type by using the  {@link com.google.gson.reflect.TypeToken} class. For example,to get the type for  {@code Collection<Foo>}, you should use: <pre> Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre>
 * @param writer Writer to which the Json representation of src needs to be written.
 * @since 1.2
 */
public void toJson(Object src,Type typeOfSrc,Writer writer){
  if (src != null) {
    JsonSerializationContext context=new JsonSerializationContextDefault(navigatorFactory,serializeNulls,serializers);
    JsonElement jsonElement=context.serialize(src,typeOfSrc);
    formatter.format(jsonElement,new PrintWriter(writer),serializeNulls);
  }
 else {
    if (serializeNulls) {
      writeOutNullString(writer);
    }
  }
}

Fixed version (ground truth):
/** 
 * This method serializes the specified object, including those of generic types, into its equivalent Json representation. This method must be used if the specified object is a generic type. For non-generic objects, use   {@link #toJson(Object,Writer)} instead.
 * @param src the object for which JSON representation is to be created
 * @param typeOfSrc The specific genericized type of src. You can obtainthis type by using the  {@link com.google.gson.reflect.TypeToken} class. For example,to get the type for  {@code Collection<Foo>}, you should use: <pre> Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre>
 * @param writer Writer to which the Json representation of src needs to be written.
 * @since 1.2
 */
public void toJson(Object src,Type typeOfSrc,Writer writer){
  if (src != null) {
    JsonSerializationContext context=new JsonSerializationContextDefault(createDefaultObjectNavigatorFactory(),serializeNulls,serializers);
    JsonElement jsonElement=context.serialize(src,typeOfSrc);
    formatter.format(jsonElement,new PrintWriter(writer),serializeNulls);
  }
 else {
    if (serializeNulls) {
      writeOutNullString(writer);
    }
  }
}
Program: 179320
Project: 179320
Buggy source:
Gson(ObjectNavigatorFactory factory,MappedObjectConstructor objectConstructor,TypeAdapter typeAdapter,JsonFormatter formatter,boolean serializeNulls,ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers,ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers){
  this.navigatorFactory=factory;
  this.objectConstructor=objectConstructor;
  this.typeAdapter=typeAdapter;
  this.formatter=formatter;
  this.serializeNulls=serializeNulls;
  this.serializers=serializers;
  this.deserializers=deserializers;
}

Fixed version (ground truth):
Gson(ExclusionStrategy strategy,FieldNamingStrategy fieldNamingPolicy,MappedObjectConstructor objectConstructor,TypeAdapter typeAdapter,JsonFormatter formatter,boolean serializeNulls,ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers,ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers){
  this.strategy=strategy;
  this.fieldNamingPolicy=fieldNamingPolicy;
  this.objectConstructor=objectConstructor;
  this.typeAdapter=typeAdapter;
  this.formatter=formatter;
  this.serializeNulls=serializeNulls;
  this.serializers=serializers;
  this.deserializers=deserializers;
}
Program: 179321
Project: 179321
Buggy source:
private static ObjectNavigatorFactory createDefaultObjectNavigatorFactory(){
  return new ObjectNavigatorFactory(createExclusionStrategy(VersionConstants.IGNORE_VERSIONS),DEFAULT_NAMING_POLICY);
}

Fixed version (ground truth):
private ObjectNavigatorFactory createDefaultObjectNavigatorFactory(){
  return new ObjectNavigatorFactory(strategy,fieldNamingPolicy);
}
Program: 179324
Project: 179324
Buggy source:
public void testAnonymousLocalClassesSerialization(){
  Gson gson=new Gson(new ObjectNavigatorFactory(new ModifierBasedExclusionStrategy(true,Modifier.TRANSIENT,Modifier.STATIC),Gson.DEFAULT_NAMING_POLICY));
  assertEquals("String_Node_Str",gson.toJson(new ClassWithNoFields(){
  }
));
}

Fixed version (ground truth):
public void testAnonymousLocalClassesSerialization(){
  Gson gson=new Gson(new ModifierBasedExclusionStrategy(true,Modifier.TRANSIENT,Modifier.STATIC),Gson.DEFAULT_NAMING_POLICY);
  assertEquals("String_Node_Str",gson.toJson(new ClassWithNoFields(){
  }
));
}
Program: 179325
Project: 179325
Buggy source:
public void run(){
  MyObject myObj=new MyObject();
  try {
    startLatch.await();
    for (int i=0; i < 10; i++) {
      String json=gson.toJson(myObj);
    }
  }
 catch (  Throwable t) {
    failed.set(true);
  }
 finally {
    finishedLatch.countDown();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    startLatch.await();
    for (int i=0; i < 10; i++) {
      gson.fromJson("String_Node_Str",MyObject.class);
    }
  }
 catch (  Throwable t) {
    failed.set(true);
  }
 finally {
    finishedLatch.countDown();
  }
}
Program: 179326
Project: 179326
Buggy source:
private static void jj_la1_0(){
  jj_la1_0=new int[]{0x1d280c0,0x80,0x40000,0x1d280c0,0x40000,0x1d280c0,0x1c000c0,0x2000000,0x20,0x1000000,0x4c00,0x4c00,0x4c00};
}

Fixed version (ground truth):
private static void jj_la1_0(){
  jj_la1_0=new int[]{0x74a0340,0x300,0x100000,0x74a0340,0x100000,0x74a0340,0x7000340,0x8000000,0x20,0x4000000,0x13000,0x300,0x13000,0x13000};
}
Program: 179327
Project: 179327
Buggy source:
final private JsonPrimitive JsonPrimitive() throws ParseException {
  JsonPrimitive value;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case QUOTE:
    value=JsonString();
{
    if (true)     return value;
  }
break;
case DIGITS:
case 24:
value=JsonNumber();
{
if (true) return value;
}
break;
case 22:
jj_consume_token(22);
{
if (true) return new JsonPrimitive(true);
}
break;
case 23:
jj_consume_token(23);
{
if (true) return new JsonPrimitive(false);
}
break;
default :
jj_la1[6]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private JsonPrimitive JsonPrimitive() throws ParseException {
  JsonPrimitive value;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case SINGLE_QUOTE_LITERAL:
case QUOTE:
    value=JsonString();
{
    if (true)     return value;
  }
break;
case DIGITS:
case 26:
value=JsonNumber();
{
if (true) return value;
}
break;
case 24:
jj_consume_token(24);
{
if (true) return new JsonPrimitive(true);
}
break;
case 25:
jj_consume_token(25);
{
if (true) return new JsonPrimitive(false);
}
break;
default :
jj_la1[6]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
throw new Error("String_Node_Str");
}
Program: 179328
Project: 179328
Buggy source:
final private JsonObject JsonObject() throws ParseException {
  JsonObject o=new JsonObject();
  jj_consume_token(15);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case QUOTE:
    Members(o);
  break;
default :
jj_la1[1]=jj_gen;
;
}
jj_consume_token(16);
{
if (true) return o;
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private JsonObject JsonObject() throws ParseException {
  JsonObject o=new JsonObject();
  jj_consume_token(17);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case SINGLE_QUOTE_LITERAL:
case QUOTE:
    Members(o);
  break;
default :
jj_la1[1]=jj_gen;
;
}
jj_consume_token(18);
{
if (true) return o;
}
throw new Error("String_Node_Str");
}
Program: 179329
Project: 179329
Buggy source:
final private String JsonFrac() throws ParseException {
  String digits;
  jj_consume_token(25);
  digits=Digits();
{
    if (true)     return "String_Node_Str" + digits;
  }
  throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private String JsonFrac() throws ParseException {
  String digits;
  jj_consume_token(27);
  digits=Digits();
{
    if (true)     return "String_Node_Str" + digits;
  }
  throw new Error("String_Node_Str");
}
Program: 179330
Project: 179330
Buggy source:
final private void Elements(JsonArray array) throws ParseException {
  JsonElement element;
  element=JsonValue();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 18:
    jj_consume_token(18);
  Elements(array);
break;
default :
jj_la1[4]=jj_gen;
;
}
array.add(element);
}

Fixed version (ground truth):
final private void Elements(JsonArray array) throws ParseException {
  JsonElement element;
  element=JsonValue();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 20:
    jj_consume_token(20);
  Elements(array);
break;
default :
jj_la1[4]=jj_gen;
;
}
array.add(element);
}
Program: 179331
Project: 179331
Buggy source:
final private JsonNull JsonNull() throws ParseException {
  JsonNull json=new JsonNull();
  jj_consume_token(17);
{
    if (true)     return json;
  }
  throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private JsonNull JsonNull() throws ParseException {
  JsonNull json=new JsonNull();
  jj_consume_token(19);
{
    if (true)     return json;
  }
  throw new Error("String_Node_Str");
}
Program: 179332
Project: 179332
Buggy source:
final private char Char() throws ParseException {
  Token t;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case CHAR:
    t=jj_consume_token(CHAR);
  break;
case CNTRL_ESC:
t=jj_consume_token(CNTRL_ESC);
break;
case HEX_ESC:
t=jj_consume_token(HEX_ESC);
break;
default :
jj_la1[12]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (t.image.length() < 2) {
{
if (true) return t.image.charAt(0);
}
}
if (t.image.length() < 6) {
char c=t.image.charAt(1);
switch (t.image.charAt(1)) {
case 'b':
{
if (true) return (char)8;
}
break;
case 'f':
{
if (true) return (char)12;
}
break;
case 'n':
{
if (true) return (char)10;
}
break;
case 'r':
{
if (true) return (char)13;
}
break;
case 't':
{
if (true) return (char)9;
}
break;
default :
{
if (true) return c;
}
}
}
 else {
int i=Integer.valueOf(t.image.substring(2,6),16).intValue();
{
if (true) return (char)i;
}
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private char Char() throws ParseException {
  Token t;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case CHAR:
    t=jj_consume_token(CHAR);
  break;
case CNTRL_ESC:
t=jj_consume_token(CNTRL_ESC);
break;
case HEX_ESC:
t=jj_consume_token(HEX_ESC);
break;
default :
jj_la1[13]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (t.image.length() < 2) {
{
if (true) return t.image.charAt(0);
}
}
if (t.image.length() < 6) {
char c=t.image.charAt(1);
switch (t.image.charAt(1)) {
case 'b':
{
if (true) return (char)8;
}
break;
case 'f':
{
if (true) return (char)12;
}
break;
case 'n':
{
if (true) return (char)10;
}
break;
case 'r':
{
if (true) return (char)13;
}
break;
case 't':
{
if (true) return (char)9;
}
break;
default :
{
if (true) return c;
}
}
}
 else {
int i=Integer.valueOf(t.image.substring(2,6),16).intValue();
{
if (true) return (char)i;
}
}
throw new Error("String_Node_Str");
}
Program: 179333
Project: 179333
Buggy source:
public void ReInit(JsonParserTokenManager tm){
  token_source=tm;
  token=new Token();
  jj_ntk=-1;
  jj_gen=0;
  for (int i=0; i < 13; i++)   jj_la1[i]=-1;
}

Fixed version (ground truth):
public void ReInit(JsonParserTokenManager tm){
  token_source=tm;
  token=new Token();
  jj_ntk=-1;
  jj_gen=0;
  for (int i=0; i < 14; i++)   jj_la1[i]=-1;
}
Program: 179334
Project: 179334
Buggy source:
final private void Chars(StringBuffer strbuf) throws ParseException {
  char c;
  c=Char();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case CHAR:
case CNTRL_ESC:
case HEX_ESC:
    Chars(strbuf);
  break;
default :
jj_la1[11]=jj_gen;
;
}
strbuf.insert(0,c);
}

Fixed version (ground truth):
final private void Chars(StringBuffer strbuf) throws ParseException {
  char c;
  c=Char();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case CHAR:
case CNTRL_ESC:
case HEX_ESC:
    Chars(strbuf);
  break;
default :
jj_la1[12]=jj_gen;
;
}
strbuf.insert(0,c);
}
Program: 179335
Project: 179335
Buggy source:
final private String JsonInt() throws ParseException {
  String digits;
  boolean negative=false;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 24:
    jj_consume_token(24);
  negative=true;
break;
default :
jj_la1[9]=jj_gen;
;
}
digits=Digits();
if (negative) {
if (true) return "String_Node_Str" + digits;
}
{
if (true) return digits;
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private String JsonInt() throws ParseException {
  String digits;
  boolean negative=false;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 26:
    jj_consume_token(26);
  negative=true;
break;
default :
jj_la1[9]=jj_gen;
;
}
digits=Digits();
if (negative) {
if (true) return "String_Node_Str" + digits;
}
{
if (true) return digits;
}
throw new Error("String_Node_Str");
}
Program: 179336
Project: 179336
Buggy source:
final private void Pair(JsonObject o) throws ParseException {
  JsonPrimitive property;
  JsonElement value;
  property=JsonString();
  jj_consume_token(19);
  value=JsonValue();
  o.add(property.getAsString(),value);
}

Fixed version (ground truth):
final private void Pair(JsonObject o) throws ParseException {
  JsonPrimitive property;
  JsonElement value;
  property=JsonString();
  jj_consume_token(21);
  value=JsonValue();
  o.add(property.getAsString(),value);
}
Program: 179337
Project: 179337
Buggy source:
public JsonParser(JsonParserTokenManager tm){
  token_source=tm;
  token=new Token();
  jj_ntk=-1;
  jj_gen=0;
  for (int i=0; i < 13; i++)   jj_la1[i]=-1;
}

Fixed version (ground truth):
public JsonParser(JsonParserTokenManager tm){
  token_source=tm;
  token=new Token();
  jj_ntk=-1;
  jj_gen=0;
  for (int i=0; i < 14; i++)   jj_la1[i]=-1;
}
Program: 179338
Project: 179338
Buggy source:
public ParseException generateParseException(){
  jj_expentries.removeAllElements();
  boolean[] la1tokens=new boolean[26];
  for (int i=0; i < 26; i++) {
    la1tokens[i]=false;
  }
  if (jj_kind >= 0) {
    la1tokens[jj_kind]=true;
    jj_kind=-1;
  }
  for (int i=0; i < 13; i++) {
    if (jj_la1[i] == jj_gen) {
      for (int j=0; j < 32; j++) {
        if ((jj_la1_0[i] & (1 << j)) != 0) {
          la1tokens[j]=true;
        }
      }
    }
  }
  for (int i=0; i < 26; i++) {
    if (la1tokens[i]) {
      jj_expentry=new int[1];
      jj_expentry[0]=i;
      jj_expentries.addElement(jj_expentry);
    }
  }
  int[][] exptokseq=new int[jj_expentries.size()][];
  for (int i=0; i < jj_expentries.size(); i++) {
    exptokseq[i]=(int[])jj_expentries.elementAt(i);
  }
  return new ParseException(token,exptokseq,tokenImage);
}

Fixed version (ground truth):
public ParseException generateParseException(){
  jj_expentries.removeAllElements();
  boolean[] la1tokens=new boolean[28];
  for (int i=0; i < 28; i++) {
    la1tokens[i]=false;
  }
  if (jj_kind >= 0) {
    la1tokens[jj_kind]=true;
    jj_kind=-1;
  }
  for (int i=0; i < 14; i++) {
    if (jj_la1[i] == jj_gen) {
      for (int j=0; j < 32; j++) {
        if ((jj_la1_0[i] & (1 << j)) != 0) {
          la1tokens[j]=true;
        }
      }
    }
  }
  for (int i=0; i < 28; i++) {
    if (la1tokens[i]) {
      jj_expentry=new int[1];
      jj_expentry[0]=i;
      jj_expentries.addElement(jj_expentry);
    }
  }
  int[][] exptokseq=new int[jj_expentries.size()][];
  for (int i=0; i < jj_expentries.size(); i++) {
    exptokseq[i]=(int[])jj_expentries.elementAt(i);
  }
  return new ParseException(token,exptokseq,tokenImage);
}
Program: 179339
Project: 179339
Buggy source:
final private JsonElement JsonValue() throws ParseException {
  JsonElement o=null;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case QUOTE:
    o=JsonString();
  break;
case DIGITS:
case 24:
o=JsonNumber();
break;
case 15:
o=JsonObject();
break;
case 20:
o=JsonArray();
break;
case 22:
jj_consume_token(22);
o=new JsonPrimitive(true);
break;
case 23:
jj_consume_token(23);
o=new JsonPrimitive(false);
break;
case 17:
jj_consume_token(17);
break;
default :
jj_la1[5]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{
if (true) return o;
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private JsonElement JsonValue() throws ParseException {
  JsonElement o=null;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case SINGLE_QUOTE_LITERAL:
case QUOTE:
    o=JsonString();
  break;
case DIGITS:
case 26:
o=JsonNumber();
break;
case 17:
o=JsonObject();
break;
case 22:
o=JsonArray();
break;
case 24:
jj_consume_token(24);
o=new JsonPrimitive(true);
break;
case 25:
jj_consume_token(25);
o=new JsonPrimitive(false);
break;
case 19:
jj_consume_token(19);
break;
default :
jj_la1[5]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{
if (true) return o;
}
throw new Error("String_Node_Str");
}
Program: 179340
Project: 179340
Buggy source:
final public JsonElement parse() throws ParseException {
  JsonElement json=null;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 15:
    json=JsonObject();
  break;
case 20:
json=JsonArray();
break;
case DIGITS:
case QUOTE:
case 22:
case 23:
case 24:
json=JsonPrimitive();
break;
case 17:
json=JsonNull();
break;
default :
jj_la1[0]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{
if (true) return json;
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final public JsonElement parse() throws ParseException {
  JsonElement json=null;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 17:
    json=JsonObject();
  break;
case 22:
json=JsonArray();
break;
case DIGITS:
case SINGLE_QUOTE_LITERAL:
case QUOTE:
case 24:
case 25:
case 26:
json=JsonPrimitive();
break;
case 19:
json=JsonNull();
break;
default :
jj_la1[0]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{
if (true) return json;
}
throw new Error("String_Node_Str");
}
Program: 179341
Project: 179341
Buggy source:
final private JsonArray JsonArray() throws ParseException {
  JsonArray array=new JsonArray();
  jj_consume_token(20);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case DIGITS:
case QUOTE:
case 15:
case 17:
case 20:
case 22:
case 23:
case 24:
    Elements(array);
  break;
default :
jj_la1[3]=jj_gen;
;
}
jj_consume_token(21);
array.reverse();
{
if (true) return array;
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private JsonArray JsonArray() throws ParseException {
  JsonArray array=new JsonArray();
  jj_consume_token(22);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case DIGITS:
case SINGLE_QUOTE_LITERAL:
case QUOTE:
case 17:
case 19:
case 22:
case 24:
case 25:
case 26:
    Elements(array);
  break;
default :
jj_la1[3]=jj_gen;
;
}
jj_consume_token(23);
array.reverse();
{
if (true) return array;
}
throw new Error("String_Node_Str");
}
Program: 179342
Project: 179342
Buggy source:
final private JsonPrimitive JsonNumber() throws ParseException {
  String intpart=null, fracpart=null, exppart=null;
  intpart=JsonInt();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 25:
    fracpart=JsonFrac();
  break;
default :
jj_la1[7]=jj_gen;
;
}
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case E:
exppart=JsonExp();
break;
default :
jj_la1[8]=jj_gen;
;
}
Number n;
if (exppart != null) {
n=new BigDecimal(intpart + fracpart + exppart);
}
 else if (fracpart != null) {
n=new Double(intpart + fracpart);
}
 else {
if (intpart.length() < 10) {
n=new Integer(intpart);
}
 else if (intpart.length() < 19) {
n=new Long(intpart);
}
 else {
n=new BigInteger(intpart);
}
}
{
if (true) return new JsonPrimitive(n);
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private JsonPrimitive JsonNumber() throws ParseException {
  String intpart=null, fracpart=null, exppart=null;
  intpart=JsonInt();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 27:
    fracpart=JsonFrac();
  break;
default :
jj_la1[7]=jj_gen;
;
}
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case E:
exppart=JsonExp();
break;
default :
jj_la1[8]=jj_gen;
;
}
Number n;
if (exppart != null) {
n=new BigDecimal(intpart + fracpart + exppart);
}
 else if (fracpart != null) {
n=new Double(intpart + fracpart);
}
 else {
if (intpart.length() < 10) {
n=new Integer(intpart);
}
 else if (intpart.length() < 19) {
n=new Long(intpart);
}
 else {
n=new BigInteger(intpart);
}
}
{
if (true) return new JsonPrimitive(n);
}
throw new Error("String_Node_Str");
}
Program: 179343
Project: 179343
Buggy source:
final private JsonPrimitive JsonString() throws ParseException {
  StringBuffer strbuf=new StringBuffer();
  jj_consume_token(QUOTE);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case CHAR:
case CNTRL_ESC:
case HEX_ESC:
    Chars(strbuf);
  break;
default :
jj_la1[10]=jj_gen;
;
}
jj_consume_token(ENDQUOTE);
{
if (true) return new JsonPrimitive(strbuf.toString());
}
throw new Error("String_Node_Str");
}

Fixed version (ground truth):
final private JsonPrimitive JsonString() throws ParseException {
  StringBuffer strbuf=new StringBuffer();
  Token t;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case SINGLE_QUOTE_LITERAL:
    t=jj_consume_token(SINGLE_QUOTE_LITERAL);
  String value=t.image;
String valueWithInQuotes=value.substring(1,value.length() - 1);
{
if (true) return new JsonPrimitive(valueWithInQuotes);
}
break;
case QUOTE:
jj_consume_token(QUOTE);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case CHAR:
case CNTRL_ESC:
case HEX_ESC:
Chars(strbuf);
break;
default :
jj_la1[10]=jj_gen;
;
}
jj_consume_token(ENDQUOTE);
{
if (true) return new JsonPrimitive(strbuf.toString());
}
break;
default :
jj_la1[11]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
throw new Error("String_Node_Str");
}
Program: 179344
Project: 179344
Buggy source:
final private void Members(JsonObject o) throws ParseException {
  Pair(o);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 18:
    jj_consume_token(18);
  Members(o);
break;
default :
jj_la1[2]=jj_gen;
;
}
}

Fixed version (ground truth):
final private void Members(JsonObject o) throws ParseException {
  Pair(o);
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 20:
    jj_consume_token(20);
  Members(o);
break;
default :
jj_la1[2]=jj_gen;
;
}
}
Program: 179345
Project: 179345
Buggy source:
public void visitObjectField(Field f,Type typeOfF,Object obj){
  if (isFieldNull(f,obj)) {
    if (serializeNulls) {
      addChildAsElement(f,new JsonNull());
    }
  }
 else {
    Object fieldValue=getFieldValue(f,obj);
    addAsChildOfObject(f,typeOfF,fieldValue);
  }
}

Fixed version (ground truth):
public void visitObjectField(Field f,Type typeOfF,Object obj){
  if (isFieldNull(f,obj)) {
    if (serializeNulls) {
      addChildAsElement(f,new JsonNull());
    }
  }
 else {
    Object fieldValue=getFieldValue(f,obj);
    if (fieldValue != null && typeOfF instanceof Class) {
      Class<?> classOfF=(Class<?>)typeOfF;
      Class<?> actualClassOfF=fieldValue.getClass();
      if (classOfF.isAssignableFrom(actualClassOfF)) {
        typeOfF=actualClassOfF;
      }
    }
    addAsChildOfObject(f,typeOfF,fieldValue);
  }
}
Program: 179346
Project: 179346
Buggy source:
public DefaultDateTypeAdapter(int style){
  this.format=DateFormat.getDateInstance(style);
}

Fixed version (ground truth):
public DefaultDateTypeAdapter(int dateStyle,int timeStyle){
  this.format=DateFormat.getDateTimeInstance(dateStyle,timeStyle);
}
Program: 179347
Project: 179347
Buggy source:
/** 
 * Configures Gson to to serialize   {@code Date} objects according to the style value provided.You can call this method or  {@link #setDateFormat(String)} multiple times, but only the lastinvocation will be used to decide the serialization format. <p>Note that this style value should be one of the predefined constants in the {@code DateFormat} class. See the documentation in {@link java.text.DateFormat} for moreinformation on the valid style constants.</p>
 * @param style the predefined date style that date objects will be serialized/deserializedto/from
 * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
 * @since 1.2
 */
public GsonBuilder setDateFormat(int style){
  this.dateStyle=style;
  this.datePattern=null;
  return this;
}

Fixed version (ground truth):
/** 
 * Configures Gson to to serialize   {@code Date} objects according to the style value provided.You can call this method or  {@link #setDateFormat(String)} multiple times, but only the lastinvocation will be used to decide the serialization format. <p>Note that this style value should be one of the predefined constants in the {@code DateFormat} class. See the documentation in {@link java.text.DateFormat} for moreinformation on the valid style constants.</p>
 * @param dateStyle the predefined date style that date objects will be serialized/deserializedto/from
 * @param timeStyle the predefined style for the time portion of the date objects
 * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
 * @since 1.2
 */
public GsonBuilder setDateFormat(int dateStyle,int timeStyle){
  this.dateStyle=dateStyle;
  this.timeStyle=timeStyle;
  this.datePattern=null;
  return this;
}
Program: 179348
Project: 179348
Buggy source:
/** 
 * Creates a GsonBuilder instance that can be used to build Gson with various configuration settings. GsonBuilder follows the builder pattern, and it is typically used by first invoking various configuration methods to set desired options, and finally calling  {@link #create()}.
 */
public GsonBuilder(){
  ignoreVersionsAfter=VersionConstants.IGNORE_VERSIONS;
  innerClassExclusionStrategy=new InnerClassExclusionStrategy();
  modifierBasedExclusionStrategy=Gson.DEFAULT_MODIFIER_BASED_EXCLUSION_STRATEGY;
  excludeFieldsWithoutExposeAnnotation=false;
  typeAdapter=Gson.DEFAULT_TYPE_ADAPTER;
  formatter=Gson.DEFAULT_JSON_FORMATTER;
  fieldNamingPolicy=Gson.DEFAULT_NAMING_POLICY;
  instanceCreators=new ParameterizedTypeHandlerMap<InstanceCreator<?>>();
  serializers=new ParameterizedTypeHandlerMap<JsonSerializer<?>>();
  deserializers=new ParameterizedTypeHandlerMap<JsonDeserializer<?>>();
  serializeNulls=false;
  dateStyle=DateFormat.DEFAULT;
}

Fixed version (ground truth):
/** 
 * Creates a GsonBuilder instance that can be used to build Gson with various configuration settings. GsonBuilder follows the builder pattern, and it is typically used by first invoking various configuration methods to set desired options, and finally calling  {@link #create()}.
 */
public GsonBuilder(){
  ignoreVersionsAfter=VersionConstants.IGNORE_VERSIONS;
  innerClassExclusionStrategy=new InnerClassExclusionStrategy();
  modifierBasedExclusionStrategy=Gson.DEFAULT_MODIFIER_BASED_EXCLUSION_STRATEGY;
  excludeFieldsWithoutExposeAnnotation=false;
  typeAdapter=Gson.DEFAULT_TYPE_ADAPTER;
  formatter=Gson.DEFAULT_JSON_FORMATTER;
  fieldNamingPolicy=Gson.DEFAULT_NAMING_POLICY;
  instanceCreators=new ParameterizedTypeHandlerMap<InstanceCreator<?>>();
  serializers=new ParameterizedTypeHandlerMap<JsonSerializer<?>>();
  deserializers=new ParameterizedTypeHandlerMap<JsonDeserializer<?>>();
  serializeNulls=false;
  dateStyle=DateFormat.DEFAULT;
  timeStyle=DateFormat.DEFAULT;
}
Program: 179349
Project: 179349
Buggy source:
private static void addTypeAdaptersForDate(String datePattern,int dateStyle,ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers,ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers){
  DefaultDateTypeAdapter dateTypeAdapter=null;
  if (datePattern != null && !"String_Node_Str".equals(datePattern.trim())) {
    dateTypeAdapter=new DefaultDateTypeAdapter(datePattern);
  }
 else   if (dateStyle != DateFormat.DEFAULT) {
    dateTypeAdapter=new DefaultDateTypeAdapter(dateStyle);
  }
  if (dateTypeAdapter != null && !serializers.hasAnyHandlerFor(Date.class) && !deserializers.hasAnyHandlerFor(Date.class)) {
    serializers.register(Date.class,dateTypeAdapter);
    deserializers.register(Date.class,dateTypeAdapter);
  }
}

Fixed version (ground truth):
private static void addTypeAdaptersForDate(String datePattern,int dateStyle,int timeStyle,ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers,ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers){
  DefaultDateTypeAdapter dateTypeAdapter=null;
  if (datePattern != null && !"String_Node_Str".equals(datePattern.trim())) {
    dateTypeAdapter=new DefaultDateTypeAdapter(datePattern);
  }
 else   if (dateStyle != DateFormat.DEFAULT && timeStyle != DateFormat.DEFAULT) {
    dateTypeAdapter=new DefaultDateTypeAdapter(dateStyle,timeStyle);
  }
  if (dateTypeAdapter != null && !serializers.hasAnyHandlerFor(Date.class) && !deserializers.hasAnyHandlerFor(Date.class)) {
    serializers.register(Date.class,dateTypeAdapter);
    deserializers.register(Date.class,dateTypeAdapter);
  }
}
Program: 179351
Project: 179351
Buggy source:
public void testDefaultDateSerialization(){
  Date now=new Date();
  String json=gson.toJson(now);
  assertEquals("String_Node_Str" + DateFormat.getDateInstance().format(now) + "String_Node_Str",json);
}

Fixed version (ground truth):
public void testDefaultDateSerialization(){
  Date now=new Date();
  String json=gson.toJson(now);
  assertEquals("String_Node_Str" + DateFormat.getDateTimeInstance().format(now) + "String_Node_Str",json);
}
Program: 179352
Project: 179352
Buggy source:
public void testDateSerializationWithPattern() throws Exception {
  String pattern="String_Node_Str";
  DateFormat formatter=new SimpleDateFormat(pattern);
  Gson gson=new GsonBuilder().setDateFormat(DateFormat.LONG).setDateFormat(pattern).create();
  Date now=new Date();
  String json=gson.toJson(now);
  assertEquals("String_Node_Str" + formatter.format(now) + "String_Node_Str",json);
}

Fixed version (ground truth):
public void testDateSerializationWithPattern() throws Exception {
  String pattern="String_Node_Str";
  DateFormat formatter=new SimpleDateFormat(pattern);
  Gson gson=new GsonBuilder().setDateFormat(DateFormat.FULL).setDateFormat(pattern).create();
  Date now=new Date();
  String json=gson.toJson(now);
  assertEquals("String_Node_Str" + formatter.format(now) + "String_Node_Str",json);
}