Skip to content

Commit

Permalink
Log access denied error separately to other IO exceptions so cause is…
Browse files Browse the repository at this point in the history
… clearer (hyperledger#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>
  • Loading branch information
matthew1001 and matthew1001 authored May 17, 2023
1 parent 6ef5e75 commit 74a9017
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

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;
Expand All @@ -46,6 +47,11 @@ public static Set<EnodeURL> fromPath(
} 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;
Expand Down

0 comments on commit 74a9017

Please sign in to comment.