Skip to content

Commit

Permalink
Merge PR #67 by @asiekierka - backport recent fix by @immortius
Browse files Browse the repository at this point in the history
  • Loading branch information
Cervator committed Sep 1, 2018
2 parents 66ffc4b + 04e3367 commit 8abc370
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -96,9 +96,11 @@ public String getFileExtension() {
* @throws IOException If there was an error opening the file
*/
public BufferedInputStream openStream() throws IOException {
Preconditions.checkState(Files.isRegularFile(path));
try {
return AccessController.doPrivileged((PrivilegedExceptionAction<BufferedInputStream>) () -> new BufferedInputStream(Files.newInputStream(path)));
return AccessController.doPrivileged((PrivilegedExceptionAction<BufferedInputStream>) () -> {
Preconditions.checkState(Files.isRegularFile(path));
return new BufferedInputStream(Files.newInputStream(path));
});
} catch (PrivilegedActionException e) {
throw new IOException("Failed to open stream for '" + path + "'", e);
}
Expand Down

0 comments on commit 8abc370

Please sign in to comment.