We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4473d24 commit 0c03b46Copy full SHA for 0c03b46
1 file changed
src/main/java/org/codehaus/plexus/util/io/CachingOutputStream.java
@@ -22,8 +22,11 @@
22
import java.nio.Buffer;
23
import java.nio.ByteBuffer;
24
import java.nio.channels.FileChannel;
25
+import java.nio.file.Files;
26
import java.nio.file.Path;
27
import java.nio.file.StandardOpenOption;
28
+import java.nio.file.attribute.FileTime;
29
+import java.time.Instant;
30
import java.util.Objects;
31
32
/**
@@ -154,7 +157,12 @@ public void close() throws IOException
154
157
long position = channel.position();
155
158
if ( position != channel.size() )
156
159
{
- modified = true;
160
+ if ( !modified )
161
+ {
162
+ FileTime now = FileTime.from( Instant.now() );
163
+ Files.setLastModifiedTime( path, now );
164
+ modified = true;
165
+ }
166
channel.truncate( position );
167
}
168
channel.close();
0 commit comments