Program: 188272
Project: 188272
Buggy source:
public BrowseRepresentation(BrowseRepresentationBundle bundle){
  this.representation=bundle.getRepresentation();
  this.aipId=representation.getAipId();
  this.repId=representation.getId();
  this.repUUID=representation.getUUID();
  handlers=new ArrayList<>();
  String summary=messages.representationListOfFiles();
  final AIPState state=bundle.getAip().getState();
  final boolean justActive=AIPState.ACTIVE.equals(state);
  boolean selectable=true;
  boolean showFilesPath=false;
  Filter filter=new Filter(new SimpleFilterParameter(RodaConstants.FILE_REPRESENTATION_UUID,repUUID),new EmptyKeyFilterParameter(RodaConstants.FILE_PARENT_UUID));
  filesList=new SearchFileList(filter,justActive,Facets.NONE,summary,selectable,showFilesPath);
  LastSelectedItemsSingleton.getInstance().setSelectedJustActive(justActive);
  filesList.setActionable(FileActions.get(aipId,repId));
  ListSelectionUtils.bindBrowseOpener(filesList);
  filesSearch=new SearchPanel(filter,ALL_FILTER,true,messages.searchPlaceHolder(),false,false,true);
  filesSearch.setList(filesList);
  disseminationsList=new DIPList(Filter.NULL,Facets.NONE,messages.listOfDisseminations(),true);
  disseminationsList.setActionable(DisseminationActions.get());
  ListSelectionUtils.bindBrowseOpener(disseminationsList);
  disseminationsSearch=new SearchPanel(Filter.NULL,RodaConstants.DIP_SEARCH,true,messages.searchPlaceHolder(),false,false,true);
  disseminationsSearch.setList(disseminationsList);
  initWidget(uiBinder.createAndBindUi(this));
  updateLayout(state,justActive);
  breadcrumb.updatePath(BreadcrumbUtils.getRepresentationBreadcrumbs(bundle));
  breadcrumb.setVisible(true);
  final List<Pair<String,HTML>> descriptiveMetadataContainers=new ArrayList<>();
  final Map<String,DescriptiveMetadataViewBundle> bundles=new HashMap<>();
  for (  DescriptiveMetadataViewBundle descMetadataBundle : bundle.getRepresentationDescriptiveMetadata()) {
    String title=descMetadataBundle.getLabel() != null ? descMetadataBundle.getLabel() : descMetadataBundle.getId();
    HTML container=new HTML();
    container.addStyleName("String_Node_Str");
    itemMetadata.add(container,title);
    descriptiveMetadataContainers.add(Pair.of(descMetadataBundle.getId(),container));
    bundles.put(descMetadataBundle.getId(),descMetadataBundle);
  }
  HandlerRegistration tabHandler=itemMetadata.addSelectionHandler(new SelectionHandler<Integer>(){
    @Override public void onSelection(    SelectionEvent<Integer> event){
      if (event.getSelectedItem() < descriptiveMetadataContainers.size()) {
        Pair<String,HTML> pair=descriptiveMetadataContainers.get(event.getSelectedItem());
        String descId=pair.getFirst();
        final HTML html=pair.getSecond();
        final DescriptiveMetadataViewBundle bundle=bundles.get(descId);
        if (html.getText().length() == 0) {
          getDescriptiveMetadataHTML(descId,bundle,new AsyncCallback<SafeHtml>(){
            @Override public void onFailure(            Throwable caught){
              if (!AsyncCallbackUtils.treatCommonFailures(caught)) {
                Toast.showError(messages.errorLoadingDescriptiveMetadata(caught.getMessage()));
              }
            }
            @Override public void onSuccess(            SafeHtml result){
              html.setHTML(result);
            }
          }
);
        }
      }
    }
  }
);
  final int addTabIndex=itemMetadata.getWidgetCount();
  FlowPanel addTab=new FlowPanel();
  addTab.add(new HTML(SafeHtmlUtils.fromSafeConstant("String_Node_Str")));
  itemMetadata.add(new Label(),addTab);
  HandlerRegistration addTabHandler=itemMetadata.addSelectionHandler(new SelectionHandler<Integer>(){
    @Override public void onSelection(    SelectionEvent<Integer> event){
      if (event.getSelectedItem() == addTabIndex) {
        newRepresentationDescriptiveMetadata();
      }
    }
  }
);
  addTab.addStyleName("String_Node_Str");
  addTab.getParent().addStyleName("String_Node_Str");
  handlers.add(tabHandler);
  handlers.add(addTabHandler);
  if (!bundle.getRepresentationDescriptiveMetadata().isEmpty()) {
    newDescriptiveMetadata.setVisible(false);
    itemMetadata.setVisible(true);
    itemMetadata.selectTab(0);
  }
 else {
    newDescriptiveMetadata.setVisible(true);
    itemMetadata.setVisible(false);
  }
  if (bundle.getDipCount() > 0) {
    Filter disseminationsFilter=new Filter(new SimpleFilterParameter(RodaConstants.DIP_REPRESENTATION_UUIDS,repUUID));
    disseminationsList.set(disseminationsFilter,state.equals(AIPState.ACTIVE),Facets.NONE);
    disseminationsSearch.setDefaultFilter(disseminationsFilter,true);
    disseminationsSearch.clearSearchInputBox();
  }
  disseminationsList.getParent().setVisible(bundle.getDipCount() > 0);
  ListSelectionUtils.bindLayout(representation,searchPrevious,searchNext,keyboardFocus,true,false,false,searchSection);
  this.addStyleName("String_Node_Str");
  this.addStyleName("String_Node_Str");
  this.addStyleName(state.toString().toLowerCase());
  Element firstElement=this.getElement().getFirstChildElement();
  if ("String_Node_Str".equalsIgnoreCase(firstElement.getTagName())) {
    firstElement.setAttribute("String_Node_Str","String_Node_Str");
  }
  WCAGUtilities.getInstance().makeAccessible(itemMetadata.getElement());
}

