Source:
<code>public SyndEntry renderNotification(CompositeEvent eventNotification) throws NotificationException { <START> if (eventNotification.getEvents().size() == 0) { <END> throw new NotificationException("Unable to create a RSS entry from an empty composite event."); } SyndEntry entry = new SyndEntryImpl(); SyndContent entryDescription = new SyndContentImpl(); List<SyndPerson> eventAuthors = new ArrayList<SyndPerson>(); for (DocumentReference author : eventNotification.getUsers()) { SyndPerson person = new SyndPersonImpl(); person.setName(author.getName()); eventAuthors.add(person); } entry.setAuthors(eventAuthors); entry.setUri(String.join("-", eventNotification.getEventIds())); entry.setTitle(this.contextualLocalizationManager.getTranslationPlain( eventNotification.getEvents().get(0).getTitle(), eventNotification.getEvents().get(0).getDocumentTitle())); try { this.scriptContextManager.getCurrentScriptContext().setAttribute( COMPOSITE_EVENT_BUILDING_NAME, eventNotification, ScriptContext.ENGINE_SCOPE); XDOM descriptionXDOM = this.templateManager.execute("notification/rss/default.vm"); WikiPrinter printer = new DefaultWikiPrinter(); blockRenderer.render(descriptionXDOM, printer); entryDescription.setType("text/html"); entryDescription.setValue(printer.toString()); entry.setDescription(entryDescription); } catch (Exception e) { throw new NotificationException( String.format("Unable to render the description of the event [%s].", eventNotification), e); } finally { this.scriptContextManager.getCurrentScriptContext().removeAttribute( COMPOSITE_EVENT_BUILDING_NAME, ScriptContext.ENGINE_SCOPE); } entry.setUpdatedDate(eventNotification.getDates().get(0)); return entry; }</code><technical_language>Useless: construct empty CompositeEvent, constructor</technical_language>

Target:
public SyndEntry renderNotification(CompositeEvent eventNotification) throws NotificationException { SyndEntry entry = new SyndEntryImpl(); SyndContent entryDescription = new SyndContentImpl(); List<SyndPerson> eventAuthors = new ArrayList<SyndPerson>(); for (DocumentReference author : eventNotification.getUsers()) { SyndPerson person = new SyndPersonImpl(); person.setName(author.getName()); eventAuthors.add(person); } entry.setAuthors(eventAuthors); entry.setUri(String.join("-", eventNotification.getEventIds())); entry.setTitle(this.contextualLocalizationManager.getTranslationPlain( eventNotification.getEvents().get(0).getTitle(), eventNotification.getEvents().get(0).getDocumentTitle())); try { this.scriptContextManager.getCurrentScriptContext().setAttribute( COMPOSITE_EVENT_BUILDING_NAME, eventNotification, ScriptContext.ENGINE_SCOPE); Template template = this.templateManager.getTemplate(String.format("notification/rss/%s.vm", eventNotification.getType().replaceAll("\\/", "."))); if (template == null) { template = this.templateManager.getTemplate("notification/rss/default.vm"); } XDOM descriptionXDOM = this.templateManager.execute(template); WikiPrinter printer = new DefaultWikiPrinter(); blockRenderer.render(descriptionXDOM, printer); entryDescription.setType("text/html"); entryDescription.setValue(printer.toString()); entry.setDescription(entryDescription); } catch (Exception e) { throw new NotificationException( String.format("Unable to render the description of the event [%s].", eventNotification), e); } finally { this.scriptContextManager.getCurrentScriptContext().removeAttribute( COMPOSITE_EVENT_BUILDING_NAME, ScriptContext.ENGINE_SCOPE); } entry.setUpdatedDate(eventNotification.getDates().get(0)); return entry; }