Example usage for java.nio.file.attribute PosixFilePermission equals

List of usage examples for java.nio.file.attribute PosixFilePermission equals

Introduction

In this page you can find the example usage for java.nio.file.attribute PosixFilePermission equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:uk.ac.sanger.cgp.wwdocker.Config.java

public static void protectedFileCheck(String filename) throws AccessControlException, IOException {
    Path path = Paths.get(filename);
    Set<PosixFilePermission> permset = Files.getPosixFilePermissions(path);
    Iterator perm = permset.iterator();
    while (perm.hasNext()) {
        PosixFilePermission p = (PosixFilePermission) perm.next();
        if (p.equals(PosixFilePermission.GROUP_READ) || p.equals(PosixFilePermission.OTHERS_READ)) {
            throw new AccessControlException(
                    "Your configuration file (which contains passwords) is readable to others:\n" + "\tFile: "
                            + filename.toString() + "\tPerm: " + PosixFilePermissions.toString(permset));
        }//from  w w w.j  a  v a  2s  . c  om
    }
}