Handle BufferUnderflowException as a possible registry corruption (#614)

This commit is contained in:
Guillaume Nodet
2022-04-11 13:18:42 +02:00
committed by GitHub
parent 2ab4cd8083
commit 4cea5d3078

View File

@@ -18,6 +18,7 @@ package org.mvndaemon.mvnd.common;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
@@ -246,7 +247,7 @@ public class DaemonRegistry implements AutoCloseable {
return;
} catch (IOException e) {
throw new RuntimeException("Could not lock offset 0 of " + registryFile);
} catch (IllegalStateException | ArrayIndexOutOfBoundsException e) {
} catch (IllegalStateException | ArrayIndexOutOfBoundsException | BufferUnderflowException e) {
String absPath = registryFile.toAbsolutePath().normalize().toString();
LOGGER.warn("Invalid daemon registry info, " +
"trying to recover from this issue. " +