From ca54137c8e643edcaf94f98cf976489581493492 Mon Sep 17 00:00:00 2001 From: Dawid Weiss Date: Tue, 28 Aug 2018 15:11:52 +0200 Subject: [PATCH] LUCENE-8468: use NoSuchFileException instead of FileNotFoundException. --- .../java/org/apache/lucene/store/ByteBuffersDirectory.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/store/ByteBuffersDirectory.java b/lucene/core/src/java/org/apache/lucene/store/ByteBuffersDirectory.java index acff5cf14a6..50fbc0217dd 100644 --- a/lucene/core/src/java/org/apache/lucene/store/ByteBuffersDirectory.java +++ b/lucene/core/src/java/org/apache/lucene/store/ByteBuffersDirectory.java @@ -16,7 +16,6 @@ */ package org.apache.lucene.store; -import java.io.FileNotFoundException; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.file.AccessDeniedException; @@ -151,7 +150,7 @@ public final class ByteBuffersDirectory extends BaseDirectory { ensureOpen(); FileEntry removed = files.remove(name); if (removed == null) { - throw new FileNotFoundException(name); + throw new NoSuchFileException(name); } } @@ -160,7 +159,7 @@ public final class ByteBuffersDirectory extends BaseDirectory { ensureOpen(); FileEntry file = files.get(name); if (file == null) { - throw new FileNotFoundException(name); + throw new NoSuchFileException(name); } return file.length(); } @@ -193,7 +192,7 @@ public final class ByteBuffersDirectory extends BaseDirectory { FileEntry file = files.get(source); if (file == null) { - throw new FileNotFoundException(source); + throw new NoSuchFileException(source); } if (files.putIfAbsent(dest, file) != null) { throw new FileAlreadyExistsException(dest);