Log access denied error separately to other IO exceptions so cause is clearer (#5454)

* Log access denied error separately to other IO exceptions so cause is clearer

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

* Fix Java spotless errors

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

---------

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
Co-authored-by: Matthew Whitehead <matthew1001@gmail.com>
pull/5470/head
Matt Whitehead 1 year ago committed by GitHub
parent 6ef5e75fd8
commit 74a9017639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/peers/StaticNodesParser.java

@ -22,6 +22,7 @@ import org.hyperledger.besu.plugin.data.EnodeURL;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.AccessDeniedException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
@ -46,6 +47,11 @@ public class StaticNodesParser {
} catch (FileNotFoundException | NoSuchFileException ex) {
LOG.debug("StaticNodes file {} does not exist, no static connections will be created.", path);
return emptySet();
} catch (AccessDeniedException ex) {
LOG.warn(
"Access denied to static nodes file ({}). Ensure static nodes file and node data directory have correct permissions.",
path);
throw ex;
} catch (IOException ex) {
LOG.warn("Unable to parse static nodes file ({})", path);
throw ex;

Loading…
Cancel
Save