Program: 164527
Project: 164527
Buggy source:
@Override public void migrate(JdbcTemplate jdbcTemplate) throws Exception {
  Integer enabledCount=jdbcTemplate.queryForObject("String_Node_Str",Integer.class);
  if (enabledCount == 0) {
    return;
  }
  String dialect=flywayConfiguration.getLocations()[0].split("String_Node_Str")[1].toLowerCase(Locale.ROOT);
  QueryFactory queryFactory=new QueryFactory(dialect,jdbcTemplate);
  EventRepository eventRepository=queryFactory.from(EventRepository.class);
  ExtensionRepository extensionRepository=queryFactory.from(ExtensionRepository.class);
  ExtensionLogRepository extensionLogRepository=queryFactory.from(ExtensionLogRepository.class);
  PluginRepository pluginRepository=queryFactory.from(PluginRepository.class);
  ExtensionService extensionService=new ExtensionService(new ScriptingExecutionService(),extensionRepository,extensionLogRepository,new DataSourceTransactionManager(jdbcTemplate.getDataSource()));
  extensionService.createOrUpdate(null,null,new Extension("String_Node_Str","String_Node_Str",getMailChimpScript(),true));
  int extensionId=extensionRepository.getExtensionIdFor("String_Node_Str","String_Node_Str");
  int apiKeyId=pluginRepository.getConfigurationMetadataIdFor(extensionId,"String_Node_Str","String_Node_Str");
  int listIdId=pluginRepository.getConfigurationMetadataIdFor(extensionId,"String_Node_Str","String_Node_Str");
  List<ConfValue> confValues=pluginRepository.findAllMailChimpConfigurationValues();
  for (  ConfValue cv : confValues) {
    if (cv.value != null) {
      Optional<Event> ev=eventRepository.findOptionalById(cv.eventId);
      ev.ifPresent(event -> {
        int orgId=event.getOrganizationId();
        extensionRepository.insertSettingValue("String_Node_Str".equals(cv.name) ? apiKeyId : listIdId,"String_Node_Str" + orgId + "String_Node_Str"+ cv.eventId,cv.value);
      }
);
    }
  }
}

Fixed version (ground truth):
@Override public void migrate(JdbcTemplate jdbcTemplate) throws Exception {
  Integer enabledCount=jdbcTemplate.queryForObject("String_Node_Str",Integer.class);
  if (enabledCount == 0) {
    return;
  }
  String dialect=flywayConfiguration.getLocations()[0].split("String_Node_Str")[1].toLowerCase(Locale.ROOT);
  QueryFactory queryFactory=new QueryFactory(dialect,jdbcTemplate);
  EventRepository eventRepository=queryFactory.from(EventRepository.class);
  ExtensionRepository extensionRepository=queryFactory.from(ExtensionRepository.class);
  ExtensionLogRepository extensionLogRepository=queryFactory.from(ExtensionLogRepository.class);
  PluginRepository pluginRepository=queryFactory.from(PluginRepository.class);
  ExtensionService extensionService=new ExtensionService(new ScriptingExecutionService(),extensionRepository,extensionLogRepository,new DataSourceTransactionManager(jdbcTemplate.getDataSource()));
  extensionService.createOrUpdate(null,null,new Extension("String_Node_Str","String_Node_Str",getMailChimpScript(),true));
  int extensionId=extensionRepository.getExtensionIdFor("String_Node_Str","String_Node_Str");
  int apiKeyId=pluginRepository.getConfigurationMetadataIdFor(extensionId,"String_Node_Str","String_Node_Str");
  int listIdId=pluginRepository.getConfigurationMetadataIdFor(extensionId,"String_Node_Str","String_Node_Str");
  List<ConfValue> confValues=pluginRepository.findAllMailChimpConfigurationValues();
  for (  ConfValue cv : confValues) {
    if (cv.value != null) {
      optionally(() -> jdbcTemplate.queryForObject("String_Node_Str" + cv.eventId,Integer.class)).ifPresent(orgId -> extensionRepository.insertSettingValue("String_Node_Str".equals(cv.name) ? apiKeyId : listIdId,"String_Node_Str" + orgId + "String_Node_Str"+ cv.eventId,cv.value));
    }
  }
}