@@ -868,15 +868,15 @@ static List<Path> relativize(final Collection<Path> collection, final Path paren
868868 * @since 2.8.0
869869 */
870870 public static Path setReadOnly (final Path path , final boolean readOnly , final LinkOption ... linkOptions )
871- throws IOException {
871+ throws IOException {
872872 final DosFileAttributeView fileAttributeView = Files .getFileAttributeView (path , DosFileAttributeView .class ,
873- linkOptions );
873+ linkOptions );
874874 if (fileAttributeView != null ) {
875875 fileAttributeView .setReadOnly (readOnly );
876876 return path ;
877877 }
878878 final PosixFileAttributeView posixFileAttributeView = Files .getFileAttributeView (path ,
879- PosixFileAttributeView .class , linkOptions );
879+ PosixFileAttributeView .class , linkOptions );
880880 if (posixFileAttributeView != null ) {
881881 // Works on Windows but not on Ubuntu:
882882 // Files.setAttribute(path, "unix:readonly", readOnly, options);
@@ -888,7 +888,9 @@ public static Path setReadOnly(final Path path, final boolean readOnly, final Li
888888 permissions .remove (PosixFilePermission .OTHERS_WRITE );
889889 return Files .setPosixFilePermissions (path , permissions );
890890 }
891- throw new IOException ("No DosFileAttributeView or PosixFileAttributeView for " + path );
891+ throw new IOException (
892+ String .format ("No DosFileAttributeView or PosixFileAttributeView for '%s' (linkOptions=%s)" , path ,
893+ Arrays .toString (linkOptions )));
892894 }
893895
894896 /**
0 commit comments