This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch maven-filtering-3.x in repository https://gitbox.apache.org/repos/asf/maven-filtering.git
The following commit(s) were added to refs/heads/maven-filtering-3.x by this push: new 2860039 [MSHARED-1153] FilteringUtils makes incorrect assumption about filesystem 2860039 is described below commit 2860039597ab60827a1b6347889aa112f285bf5f Author: James Nord <jtn...@users.noreply.github.com> AuthorDate: Tue Sep 10 12:42:29 2024 +0100 [MSHARED-1153] FilteringUtils makes incorrect assumption about filesystem In some conditions a FileSystemException can be thrown when attempting to set the posix permissions of a file. As the file permissions are best effort, we now catch this and apply the fallback of using partial permissions. The implementation complies with the contract of the method now. This closes #116 --- src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java b/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java index 6c1f3d3..b68e3cd 100644 --- a/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java +++ b/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java @@ -24,6 +24,7 @@ import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.nio.charset.Charset; +import java.nio.file.FileSystemException; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.attribute.PosixFilePermission; @@ -367,7 +368,7 @@ public final class FilteringUtils { Files.setPosixFilePermissions(destination.toPath(), Files.getPosixFilePermissions(source.toPath())); } catch (NoSuchFileException nsfe) { // ignore if destination file or symlink does not exist - } catch (UnsupportedOperationException e) { + } catch (UnsupportedOperationException | FileSystemException e) { // fallback to setting partial permissions destination.setExecutable(source.canExecute()); destination.setReadable(source.canRead());