Program: 160390
Project: 160390
Buggy source:
public void updateUserPlugin(DatabaseSession session,User user,PluginDescriptor pluginDescriptor,PluginContext pluginContext) throws BimserverDatabaseException {
  if (pluginDescriptor.isInstallForNewUsers()) {
    UserSettings userSettings=user.getUserSettings();
    if (userSettings == null) {
      userSettings=session.create(UserSettings.class);
      user.setUserSettings(userSettings);
      session.store(user);
    }
    Class<?> pluginInterface=getPluginInterface(pluginContext.getPlugin().getClass());
    String pluginInterfaceName=pluginInterface.getSimpleName();
    if (pluginInterfaceName.endsWith("String_Node_Str")) {
      pluginInterfaceName=pluginInterfaceName.substring(0,pluginInterfaceName.length() - 6);
    }
    if (pluginInterfaceName.equals("String_Node_Str") || pluginInterfaceName.equals("String_Node_Str") || pluginInterfaceName.equals("String_Node_Str")) {
      pluginInterfaceName="String_Node_Str";
    }
    if (pluginInterfaceName.equals("String_Node_Str")) {
      pluginInterfaceName="String_Node_Str";
    }
    if (pluginInterfaceName.equals("String_Node_Str") || pluginInterfaceName.equals("String_Node_Str")) {
      return;
    }
    EClass userSettingsClass=StorePackage.eINSTANCE.getUserSettings();
    String listRefName=StringUtils.firstLowerCase(pluginInterfaceName) + "String_Node_Str";
    EReference listReference=(EReference)userSettingsClass.getEStructuralFeature(listRefName);
    if (listReference == null) {
      LOGGER.warn(listRefName + "String_Node_Str");
      return;
    }
    EReference defaultReference=(EReference)userSettingsClass.getEStructuralFeature("String_Node_Str" + pluginInterfaceName);
    EClass pluginConfigurationClass=(EClass)listReference.getEType();
    List<PluginConfiguration> list=(List<PluginConfiguration>)userSettings.eGet(listReference);
    PluginConfiguration pluginConfiguration=find(list,pluginContext.getIdentifier());
    if (pluginConfiguration == null) {
      pluginConfiguration=(PluginConfiguration)session.create(pluginConfigurationClass);
      list.add(pluginConfiguration);
      genericPluginConversion(pluginContext,session,pluginConfiguration,pluginDescriptor);
    }
    if (defaultReference != null) {
      if (userSettings.eGet(defaultReference) == null && !list.isEmpty()) {
        userSettings.eSet(defaultReference,list.get(0));
      }
    }
    session.store(userSettings);
  }
}

Fixed version (ground truth):
public void updateUserPlugin(DatabaseSession session,User user,PluginDescriptor pluginDescriptor,PluginContext pluginContext) throws BimserverDatabaseException {
  if (pluginDescriptor.isInstallForNewUsers()) {
    UserSettings userSettings=user.getUserSettings();
    if (userSettings == null) {
      userSettings=session.create(UserSettings.class);
      user.setUserSettings(userSettings);
      session.store(user);
    }
    Class<?> pluginInterface=getPluginInterface(pluginContext.getPlugin().getClass());
    String originalPluginInterfaceName=pluginInterface.getSimpleName();
    String pluginInterfaceName=pluginInterface.getSimpleName();
    if (pluginInterfaceName.endsWith("String_Node_Str")) {
      pluginInterfaceName=pluginInterfaceName.substring(0,pluginInterfaceName.length() - 6);
    }
    if (pluginInterfaceName.equals("String_Node_Str") || pluginInterfaceName.equals("String_Node_Str") || pluginInterfaceName.equals("String_Node_Str")) {
      pluginInterfaceName="String_Node_Str";
    }
    if (pluginInterfaceName.equals("String_Node_Str")) {
      pluginInterfaceName="String_Node_Str";
    }
    if (pluginInterfaceName.equals("String_Node_Str") || pluginInterfaceName.equals("String_Node_Str")) {
      return;
    }
    EClass userSettingsClass=StorePackage.eINSTANCE.getUserSettings();
    String listRefName=StringUtils.firstLowerCase(pluginInterfaceName) + "String_Node_Str";
    EReference listReference=(EReference)userSettingsClass.getEStructuralFeature(listRefName);
    if (listReference == null) {
      LOGGER.warn(listRefName + "String_Node_Str");
      return;
    }
    EReference defaultReference=(EReference)userSettingsClass.getEStructuralFeature("String_Node_Str" + pluginInterfaceName);
    EClass pluginConfigurationClass=(EClass)listReference.getEType();
    List<PluginConfiguration> list=(List<PluginConfiguration>)userSettings.eGet(listReference);
    PluginConfiguration pluginConfiguration=find(list,pluginContext.getIdentifier());
    if (pluginConfiguration == null) {
      pluginConfiguration=(PluginConfiguration)session.create(pluginConfigurationClass);
      if (pluginConfiguration instanceof SerializerPluginConfiguration) {
        boolean streaming=originalPluginInterfaceName.equals("String_Node_Str") || originalPluginInterfaceName.equals("String_Node_Str");
        ((SerializerPluginConfiguration)pluginConfiguration).setStreaming(streaming);
      }
      list.add(pluginConfiguration);
      genericPluginConversion(pluginContext,session,pluginConfiguration,pluginDescriptor);
    }
    if (defaultReference != null) {
      if (userSettings.eGet(defaultReference) == null && !list.isEmpty()) {
        userSettings.eSet(defaultReference,list.get(0));
      }
    }
    session.store(userSettings);
  }
}