Program: 3223
Project: 3223
Buggy source:
protected void buildSearchControls(Division div) throws WingException, SQLException {
  org.dspace.app.xmlui.wing.element.List controlsList=div.addList("String_Node_Str",org.dspace.app.xmlui.wing.element.List.TYPE_FORM);
  controlsList.setHead(T_sort_head);
  org.dspace.app.xmlui.wing.element.Item controlsItem=controlsList.addItem();
  controlsItem.addContent(T_rpp);
  Select rppSelect=controlsItem.addSelect("String_Node_Str");
  for (  int i : RESULTS_PER_PAGE_PROGRESSION) {
    rppSelect.addOption((i == getParameterRpp()),i,Integer.toString(i));
  }
  controlsItem.addContent(T_sort_by);
  Select sortSelect=controlsItem.addSelect("String_Node_Str");
  sortSelect.addOption(false,"String_Node_Str",T_sort_by_relevance);
  DSpaceObject dso=HandleUtil.obtainHandle(objectModel);
  DiscoveryConfiguration discoveryConfiguration=SearchUtils.getDiscoveryConfiguration(dso);
  for (  DiscoverySortConfiguration sortConfiguration : discoveryConfiguration.getSearchSortFields()) {
    String sortField=SearchUtils.getSearchService().toSortFieldIndex(sortConfiguration.getMetadataField(),sortConfiguration.getType());
    String currentSort=getParameterSortBy();
    sortSelect.addOption((sortField.equals(currentSort) || sortConfiguration.isDefaultSort()),sortField,message("String_Node_Str" + sortField));
  }
  controlsItem.addContent(T_order);
  Select orderSelect=controlsItem.addSelect("String_Node_Str");
  orderSelect.addOption(SortOption.ASCENDING.equals(getParameterOrder()),SortOption.ASCENDING,T_order_asc);
  orderSelect.addOption(SortOption.DESCENDING.equals(getParameterOrder()),SortOption.DESCENDING,T_order_desc);
  controlsItem.addButton("String_Node_Str").setValue(T_sort_button);
}

Fixed version (ground truth):
protected void buildSearchControls(Division div) throws WingException, SQLException {
  org.dspace.app.xmlui.wing.element.List controlsList=div.addList("String_Node_Str",org.dspace.app.xmlui.wing.element.List.TYPE_FORM);
  controlsList.setHead(T_sort_head);
  org.dspace.app.xmlui.wing.element.Item controlsItem=controlsList.addItem();
  controlsItem.addContent(T_rpp);
  Select rppSelect=controlsItem.addSelect("String_Node_Str");
  for (  int i : RESULTS_PER_PAGE_PROGRESSION) {
    rppSelect.addOption((i == getParameterRpp()),i,Integer.toString(i));
  }
  controlsItem.addContent(T_sort_by);
  Select sortSelect=controlsItem.addSelect("String_Node_Str");
  sortSelect.addOption(false,"String_Node_Str",T_sort_by_relevance);
  DSpaceObject dso=HandleUtil.obtainHandle(objectModel);
  DiscoveryConfiguration discoveryConfiguration=SearchUtils.getDiscoveryConfiguration(dso);
  DiscoverySortConfiguration searchSortConfiguration=discoveryConfiguration.getSearchSortConfiguration();
  if (searchSortConfiguration != null) {
    for (    DiscoverySortFieldConfiguration sortFieldConfiguration : searchSortConfiguration.getSortFields()) {
      String sortField=SearchUtils.getSearchService().toSortFieldIndex(sortFieldConfiguration.getMetadataField(),sortFieldConfiguration.getType());
      String currentSort=getParameterSortBy();
      sortSelect.addOption((sortField.equals(currentSort) || sortFieldConfiguration.equals(searchSortConfiguration.getDefaultSort())),sortField,message("String_Node_Str" + sortField));
    }
  }
  controlsItem.addContent(T_order);
  Select orderSelect=controlsItem.addSelect("String_Node_Str");
  String parameterOrder=getParameterOrder();
  if (parameterOrder == null && searchSortConfiguration != null) {
    parameterOrder=searchSortConfiguration.getDefaultSortOrder().toString();
  }
  orderSelect.addOption(SortOption.ASCENDING.equalsIgnoreCase(parameterOrder),SortOption.ASCENDING,T_order_asc);
  orderSelect.addOption(SortOption.DESCENDING.equalsIgnoreCase(parameterOrder),SortOption.DESCENDING,T_order_desc);
  controlsItem.addButton("String_Node_Str").setValue(T_sort_button);
}