Fix too many open files with resource domain
@@ -346,13 +346,12 @@ public final class DirectoryBrowserSupport implements HttpResponse {
if(LOGGER.isLoggable(Level.FINE))
LOGGER.fine("Serving "+baseFile+" with lastModified=" + lastModified + ", length=" + length);
- InputStream in = baseFile.open();
if (view) {
// for binary files, provide the file name for download
rsp.setHeader("Content-Disposition", "inline; filename=" + baseFile.getName());
// pseudo file name to let the Stapler set text/plain
- rsp.serveFile(req, in, lastModified, -1, length, "plain.txt");
+ rsp.serveFile(req, baseFile.open(), lastModified, -1, length, "plain.txt");
} else {
if (resourceToken != null) {
// redirect to second domain
@@ -368,7 +367,7 @@ public final class DirectoryBrowserSupport implements HttpResponse {
}
}
}
- rsp.serveFile(req, in, lastModified, -1, length, baseFile.getName());
+ rsp.serveFile(req, baseFile.open(), lastModified, -1, length, baseFile.getName());
}
}
}
