[
https://issues.apache.org/jira/browse/MSHARED-1107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Konrad Windszus updated MSHARED-1107:
-------------------------------------
Description:
The condition in
https://github.com/apache/maven-shared-utils/blob/2bf1e034b06557830b9e2bfe0689f1b93ea5fbd0/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java#L1904
returns false in case the source file returns {{File.lastModified() = 0}} as
{{lastModified}} also returns 0 for non-existing files. This leads to the
following exception in case the destination does not yet exist.
{code}
java.nio.file.NoSuchFileException: <destFile>
at sun.nio.fs.UnixException.translateToIOException (UnixException.java:92)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:111)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:116)
at sun.nio.fs.UnixFileAttributeViews$Posix.setMode
(UnixFileAttributeViews.java:254)
at sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions
(UnixFileAttributeViews.java:276)
at java.nio.file.Files.setPosixFilePermissions (Files.java:2080)
at org.apache.maven.shared.utils.io.FileUtils.copyFilePermissions
(FileUtils.java:1997)
at org.apache.maven.shared.utils.io.FileUtils.copyFile (FileUtils.java:1978)
{code}
This is a regression introduced with MSHARED-884.
This method is for example used in {{maven-resources-plugin}}:
{code}
at org.apache.maven.shared.utils.io.FileUtils.copyFile (FileUtils.java:1978)
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile
(DefaultMavenFileFilter.java:106)
at
org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources
(DefaultMavenResourcesFiltering.java:262)
at org.apache.maven.plugins.resources.ResourcesMojo.execute
(ResourcesMojo.java:356)
{code}
was:
The condition in
https://github.com/apache/maven-shared-utils/blob/2bf1e034b06557830b9e2bfe0689f1b93ea5fbd0/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java#L1904
returns false in case the source file returns {{File.lastModified() = 0}}.
This leads to the following exception in case the destination does not yet
exist.
{code}
java.nio.file.NoSuchFileException: <destFile>
at sun.nio.fs.UnixException.translateToIOException (UnixException.java:92)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:111)
at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:116)
at sun.nio.fs.UnixFileAttributeViews$Posix.setMode
(UnixFileAttributeViews.java:254)
at sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions
(UnixFileAttributeViews.java:276)
at java.nio.file.Files.setPosixFilePermissions (Files.java:2080)
at org.apache.maven.shared.utils.io.FileUtils.copyFilePermissions
(FileUtils.java:1997)
at org.apache.maven.shared.utils.io.FileUtils.copyFile (FileUtils.java:1978)
{code}
This is a regression introduced with MSHARED-884.
> FileUtils.copyFile() fails with source file having lastModified = 0
> -------------------------------------------------------------------
>
> Key: MSHARED-1107
> URL: https://issues.apache.org/jira/browse/MSHARED-1107
> Project: Maven Shared Components
> Issue Type: Bug
> Affects Versions: maven-shared-utils-3.2.0
> Reporter: Konrad Windszus
> Priority: Major
>
> The condition in
> https://github.com/apache/maven-shared-utils/blob/2bf1e034b06557830b9e2bfe0689f1b93ea5fbd0/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java#L1904
> returns false in case the source file returns {{File.lastModified() = 0}} as
> {{lastModified}} also returns 0 for non-existing files. This leads to the
> following exception in case the destination does not yet exist.
> {code}
> java.nio.file.NoSuchFileException: <destFile>
> at sun.nio.fs.UnixException.translateToIOException (UnixException.java:92)
> at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:111)
> at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:116)
> at sun.nio.fs.UnixFileAttributeViews$Posix.setMode
> (UnixFileAttributeViews.java:254)
> at sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions
> (UnixFileAttributeViews.java:276)
> at java.nio.file.Files.setPosixFilePermissions (Files.java:2080)
> at org.apache.maven.shared.utils.io.FileUtils.copyFilePermissions
> (FileUtils.java:1997)
> at org.apache.maven.shared.utils.io.FileUtils.copyFile
> (FileUtils.java:1978)
> {code}
> This is a regression introduced with MSHARED-884.
> This method is for example used in {{maven-resources-plugin}}:
> {code}
> at org.apache.maven.shared.utils.io.FileUtils.copyFile
> (FileUtils.java:1978)
> at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile
> (DefaultMavenFileFilter.java:106)
> at
> org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources
> (DefaultMavenResourcesFiltering.java:262)
> at org.apache.maven.plugins.resources.ResourcesMojo.execute
> (ResourcesMojo.java:356)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)