Program: 35416
Project: 35416
Buggy source:
/** 
 * <p> Refreshes the project banner for the current project. </p> <p> Provided   {@code project} must possess following attributes:<ul> <li>Base attributes (id, name, etc.)</li> <li> {@link ProjectDTO#PROJECT_MODEL}</li> <li>  {@link ProjectDTO#CURRENT_AMENDMENT}</li> </ul> </p>
 * @param project The current loaded project.
 */
private void refreshBanner(final ProjectDTO project){
  view.setProjectTitle(project.getName(),project.getFullName());
  view.setProjectLogo(project.getProjectModel().getVisibility(auth().getOrganizationId()));
  final Header header=view.getProjectBannerPanel().getHeader();
  if (project.getProjectModel().isUnderMaintenance()) {
    header.addStyleName(ALERT_STYLE);
    header.setHtml(header.getHtml() + "String_Node_Str" + I18N.MESSAGES.projectMaintenanceMessage());
  }
 else   if (project.getProjectModel().getDateMaintenance() != null) {
    header.addStyleName(ALERT_STYLE);
    String maintenanceDate=DateUtils.DATE_TIME_SHORT.format(project.getProjectModel().getDateMaintenance());
    header.setHtml(header.getHtml() + "String_Node_Str" + I18N.MESSAGES.projectMaintenanceScheduledMessage(maintenanceDate));
  }
 else {
    header.removeStyleName(ALERT_STYLE);
  }
  final ProjectBannerDTO banner=project.getProjectModel().getProjectBanner();
  final LayoutDTO layout=banner != null ? banner.getLayout() : null;
  final Widget bannerWidget;
  if (layout != null && layout.getGroups() != null && !layout.getGroups().isEmpty()) {
    final int rows=layout.getRowsCount() > 2 ? 2 : layout.getRowsCount();
    final int cols=layout.getColumnsCount() > 4 ? 4 : layout.getColumnsCount();
    final HTMLTable gridLayout=view.buildBannerTable(rows,cols);
    bannerWidget=gridLayout;
    for (    final LayoutGroupDTO groupLayout : layout.getGroups()) {
      if (groupLayout.getRow() + 1 > rows || groupLayout.getColumn() + 1 > cols) {
        continue;
      }
      final ContentPanel groupPanel=new ContentPanel();
      groupPanel.setLayout(new FormLayout());
      groupPanel.setTopComponent(null);
      groupPanel.setHeaderVisible(false);
      gridLayout.setWidget(groupLayout.getRow(),groupLayout.getColumn(),groupPanel);
      if (groupLayout.getConstraints() == null) {
        continue;
      }
      for (      final LayoutConstraintDTO constraint : groupLayout.getConstraints()) {
        final FlexibleElementDTO element=constraint.getFlexibleElementDTO();
        if (!(element instanceof DefaultFlexibleElementDTO)) {
          continue;
        }
        final DefaultFlexibleElementDTO defaultElement=(DefaultFlexibleElementDTO)element;
        defaultElement.setService(dispatch);
        defaultElement.setAuthenticationProvider(injector.getAuthenticationProvider());
        defaultElement.setCache(injector.getClientCache());
        defaultElement.setCurrentContainerDTO(project);
        final Integer amendmentId;
        if (project.getCurrentAmendment() != null) {
          amendmentId=project.getCurrentAmendment().getId();
        }
 else {
          amendmentId=null;
        }
        dispatch.execute(new GetValue(project.getId(),element.getId(),element.getEntityName(),amendmentId),new CommandResultHandler<ValueResult>(){
          @Override public void onCommandFailure(          final Throwable throwable){
            if (Log.isErrorEnabled()) {
              Log.error("String_Node_Str",throwable);
            }
            throw new RuntimeException(throwable);
          }
          @Override public void onCommandSuccess(          final ValueResult valueResult){
            if (Log.isDebugEnabled()) {
              Log.debug("String_Node_Str" + valueResult);
            }
            final Component component;
            if (defaultElement instanceof BudgetElementDTO) {
              component=defaultElement.getElementComponentInBanner(valueResult);
            }
 else {
              component=defaultElement.getElementComponentInBanner(null);
            }
            if (component == null) {
              return;
            }
            if (component instanceof LabelField) {
              final LabelField lableFieldComponent=(LabelField)component;
              final String textValue=(String)lableFieldComponent.getValue();
              final ToolTipConfig config=new ToolTipConfig();
              config.setMaxWidth(500);
              config.setText(textValue);
              lableFieldComponent.setToolTip(config);
              if (ClientUtils.isNotBlank(textValue)) {
                lableFieldComponent.setValue(ClientUtils.abbreviate(textValue,30));
              }
              groupPanel.add(lableFieldComponent);
            }
 else {
              groupPanel.add(component);
            }
            groupPanel.layout();
          }
        }
);
        break;
      }
    }
  }
 else {
    view.getProjectBannerPanel().setLayout(new FormLayout());
    final LabelField codeField=new LabelField();
    codeField.setReadOnly(true);
    codeField.setFieldLabel(I18N.CONSTANTS.projectName());
    codeField.setLabelSeparator(I18N.CONSTANTS.form_label_separator());
    codeField.setValue(project.getName());
    bannerWidget=codeField;
  }
  view.setProjectBanner(bannerWidget);
  view.getProjectBannerPanel().layout();
}

