Source:
private void processDocument(Id guid, DocId docId, Document document, Request request, Response response) throws IOException { logger.log(Level.FINE, "Fetch document for DocId {0}", guid); String vsDocId = document.get_VersionSeries().get_Id().toString(); logger.log(Level.FINE, "VersionSeriesID for document is: {0}", vsDocId); if (options.markAllDocsAsPublic()) { response.setSecure(false); } else { ActiveMarkingList activeMarkings = document.get_ActiveMarkings(); Permissions.Acl permissions = new Permissions(document.get_Permissions(), document.get_Owner()) .getAcl(); processPermissions(docId, activeMarkings, permissions, response); response.setSecure(true); } response.setContentType(document.get_MimeType()); response.setDisplayUrl( URI.create(options.getDisplayUrl() + percentEscape(vsDocId))); response.setLastModified(document.get_DateLastModified()); setMetadata(document, response); if (request.canRespondWithNoContent(document.get_DateLastModified())) { logger.log(Level.FINE, "Content not modified since last crawl: {0}", guid); response.respondNoContent(); return; } logger.log(Level.FINEST, "Getting content"); if (hasAllowableSize(guid, document)) { try (InputStream in = document.accessContentStream(0)) { OutputStream out = response.getOutputStream(); IOHelper.copyStream(in, out); } catch (EngineRuntimeException e) { if (e.getExceptionCode() == ExceptionCode.API_INDEX_OUT_OF_BOUNDS) { logger.log(Level.FINER, "Document has no content: {0}", guid); response.getOutputStream(); } else if (e.getExceptionCode() == ExceptionCode.API_NOT_A_CONTENT_TRANSFER) { logger.log(Level.FINER, "Document content element is unsupported: {1}", guid); response.getOutputStream(); } else { logger.log(Level.WARNING, "Unable to get document content: {1}", guid); response.respondNoContent(); } } } }

Target:
private void processDocument(Id guid, DocId docId, Document document, Request request, Response response) throws IOException { logger.log(Level.FINE, "Fetch document for DocId {0}", guid); String vsDocId = document.get_VersionSeries().get_Id().toString(); logger.log(Level.FINE, "VersionSeriesID for document is: {0}", vsDocId); if (!options.markAllDocsAsPublic()) { ActiveMarkingList activeMarkings = document.get_ActiveMarkings(); Permissions.Acl permissions = new Permissions(document.get_Permissions(), document.get_Owner()) .getAcl(); processPermissions(docId, activeMarkings, permissions, response); } response.setContentType(document.get_MimeType()); response.setDisplayUrl( URI.create(options.getDisplayUrl() + percentEscape(vsDocId))); response.setLastModified(document.get_DateLastModified()); setMetadata(document, response); if (request.canRespondWithNoContent(document.get_DateLastModified())) { logger.log(Level.FINE, "Content not modified since last crawl: {0}", guid); response.respondNoContent(); return; } logger.log(Level.FINEST, "Getting content"); if (hasAllowableSize(guid, document)) { try (InputStream in = document.accessContentStream(0)) { OutputStream out = response.getOutputStream(); IOHelper.copyStream(in, out); } catch (EngineRuntimeException e) { if (e.getExceptionCode() == ExceptionCode.API_INDEX_OUT_OF_BOUNDS) { logger.log(Level.FINER, "Document has no content: {0}", guid); response.getOutputStream(); } else if (e.getExceptionCode() == ExceptionCode.API_NOT_A_CONTENT_TRANSFER) { logger.log(Level.FINER, "Document content element is unsupported: {1}", guid); response.getOutputStream(); } else { logger.log(Level.WARNING, "Unable to get document content: {1}", guid); response.respondNoContent(); } } } }