Fixed version (ground truth):
public BrowseRepresentation(BrowseRepresentationBundle bundle){
  this.representation=bundle.getRepresentation();
  this.aipId=representation.getAipId();
  this.repId=representation.getId();
  this.repUUID=representation.getUUID();
  handlers=new ArrayList<>();
  String summary=messages.representationListOfFiles();
  final AIPState state=bundle.getAip().getState();
  final boolean justActive=AIPState.ACTIVE.equals(state);
  boolean selectable=true;
  boolean showFilesPath=false;
  Filter filter=new Filter(new SimpleFilterParameter(RodaConstants.FILE_REPRESENTATION_UUID,repUUID),new EmptyKeyFilterParameter(RodaConstants.FILE_PARENT_UUID));
  filesList=new SearchFileList(filter,justActive,Facets.NONE,summary,selectable,showFilesPath);
  LastSelectedItemsSingleton.getInstance().setSelectedJustActive(justActive);
  filesList.setActionable(FileActions.get(aipId,repId));
  ListSelectionUtils.bindBrowseOpener(filesList);
  filesSearch=new SearchPanel(filter,ALL_FILTER,true,messages.searchPlaceHolder(),false,false,true);
  filesSearch.setList(filesList);
  disseminationsList=new DIPList(Filter.NULL,Facets.NONE,messages.listOfDisseminations(),true);
  disseminationsList.setActionable(DisseminationActions.get());
  ListSelectionUtils.bindBrowseOpener(disseminationsList);
  disseminationsSearch=new SearchPanel(Filter.NULL,RodaConstants.DIP_SEARCH,true,messages.searchPlaceHolder(),false,false,true);
  disseminationsSearch.setList(disseminationsList);
  initWidget(uiBinder.createAndBindUi(this));
  updateLayout(state,justActive);
  breadcrumbItems=BreadcrumbUtils.getRepresentationBreadcrumbs(bundle);
  breadcrumb.updatePath(breadcrumbItems);
  breadcrumb.setVisible(true);
  final List<Pair<String,HTML>> descriptiveMetadataContainers=new ArrayList<>();
  final Map<String,DescriptiveMetadataViewBundle> bundles=new HashMap<>();
  for (  DescriptiveMetadataViewBundle descMetadataBundle : bundle.getRepresentationDescriptiveMetadata()) {
    String title=descMetadataBundle.getLabel() != null ? descMetadataBundle.getLabel() : descMetadataBundle.getId();
    HTML container=new HTML();
    container.addStyleName("String_Node_Str");
    itemMetadata.add(container,title);
    descriptiveMetadataContainers.add(Pair.of(descMetadataBundle.getId(),container));
    bundles.put(descMetadataBundle.getId(),descMetadataBundle);
  }
  HandlerRegistration tabHandler=itemMetadata.addSelectionHandler(new SelectionHandler<Integer>(){
    @Override public void onSelection(    SelectionEvent<Integer> event){
      if (event.getSelectedItem() < descriptiveMetadataContainers.size()) {
        Pair<String,HTML> pair=descriptiveMetadataContainers.get(event.getSelectedItem());
        String descId=pair.getFirst();
        final HTML html=pair.getSecond();
        final DescriptiveMetadataViewBundle bundle=bundles.get(descId);
        if (html.getText().length() == 0) {
          getDescriptiveMetadataHTML(descId,bundle,new AsyncCallback<SafeHtml>(){
            @Override public void onFailure(            Throwable caught){
              if (!AsyncCallbackUtils.treatCommonFailures(caught)) {
                Toast.showError(messages.errorLoadingDescriptiveMetadata(caught.getMessage()));
              }
            }
            @Override public void onSuccess(            SafeHtml result){
              html.setHTML(result);
            }
          }
);
        }
      }
    }
  }
);
  final int addTabIndex=itemMetadata.getWidgetCount();
  FlowPanel addTab=new FlowPanel();
  addTab.add(new HTML(SafeHtmlUtils.fromSafeConstant("String_Node_Str")));
  itemMetadata.add(new Label(),addTab);
  HandlerRegistration addTabHandler=itemMetadata.addSelectionHandler(new SelectionHandler<Integer>(){
    @Override public void onSelection(    SelectionEvent<Integer> event){
      if (event.getSelectedItem() == addTabIndex) {
        newRepresentationDescriptiveMetadata();
      }
    }
  }
);
  addTab.addStyleName("String_Node_Str");
  addTab.getParent().addStyleName("String_Node_Str");
  handlers.add(tabHandler);
  handlers.add(addTabHandler);
  if (!bundle.getRepresentationDescriptiveMetadata().isEmpty()) {
    newDescriptiveMetadata.setVisible(false);
    itemMetadata.setVisible(true);
    itemMetadata.selectTab(0);
  }
 else {
    newDescriptiveMetadata.setVisible(true);
    itemMetadata.setVisible(false);
  }
  if (bundle.getDipCount() > 0) {
    Filter disseminationsFilter=new Filter(new SimpleFilterParameter(RodaConstants.DIP_REPRESENTATION_UUIDS,repUUID));
    disseminationsList.set(disseminationsFilter,state.equals(AIPState.ACTIVE),Facets.NONE);
    disseminationsSearch.setDefaultFilter(disseminationsFilter,true);
    disseminationsSearch.clearSearchInputBox();
  }
  disseminationsList.getParent().setVisible(bundle.getDipCount() > 0);
  ListSelectionUtils.bindLayout(representation,searchPrevious,searchNext,keyboardFocus,true,false,false,searchSection);
  this.addStyleName("String_Node_Str");
  this.addStyleName("String_Node_Str");
  this.addStyleName(state.toString().toLowerCase());
  Element firstElement=this.getElement().getFirstChildElement();
  if ("String_Node_Str".equalsIgnoreCase(firstElement.getTagName())) {
    firstElement.setAttribute("String_Node_Str","String_Node_Str");
  }
  WCAGUtilities.getInstance().makeAccessible(itemMetadata.getElement());
}