DbSession session = dbClient.openSession(false);
try {
dbClient.componentDao().getByKey(session, fileKey);
List<String> lines = sourceService.getLinesAsTxt(session, fileKey);
if (lines == null) {
throw new NotFoundException("File '" + fileKey + "' does not exist");
}
IOUtils.writeLines(lines, "\n", response.stream().output(), Charsets.UTF_8);
} catch (IOException e) {
throw new IllegalStateException("Fail to write raw source of file " + fileKey, e);
} finally {