Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-701

PathUtils.setReadOnly do not deal with LinuxDosFileAttributeView

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.8.0
    • 2.9.0
    • Utilities
    • None

    Description

      PathUtils.setReadOnly use a DosFileAttributeView first. If this fails with a Exception, a second try with PosixFileAttributeView will not be done.

      The approach is to catch a IOException (java.nio.file.FileSystemException Operation not supported), add it to a exception list. Throw the exception list if not empty.

      Please check the environment of this bug: integration tests are all run on Ubuntu. This occured on Fedora. (Maybe the difference is ext4 ?)

      Example stacktrace (Message is "Operation not supported")

      java.nio.file.FileSystemException: /tmp/junit4674316189874192997/file1-test.txt: Die Operation wird nicht unterst├╝tzt
      	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
      	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
      	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
      	at java.base/sun.nio.fs.LinuxDosFileAttributeView.updateDosAttribute(LinuxDosFileAttributeView.java:278)
      	at java.base/sun.nio.fs.LinuxDosFileAttributeView.setReadOnly(LinuxDosFileAttributeView.java:191)
      	at org.apache.commons.io.file.PathUtils.setReadOnly(PathUtils.java:876)
      	at org.apache.commons.io.file.PathUtils.deleteFile(PathUtils.java:486)
      	at org.apache.commons.io.file.PathUtils.delete(PathUtils.java:393)
      	at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1337)
      	at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:303)
      	at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1189)
      	at org.apache.commons.io.FileUtilsTestCase.setUp(FileUtilsTestCase.java:299)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            xf01213 Boris Unckel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h