Program: 155856
Project: 155856
Buggy source:
private static Realm createAndValidate(String absolutePath,boolean validateSchema){
  Map<String,Realm> realms=realmsCache.get();
  Realm realm=realms.get(absolutePath);
  if (realm == null) {
    realm=new Realm(absolutePath);
    realms.put(absolutePath,realm);
    realmsCache.set(realms);
  }
  if (validateSchema) {
    if (!validatedPaths.contains(absolutePath)) {
      Class<?> validationClass;
      try {
        validationClass=Class.forName("String_Node_Str");
      }
 catch (      ClassNotFoundException e) {
        throw new RealmException("String_Node_Str");
      }
      Method getProxyClassesMethod;
      try {
        getProxyClassesMethod=validationClass.getMethod("String_Node_Str");
      }
 catch (      NoSuchMethodException e) {
        throw new RealmException("String_Node_Str");
      }
      List<String> proxyClasses;
      try {
        proxyClasses=(List<String>)getProxyClassesMethod.invoke(null);
      }
 catch (      IllegalAccessException e) {
        throw new RealmException("String_Node_Str");
      }
catch (      InvocationTargetException e) {
        throw new RealmException("String_Node_Str");
      }
      realm.beginTransaction();
      long version=realm.getVersion();
      realm.commitTransaction();
      for (      String className : proxyClasses) {
        String modelClassName=Iterables.getLast(Splitter.on("String_Node_Str").split(className));
        String generatedClassName="String_Node_Str" + modelClassName + "String_Node_Str";
        Class<?> generatedClass;
        try {
          generatedClass=Class.forName(generatedClassName);
        }
 catch (        ClassNotFoundException e) {
          throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
        }
        if (version == -1) {
          Method initTableMethod;
          try {
            initTableMethod=generatedClass.getMethod("String_Node_Str",new Class[]{ImplicitTransaction.class});
          }
 catch (          NoSuchMethodException e) {
            throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
          }
          try {
            realm.beginTransaction();
            initTableMethod.invoke(null,realm.transaction);
          }
 catch (          IllegalAccessException e) {
            throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
          }
catch (          InvocationTargetException e) {
            throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
          }
 finally {
            realm.commitTransaction();
          }
        }
        Method validateMethod;
        try {
          validateMethod=generatedClass.getMethod("String_Node_Str",new Class[]{ImplicitTransaction.class});
        }
 catch (        NoSuchMethodException e) {
          throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
        }
        try {
          validateMethod.invoke(null,realm.transaction);
        }
 catch (        IllegalAccessException e) {
          throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
        }
catch (        InvocationTargetException e) {
          throw new RealmMigrationNeededException(e.getMessage());
        }
      }
      if (version == -1) {
        realm.beginTransaction();
        realm.setVersion(0);
        realm.commitTransaction();
      }
      validatedPaths.add(absolutePath);
    }
  }
  return realm;
}

Fixed version (ground truth):
private static Realm createAndValidate(String absolutePath,boolean validateSchema){
  Map<String,Realm> realms=realmsCache.get();
  Realm realm=realms.get(absolutePath);
  if (realm == null) {
    realm=new Realm(absolutePath);
    realms.put(absolutePath,realm);
    realmsCache.set(realms);
  }
  if (validateSchema) {
    if (!validatedPaths.contains(absolutePath)) {
      Class<?> validationClass;
      try {
        validationClass=Class.forName("String_Node_Str");
      }
 catch (      ClassNotFoundException e) {
        throw new RealmException("String_Node_Str");
      }
      Method getProxyClassesMethod;
      try {
        getProxyClassesMethod=validationClass.getMethod("String_Node_Str");
      }
 catch (      NoSuchMethodException e) {
        throw new RealmException("String_Node_Str");
      }
      List<String> proxyClasses;
      try {
        proxyClasses=(List<String>)getProxyClassesMethod.invoke(null);
      }
 catch (      IllegalAccessException e) {
        throw new RealmException("String_Node_Str");
      }
catch (      InvocationTargetException e) {
        throw new RealmException("String_Node_Str");
      }
      long version=realm.getVersion();
      try {
        if (version == UNVERSIONED) {
          realm.beginTransaction();
          realm.setVersion(0);
        }
        for (        String className : proxyClasses) {
          String modelClassName=Iterables.getLast(Splitter.on("String_Node_Str").split(className));
          String generatedClassName="String_Node_Str" + modelClassName + "String_Node_Str";
          Class<?> generatedClass;
          try {
            generatedClass=Class.forName(generatedClassName);
          }
 catch (          ClassNotFoundException e) {
            throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
          }
          if (version == UNVERSIONED) {
            Method initTableMethod;
            try {
              initTableMethod=generatedClass.getMethod("String_Node_Str",new Class[]{ImplicitTransaction.class});
            }
 catch (            NoSuchMethodException e) {
              throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
            }
            try {
              initTableMethod.invoke(null,realm.transaction);
            }
 catch (            IllegalAccessException e) {
              throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
            }
catch (            InvocationTargetException e) {
              throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
            }
          }
          Method validateMethod;
          try {
            validateMethod=generatedClass.getMethod("String_Node_Str",new Class[]{ImplicitTransaction.class});
          }
 catch (          NoSuchMethodException e) {
            throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
          }
          try {
            validateMethod.invoke(null,realm.transaction);
          }
 catch (          IllegalAccessException e) {
            throw new RealmException("String_Node_Str" + generatedClassName + "String_Node_Str");
          }
catch (          InvocationTargetException e) {
            throw new RealmMigrationNeededException(e.getMessage());
          }
        }
        validatedPaths.add(absolutePath);
      }
  finally {
        if (version == UNVERSIONED) {
          realm.commitTransaction();
        }
      }
    }
  }
  return realm;
}