List of usage examples for java.nio.file.attribute PosixFilePermission equals
public boolean equals(Object obj)
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 } }