Source:
<code>public List<DocumentModel> getComments(DocumentModel docModel) { return CoreInstance.doPrivileged(docModel.getRepositoryName(), session -> { Map<String, Object> ctxMap = Collections.<String, Object> singletonMap( ResourceAdapter.CORE_SESSION_CONTEXT_KEY, session); RelationManager relationManager = Framework.getService(RelationManager.class); Graph graph = relationManager.getGraph(config.graphName, session); Resource docResource = relationManager.getResource(config.documentNamespace, docModel, ctxMap); if (docResource == null) { throw new NuxeoException("Could not adapt document model to relation resource ; " + "check the service relation adapters configuration"); } List<Statement> statementList = graph.getStatements(null, null, docResource); if (graph instanceof JenaGraph) { Resource oldDocResource = new QNameResourceImpl(config.documentNamespace, docModel.getId()); statementList.addAll(graph.getStatements(null, null, oldDocResource)); } List<DocumentModel> commentList = new ArrayList<DocumentModel>(); for (Statement stmt : statementList) { QNameResourceImpl subject = (QNameResourceImpl) stmt.getSubject(); DocumentModel commentDocModel = (DocumentModel) relationManager.getResourceRepresentation( config.commentNamespace, subject, ctxMap); if (commentDocModel == null) { log.warn("Could not adapt comment relation subject to a document " + "model; check the service relation adapters configur ation"); continue; } commentDocModel.detach(true); commentList.add(commentDocModel); <START> <END> } CommentSorter sorter = new CommentSorter(true); Collections.sort(commentList, sorter); return commentList; }); }</code><technical_language>Empty line removed</technical_language>

Target:
public List<DocumentModel> getComments(DocumentModel docModel) { return doPrivileged(docModel, session -> { Map<String, Object> ctxMap = Collections.singletonMap(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, session); RelationManager relationManager = Framework.getService(RelationManager.class); Graph graph = relationManager.getGraph(config.graphName, session); Resource docResource = relationManager.getResource(config.documentNamespace, docModel, ctxMap); if (docResource == null) { throw new NuxeoException("Could not adapt document model to relation resource ; " + "check the service relation adapters configuration"); } List<Statement> statementList = graph.getStatements(null, null, docResource); if (graph instanceof JenaGraph) { Resource oldDocResource = new QNameResourceImpl(config.documentNamespace, docModel.getId()); statementList.addAll(graph.getStatements(null, null, oldDocResource)); } List<DocumentModel> commentList = new ArrayList<DocumentModel>(); for (Statement stmt : statementList) { QNameResourceImpl subject = (QNameResourceImpl) stmt.getSubject(); DocumentModel commentDocModel = (DocumentModel) relationManager.getResourceRepresentation( config.commentNamespace, subject, ctxMap); if (commentDocModel == null) { log.warn("Could not adapt comment relation subject to a document " + "model; check the service relation adapters configur ation"); continue; } commentDocModel.detach(true); commentList.add(commentDocModel); } CommentSorter sorter = new CommentSorter(true); Collections.sort(commentList, sorter); return commentList; }); }