The task is to create a new xml file from an old and the new file must have the same permissions as the old.
I tried
newfile.setExecutable(oldfile.canExecute());
newfile.setReadable(oldfile.canWrite());
newfile.setWritable(oldfile.canRead());
but the result is old file "rw-rw-r--" and new file "rw-rw-rw-"
I also tried
Path temp = Paths.get(path + FILE_NAME);
Set<PosixFilePermission> set =
Files.getPosixFilePermissions(temp);
System.out.println("Permissions : " +
PosixFilePermissions.toString(set));
but I get
Exception in thread "main" java.lang.UnsupportedOperationException
at sun.nio.fs.WindowsFileSystemProvider.readAttributes(Unknown Source)
at java.nio.file.Files.readAttributes(Unknown Source)
at com.company.product.loglevel.update_xxx(loglevel.java:xxx)
at com.company.product.logging.loglevel.main(loglevel.java:xxx)
What am I doing wrong? Using Java 1.8