From 4cea5d30785dbac160b1e140f612e8b99d8dbd04 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Mon, 11 Apr 2022 13:18:42 +0200 Subject: [PATCH] Handle BufferUnderflowException as a possible registry corruption (#614) --- .../main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java b/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java index 5d3d7a87..1e7abc8d 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java @@ -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. " +