Source:
private void sendResource(JarFile jar, JarEntry entry, HttpServletResponse res, boolean format) throws IOException { String entryName = entry.getName(); byte[] data = null; if (entry.getSize() <= 128 * 1024) { data = new byte[(int) entry.getSize()]; InputStream in = jar.getInputStream(entry); try { IO.readFully(in, data, 0, data.length); } finally { in.close(); } } else if (format == true) { log.warn(String.format("Plugin file %s to large to format", entryName)); } String contentType = null; String charEnc = null; Attributes atts = entry.getAttributes(); if (atts != null) { contentType = Strings.emptyToNull(atts.getValue("Content-Type")); charEnc = Strings.emptyToNull(atts.getValue("Character-Encoding")); } if (contentType == null) { MimeType type = mimeUtil.getMimeType(entryName, data); contentType = type.toString(); } if (charEnc == null) { charEnc = "UTF-8"; } if (format && data != null) { MarkdownFormatter fmter = new MarkdownFormatter(); String decodedData = RawParseUtils.decode(data); data = fmter.getHtmlFromMarkdown(decodedData).getBytes(charEnc); res.setHeader("Content-Length", Long.toString(data.length)); contentType = "text/html"; } else { res.setHeader("Content-Length", Long.toString(entry.getSize())); } long time = entry.getTime(); if (0 < time) { res.setDateHeader("Last-Modified", time); } res.setContentType(contentType); if (data != null) { res.getOutputStream().write(data); } else { InputStream in = jar.getInputStream(entry); try { OutputStream out = res.getOutputStream(); try { byte[] tmp = new byte[1024]; int n; while ((n = in.read(tmp)) > 0) { out.write(tmp, 0, n); } } finally { out.close(); } } finally { in.close(); } } }

Target:
private void sendResource(JarFile jar, JarEntry entry, HttpServletResponse res, boolean format) throws IOException { String entryName = entry.getName(); byte[] data = null; if (entry.getSize() <= 128 * 1024) { data = new byte[(int) entry.getSize()]; InputStream in = jar.getInputStream(entry); try { IO.readFully(in, data, 0, data.length); } finally { in.close(); } } else if (format == true) { log.warn(String.format("Plugin file %s to large to format", entryName)); } String contentType = null; String charEnc = null; Attributes atts = entry.getAttributes(); if (atts != null) { contentType = Strings.emptyToNull(atts.getValue("Content-Type")); charEnc = Strings.emptyToNull(atts.getValue("Character-Encoding")); } if (contentType == null) { MimeType type = mimeUtil.getMimeType(entryName, data); contentType = type.toString(); } if (format && data != null) { if (charEnc == null) { charEnc = "UTF-8"; } MarkdownFormatter fmter = new MarkdownFormatter(); String decodedData = RawParseUtils.decode(data); data = fmter.getHtmlFromMarkdown(decodedData).getBytes(charEnc); res.setHeader("Content-Length", Long.toString(data.length)); contentType = "text/html"; } else { res.setHeader("Content-Length", Long.toString(entry.getSize())); } long time = entry.getTime(); if (0 < time) { res.setDateHeader("Last-Modified", time); } res.setContentType(contentType); if (charEnc != null) { res.setCharacterEncoding(charEnc); } if (data != null) { res.getOutputStream().write(data); } else { InputStream in = jar.getInputStream(entry); try { OutputStream out = res.getOutputStream(); try { byte[] tmp = new byte[1024]; int n; while ((n = in.read(tmp)) > 0) { out.write(tmp, 0, n); } } finally { out.close(); } } finally { in.close(); } } }