Program: 3402
Project: 3402
Buggy source:
/** 
 * Generate a syndication feed for a collection or community or community
 * @param context	the DSpace context object
 * @param dso		DSpace object - collection or community
 * @return		an object representing the feed
 */
private Channel generateFeed(Context context,DSpaceObject dso) throws IOException, SQLException {
  try {
    String dspaceUrl=ConfigurationManager.getProperty("String_Node_Str");
    String type=null;
    String description=null;
    String title=null;
    Bitstream logo=null;
    String idx=ConfigurationManager.getProperty("String_Node_Str");
    if (idx == null) {
      throw new IOException("String_Node_Str");
    }
    BrowseIndex bix=BrowseIndex.getItemBrowseIndex();
    if (bix == null) {
      throw new IOException("String_Node_Str" + idx);
    }
    BrowserScope scope=new BrowserScope(context);
    scope.setBrowseIndex(bix);
    for (    SortOption so : SortOption.getSortOptions()) {
      if (so.getName().equals(idx))       scope.setSortBy(so.getNumber());
    }
    scope.setOrder(SortOption.DESCENDING);
    Channel channel=new Channel();
    if (dso == null) {
      channel.setTitle(ConfigurationManager.getProperty("String_Node_Str"));
      channel.setLink(dspaceUrl);
      channel.setDescription(labels.getString(clazz + "String_Node_Str"));
    }
 else {
      if (dso.getType() == Constants.COLLECTION) {
        type=labels.getString(clazz + "String_Node_Str");
        Collection col=(Collection)dso;
        description=col.getMetadata("String_Node_Str");
        title=col.getMetadata("String_Node_Str");
        logo=col.getLogo();
        scope.setBrowseContainer(col);
      }
 else       if (dso.getType() == Constants.COMMUNITY) {
        type=labels.getString(clazz + "String_Node_Str");
        Community comm=(Community)dso;
        description=comm.getMetadata("String_Node_Str");
        title=comm.getMetadata("String_Node_Str");
        logo=comm.getLogo();
        scope.setBrowseContainer(comm);
      }
      String objectUrl="String_Node_Str";
      if (dso.getExternalIdentifier() != null) {
        objectUrl=ConfigurationManager.getBooleanProperty("String_Node_Str") ? IdentifierService.getURL(dso).toString() : dso.getExternalIdentifier().getURI().toString();
      }
 else {
        objectUrl=IdentifierService.getURL(dso).toString();
      }
      channel.setDescription(description);
      channel.setLink(objectUrl);
      String channelTitle=MessageFormat.format(labels.getString(clazz + "String_Node_Str"),new Object[]{type,title});
      channel.setTitle(channelTitle);
      if (logo != null) {
        Image image=new Image();
        image.setLink(objectUrl);
        image.setTitle(labels.getString(clazz + "String_Node_Str"));
        image.setUrl(dspaceUrl + "String_Node_Str" + logo.getID());
        channel.setImage(image);
      }
    }
    TextInput input=new TextInput();
    input.setLink(dspaceUrl + "String_Node_Str");
    input.setDescription(labels.getString(clazz + "String_Node_Str"));
    String searchTitle="String_Node_Str";
    if (type != null) {
      searchTitle=MessageFormat.format(labels.getString(clazz + "String_Node_Str"),new Object[]{type});
    }
 else {
      searchTitle=labels.getString(clazz + "String_Node_Str");
    }
    input.setTitle(searchTitle);
    input.setName(labels.getString(clazz + "String_Node_Str"));
    channel.setTextInput(input);
    scope.setResultsPerPage(itemCount);
    BrowseEngine be=new BrowseEngine(context);
    BrowseInfo bi=be.browseMini(scope);
    Item[] results=bi.getBrowseItemResults(context);
    List items=new ArrayList();
    for (int i=0; i < results.length; i++) {
      items.add(itemFromDSpaceItem(context,results[i]));
    }
    channel.setItems(items);
    if (channel.getDescription() == null)     channel.setDescription("String_Node_Str");
    return channel;
  }
 catch (  SortException se) {
    log.error("String_Node_Str",se);
    throw new IOException(se.getMessage());
  }
catch (  BrowseException e) {
    log.error("String_Node_Str",e);
    throw new IOException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Generate a syndication feed for a collection or community or community
 * @param context	the DSpace context object
 * @param dso		DSpace object - collection or community
 * @return		an object representing the feed
 */
private Channel generateFeed(Context context,DSpaceObject dso) throws IOException, SQLException {
  try {
    String dspaceUrl=ConfigurationManager.getProperty("String_Node_Str");
    String type=null;
    String description=null;
    String title=null;
    Bitstream logo=null;
    String idx=ConfigurationManager.getProperty("String_Node_Str");
    if (idx == null) {
      throw new IOException("String_Node_Str");
    }
    BrowseIndex bix=BrowseIndex.getItemBrowseIndex();
    if (bix == null) {
      throw new IOException("String_Node_Str" + idx);
    }
    BrowserScope scope=new BrowserScope(context);
    scope.setBrowseIndex(bix);
    for (    SortOption so : SortOption.getSortOptions()) {
      if (so.getName().equals(idx))       scope.setSortBy(so.getNumber());
    }
    scope.setOrder(SortOption.DESCENDING);
    Channel channel=new Channel();
    if (dso == null) {
      channel.setTitle(ConfigurationManager.getProperty("String_Node_Str"));
      channel.setLink(dspaceUrl);
      channel.setDescription(labels.getString(clazz + "String_Node_Str"));
    }
 else {
      if (dso.getType() == Constants.COLLECTION) {
        type=labels.getString(clazz + "String_Node_Str");
        Collection col=(Collection)dso;
        description=col.getMetadata("String_Node_Str");
        title=col.getMetadata("String_Node_Str");
        logo=col.getLogo();
        scope.setBrowseContainer(col);
      }
 else       if (dso.getType() == Constants.COMMUNITY) {
        type=labels.getString(clazz + "String_Node_Str");
        Community comm=(Community)dso;
        description=comm.getMetadata("String_Node_Str");
        title=comm.getMetadata("String_Node_Str");
        logo=comm.getLogo();
        scope.setBrowseContainer(comm);
      }
      String objectUrl="String_Node_Str";
      if (dso.getExternalIdentifier() != null) {
        objectUrl=ConfigurationManager.getBooleanProperty("String_Node_Str") ? IdentifierService.getURL(dso).toString() : dso.getExternalIdentifier().getURI().toString();
      }
 else {
        objectUrl=IdentifierService.getURL(dso).toString();
      }
      channel.setDescription(description.replaceAll("String_Node_Str","String_Node_Str"));
      channel.setLink(objectUrl);
      String channelTitle=MessageFormat.format(labels.getString(clazz + "String_Node_Str"),new Object[]{type,title});
      channel.setTitle(channelTitle);
      if (logo != null) {
        Image image=new Image();
        image.setLink(objectUrl);
        image.setTitle(labels.getString(clazz + "String_Node_Str"));
        image.setUrl(dspaceUrl + "String_Node_Str" + logo.getID());
        channel.setImage(image);
      }
    }
    TextInput input=new TextInput();
    input.setLink(dspaceUrl + "String_Node_Str");
    input.setDescription(labels.getString(clazz + "String_Node_Str"));
    String searchTitle="String_Node_Str";
    if (type != null) {
      searchTitle=MessageFormat.format(labels.getString(clazz + "String_Node_Str"),new Object[]{type});
    }
 else {
      searchTitle=labels.getString(clazz + "String_Node_Str");
    }
    input.setTitle(searchTitle);
    input.setName(labels.getString(clazz + "String_Node_Str"));
    channel.setTextInput(input);
    scope.setResultsPerPage(itemCount);
    BrowseEngine be=new BrowseEngine(context);
    BrowseInfo bi=be.browseMini(scope);
    Item[] results=bi.getBrowseItemResults(context);
    List items=new ArrayList();
    for (int i=0; i < results.length; i++) {
      items.add(itemFromDSpaceItem(context,results[i]));
    }
    channel.setItems(items);
    if (channel.getDescription() == null)     channel.setDescription("String_Node_Str");
    return channel;
  }
 catch (  SortException se) {
    log.error("String_Node_Str",se);
    throw new IOException(se.getMessage());
  }
catch (  BrowseException e) {
    log.error("String_Node_Str",e);
    throw new IOException(e.getMessage());
  }
}