From 8c7199c586e29dbdccba894c249baf4524047759 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 6 Sep 2022 18:47:41 -0500 Subject: [PATCH] Fix for java.lang.UnsupportedOperationException: newFileChannel Signed-off-by: Joakim Erdfelt --- .../src/main/java/org/eclipse/jetty/util/BufferUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java index f8313d183d3..d0c951663ff 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java @@ -1072,7 +1072,7 @@ public class BufferUtil public static ByteBuffer toMappedBuffer(Resource resource) throws IOException { Path path = resource.getPath(); - if (path == null) + if (path == null || !path.toUri().getScheme().endsWith("file")) return null; return toMappedBuffer(path); } @@ -1080,7 +1080,7 @@ public class BufferUtil public static ByteBuffer toMappedBuffer(Resource resource, long pos, long len) throws IOException { Path path = resource.getPath(); - if (path == null) + if (path == null || !path.toUri().getScheme().endsWith("file")) return null; return toMappedBuffer(path, pos, len); }