Fixed version (ground truth):
/** 
 * <p> Refreshes the project banner for the current project. </p> <p> Provided   {@code project} must possess following attributes:<ul> <li>Base attributes (id, name, etc.)</li> <li> {@link ProjectDTO#PROJECT_MODEL}</li> <li>  {@link ProjectDTO#CURRENT_AMENDMENT}</li> </ul> </p>
 * @param project The current loaded project.
 */
private void refreshBanner(final ProjectDTO project){
  view.setProjectTitle(project.getName(),project.getFullName());
  view.setProjectLogo(project.getProjectModel().getVisibility(auth().getOrganizationId()));
  final Header header=view.getProjectBannerPanel().getHeader();
  if (project.getProjectModel().isUnderMaintenance()) {
    header.addStyleName(ALERT_STYLE);
    header.setHtml(header.getHtml() + "String_Node_Str" + I18N.MESSAGES.projectMaintenanceMessage());
  }
 else   if (project.getProjectModel().getDateMaintenance() != null) {
    header.addStyleName(ALERT_STYLE);
    String maintenanceDate=DateUtils.DATE_TIME_SHORT.format(project.getProjectModel().getDateMaintenance());
    header.setHtml(header.getHtml() + "String_Node_Str" + I18N.MESSAGES.projectMaintenanceScheduledMessage(maintenanceDate));
  }
 else {
    header.removeStyleName(ALERT_STYLE);
  }
  final ProjectBannerDTO banner=project.getProjectModel().getProjectBanner();
  final LayoutDTO layout=banner != null ? banner.getLayout() : null;
  final Widget bannerWidget;
  if (layout != null && layout.getGroups() != null && !layout.getGroups().isEmpty()) {
    final int rows=layout.getRowsCount() > 2 ? 2 : layout.getRowsCount();
    final int cols=layout.getColumnsCount() > 4 ? 4 : layout.getColumnsCount();
    final HTMLTable gridLayout=view.buildBannerTable(rows,cols);
    bannerWidget=gridLayout;
    for (    final LayoutGroupDTO groupLayout : layout.getGroups()) {
      if (groupLayout.getRow() + 1 > rows || groupLayout.getColumn() + 1 > cols) {
        continue;
      }
      final ContentPanel groupPanel=new ContentPanel();
      groupPanel.setLayout(new FormLayout());
      groupPanel.setTopComponent(null);
      groupPanel.setHeaderVisible(false);
      gridLayout.setWidget(groupLayout.getRow(),groupLayout.getColumn(),groupPanel);
      if (groupLayout.getConstraints() == null) {
        continue;
      }
      for (      final LayoutConstraintDTO constraint : groupLayout.getConstraints()) {
        final FlexibleElementDTO element=constraint.getFlexibleElementDTO();
        if (!(element instanceof DefaultFlexibleElementDTO)) {
          continue;
        }
        final DefaultFlexibleElementDTO defaultElement=(DefaultFlexibleElementDTO)element;
        defaultElement.setService(dispatch);
        defaultElement.setAuthenticationProvider(injector.getAuthenticationProvider());
        defaultElement.setEventBus(eventBus);
        defaultElement.setCache(injector.getClientCache());
        defaultElement.setCurrentContainerDTO(project);
        final Integer amendmentId;
        if (project.getCurrentAmendment() != null) {
          amendmentId=project.getCurrentAmendment().getId();
        }
 else {
          amendmentId=null;
        }
        dispatch.execute(new GetValue(project.getId(),element.getId(),element.getEntityName(),amendmentId),new CommandResultHandler<ValueResult>(){
          @Override public void onCommandFailure(          final Throwable throwable){
            if (Log.isErrorEnabled()) {
              Log.error("String_Node_Str",throwable);
            }
            throw new RuntimeException(throwable);
          }
          @Override public void onCommandSuccess(          final ValueResult valueResult){
            if (Log.isDebugEnabled()) {
              Log.debug("String_Node_Str" + valueResult);
            }
            final Component component;
            if (defaultElement instanceof BudgetElementDTO) {
              component=defaultElement.getElementComponentInBanner(valueResult);
            }
 else {
              component=defaultElement.getElementComponentInBanner(null);
            }
            if (component == null) {
              return;
            }
            if (component instanceof LabelField) {
              final LabelField lableFieldComponent=(LabelField)component;
              final String textValue=(String)lableFieldComponent.getValue();
              final ToolTipConfig config=new ToolTipConfig();
              config.setMaxWidth(500);
              config.setText(textValue);
              lableFieldComponent.setToolTip(config);
              if (ClientUtils.isNotBlank(textValue)) {
                lableFieldComponent.setValue(ClientUtils.abbreviate(textValue,30));
              }
              groupPanel.add(lableFieldComponent);
            }
 else {
              groupPanel.add(component);
            }
            groupPanel.layout();
          }
        }
);
        break;
      }
    }
  }
 else {
    view.getProjectBannerPanel().setLayout(new FormLayout());
    final LabelField codeField=new LabelField();
    codeField.setReadOnly(true);
    codeField.setFieldLabel(I18N.CONSTANTS.projectName());
    codeField.setLabelSeparator(I18N.CONSTANTS.form_label_separator());
    codeField.setValue(project.getName());
    bannerWidget=codeField;
  }
  view.setProjectBanner(bannerWidget);
  view.getProjectBannerPanel().layout();
}