From 32ef1616e68fa7d0f1677be9fa72473b29dac4f0 Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Tue, 26 Jul 2022 10:42:59 +0200 Subject: [PATCH] #8285 - handle review comments Signed-off-by: Ludovic Orban --- .../org/eclipse/jetty/http/CachingContentFactory.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CachingContentFactory.java b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CachingContentFactory.java index e034b4d3c21..a73fd8ee8ef 100644 --- a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CachingContentFactory.java +++ b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CachingContentFactory.java @@ -204,13 +204,9 @@ public class CachingContentFactory implements HttpContent.ContentFactory super(httpContent); _etag = precalculatedEtag; _contentLengthValue = httpContent.getContentLengthValue(); // TODO getContentLengthValue() could return -1 - ByteBuffer byteBuffer = null; - if (_useFileMappedBuffer) - { - // map the content into memory - byteBuffer = BufferUtil.toMappedBuffer(httpContent.getResource(), 0, _contentLengthValue); - } + // map the content into memory if possible + ByteBuffer byteBuffer = _useFileMappedBuffer ? BufferUtil.toMappedBuffer(httpContent.getResource(), 0, _contentLengthValue) : null; if (byteBuffer == null) {