Hi,

I’d like to undestand why I’m experiencing the following behavior and if it’s 
expected (as I was not expecting it to work like that). But basically when 
parsing files whose access time is <= to its change time it will update the 
Access time after processing the file.

Here is how I was able to reproduce the issue:

OS: Ubuntu 20.04.5 LTS x64
Maven: 3.6.3
OpenJDK: 17.0.4 2022-07-19
Tika: 2.7.0

1.- Create text file
echo "Single file with text" > file.txt

2.- Check file.txt access time
              stat file.txt

[cid:image002.png@01D9D46A.8C603F00]

3.- Run java test app and specify file.txt as argument
               java -cp target/tika-example-1.0.0-jar-with-dependencies.jar 
TikaExample ~/testing/access/file.txt

[An Ink Drawing]

4.- Check file.txt access time again

[cid:image006.png@01D9D46A.8C603F00]

5.- Re-run java test app again

[cid:image012.png@01D9D46A.8C603F00]

6.- Check file.txt access time

[cid:image014.png@01D9D46A.8C603F00]

As you can see the access time was modified only after parsing the file the 
first time. This behavior was unexpected for me mostly because it only happens 
when Access is <= than Change, so if I re-run the java test app with the same 
file multiple times it will not change Access time anymore (until the file is 
edited/modified).

Example was compiled with:
           mvn clean compile assembly:single

[cid:image018.png@01D9D46A.8C603F00]

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
<project xmlns="http://maven.apache.org/POM/4.0.0";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>tika-example</artifactId>
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.tika</groupId>
			<artifactId>tika-core</artifactId>
			<version>2.7.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
			<artifactId>tika-parsers-standard-package</artifactId>
			<version>2.7.0</version>
        </dependency>
    </dependencies>
    <build>
		<pluginManagement>
            <plugins>
                <plugin>
					<artifactId>maven-assembly-plugin</artifactId>
					<configuration>
						<archive>
							<manifest>
								<mainClass>fully.qualified.MainClass</mainClass>
							</manifest>
							<manifestEntries>
								<Multi-Release>true</Multi-Release>
							</manifestEntries>
						</archive>
						<descriptorRefs>
							<descriptorRef>jar-with-dependencies</descriptorRef>
						</descriptorRefs>
					</configuration>
				</plugin>
				<plugin>
					<artifactId>maven-clean-plugin</artifactId>
					<version>3.2.0</version>
				</plugin>
				<plugin>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.10.1</version>
					<configuration>
						<release>13</release>
						<compilerArgs>
							<arg>-Xlint:all</arg>
						</compilerArgs>
					</configuration>
				</plugin>				
            </plugins>
		</pluginManagement>
    </build>
</project>

Attachment: TikaExample.java
Description: TikaExample.java

Reply via email to