Program: 38054
Project: 38054
Buggy source:
public AppLayoutComponent build(){
  if (navigationElementProvider == null) {
    if (variant.isTop())     navigationElementProvider=new DefaultLeftNavigationBadgeElementComponentProvider();
 else     navigationElementProvider=new DefaultLeftNavigationBadgeElementComponentProvider();
  }
  if (customElementProvider == null) {
    if (variant.isTop())     customElementProvider=new DefaultLeftClickableNavigationElementProvider();
 else     customElementProvider=new DefaultLeftClickableNavigationElementProvider();
  }
  if (sectionProvider == null) {
    if (variant.isTop())     sectionProvider=new DefaultLeftSectionElementComponentProvider();
 else     sectionProvider=new DefaultLeftSectionElementComponentProvider();
  }
  if (submenuProvider == null) {
    if (variant.isTop())     submenuProvider=new DefaultTopSubmenuNavigationElementProvider();
 else     submenuProvider=new DefaultLeftSubmenuNavigationElementProvider();
  }
  AppLayoutSessionHelper.setActiveVariant(variant);
  if (titleComponent == null) {
    instance.setTitle(title);
  }
 else {
    instance.setTitleComponent(titleComponent);
  }
  if (navigatorEnabled) {
    navigator=navigatorProducer.apply(instance.getContentHolder());
    if (navigator == null) {
      throw new RuntimeException("String_Node_Str");
    }
    navigator.addViewChangeListener(event -> beforeViewChange(event.getViewName()));
    if (viewProviderSupplier != null) {
      navigator.addProvider(viewProviderSupplier.get());
    }
    if (errorProvider != null) {
      navigator.setErrorProvider(errorProvider.get());
    }
    if (errorViewProvider != null) {
      navigator.setErrorView(errorViewProvider.get());
    }
    if (navigatorConsumer != null) {
      navigatorConsumer.accept(navigator);
    }
    if (!CDI) {
      if (defaultNavigationElement == null) {
        defaultNavigationElement=navigationElements.stream().filter(element -> element instanceof NavigatorNavigationElement).map(element -> ((NavigatorNavigationElement)element)).findFirst().orElse(null);
      }
      defaultNavigationElement.addViewToNavigator(navigator);
    }
 else     if (CDI && defaultNavigationElement != null) {
      System.err.println("String_Node_Str");
    }
  }
 else {
    componentNavigator=new ComponentNavigator(instance.getContentHolder());
    componentNavigator.addViewChangeListener(event -> beforeViewChange(event.getViewName()));
    if (errorViewProvider != null) {
      componentNavigator.setErrorView(errorViewProvider.get());
    }
    if (componentNavigatorConsumer != null) {
      componentNavigatorConsumer.accept(componentNavigator);
    }
    if (defaultNavigationElement == null) {
      defaultNavigationElement=navigationElements.stream().filter(element -> element instanceof NavigatorNavigationElement).map(element -> ((NavigatorNavigationElement)element)).findFirst().orElse(null);
    }
    defaultNavigationElement.addViewToComponentNavigator(componentNavigator);
  }
  addComponents(headerElements,instance::addNavigationHeaderElement);
  addComponents(navigationElements,instance::addNavigationElement);
  addComponents(footerElements,instance::addNavigationFooterElement);
  appBarElements.forEach(instance::addAppBarElement);
  instance.setDesign(design);
  if (appBarIconComponent != null) {
    instance.addAppBarIcon(appBarIconComponent);
  }
  instance.setNavigatorNavigationElements(navigatorElements);
  if (!navigatorEnabled) {
    componentNavigator.navigateTo(defaultNavigationElement.getViewName());
  }
  return instance;
}

Fixed version (ground truth):
public AppLayoutComponent build(){
  if (navigationElementProvider == null) {
    if (variant.isTop())     navigationElementProvider=new DefaultLeftNavigationBadgeElementComponentProvider();
 else     navigationElementProvider=new DefaultLeftNavigationBadgeElementComponentProvider();
  }
  if (customElementProvider == null) {
    if (variant.isTop())     customElementProvider=new DefaultLeftClickableNavigationElementProvider();
 else     customElementProvider=new DefaultLeftClickableNavigationElementProvider();
  }
  if (sectionProvider == null) {
    if (variant.isTop())     sectionProvider=new DefaultLeftSectionElementComponentProvider();
 else     sectionProvider=new DefaultLeftSectionElementComponentProvider();
  }
  if (submenuProvider == null) {
    if (variant.isTop())     submenuProvider=new DefaultTopSubmenuNavigationElementProvider();
 else     submenuProvider=new DefaultLeftSubmenuNavigationElementProvider();
  }
  AppLayoutSessionHelper.setActiveVariant(variant);
  if (titleComponent == null) {
    instance.setTitle(title);
  }
 else {
    instance.setTitleComponent(titleComponent);
  }
  if (navigatorEnabled) {
    navigator=navigatorProducer.apply(instance.getContentHolder());
    if (navigator == null) {
      throw new RuntimeException("String_Node_Str");
    }
    navigator.addViewChangeListener(event -> beforeViewChange(event.getViewName()));
    if (viewProviderSupplier != null) {
      navigator.addProvider(viewProviderSupplier.get());
    }
    if (errorProvider != null) {
      navigator.setErrorProvider(errorProvider.get());
    }
    if (errorViewProvider != null) {
      navigator.setErrorView(errorViewProvider.get());
    }
    if (navigatorConsumer != null) {
      navigatorConsumer.accept(navigator);
    }
    if (!CDI && defaultNavigationElement == null) {
      defaultNavigationElement=navigationElements.stream().filter(element -> element instanceof NavigatorNavigationElement).map(element -> ((NavigatorNavigationElement)element)).findFirst().orElse(null);
    }
  }
 else {
    componentNavigator=new ComponentNavigator(instance.getContentHolder());
    componentNavigator.addViewChangeListener(event -> beforeViewChange(event.getViewName()));
    if (errorViewProvider != null) {
      componentNavigator.setErrorView(errorViewProvider.get());
    }
    if (componentNavigatorConsumer != null) {
      componentNavigatorConsumer.accept(componentNavigator);
    }
    if (defaultNavigationElement == null) {
      defaultNavigationElement=navigationElements.stream().filter(element -> element instanceof NavigatorNavigationElement).map(element -> ((NavigatorNavigationElement)element)).findFirst().orElse(null);
    }
    defaultNavigationElement.addViewToComponentNavigator(componentNavigator);
  }
  addComponents(headerElements,instance::addNavigationHeaderElement);
  addComponents(navigationElements,instance::addNavigationElement);
  addComponents(footerElements,instance::addNavigationFooterElement);
  appBarElements.forEach(instance::addAppBarElement);
  instance.setDesign(design);
  if (appBarIconComponent != null) {
    instance.addAppBarIcon(appBarIconComponent);
  }
  instance.setNavigatorNavigationElements(navigatorElements);
  if (!navigatorEnabled) {
    componentNavigator.navigateTo(defaultNavigationElement.getViewName());
  }
 else {
    if (!CDI && defaultNavigationElement != null) {
      defaultNavigationElement.addViewToNavigator(navigator);
    }
 else     if (CDI && defaultNavigationElement != null) {
      System.err.println("String_Node_Str");
    }
  }
  return instance;
}