Java file last modified returns 0

Lon*_*rer 3 java time jcifs file

I have the following code to check the last modification on a file saved on network drive.

private long determineLastEdit(ILoaderData file) {

    String localDir = "c:\\Software\\log\\"; 
    String localPDF = "empty28.pdf";
    String originDir = "smb:\\ProdName\\ShareName\\Temp\\username\\path\\to\\folder\\";
      //My company remote storage

    File localFile = new File(originDir + localPDF)
      //this does not work

    //File localFile = new File(localDir + localPDF)
      //this works as expected

    Date currentTime = new Date();
    long timeCurrent = currentTime.getTime();
    long timeFile = localFile.lastModified();
      //this returns 0 on remote, correct time on local

    boolean fileEx = localFile.isFile(); //returns false on remote, true on local
    boolean fileTp = localFile.isAbsolute(); //returns false on remote, true on local


    long difference = Math.abs(timeCurrent - timeFile);

    return difference;

}
Run Code Online (Sandbox Code Playgroud)

The parameter given to constructor of a file is following:

smb:\\\ProdName\\\ShareName\\\Temp\\\username\\\path\\\to\\\folder\\\empty28.pdf
Run Code Online (Sandbox Code Playgroud)

However, the lastModified() method returns 0 for some reason, what am I doing wrong? The file has no lock of any kind, it is regular (altough empty PDF).

EDIT1: I tested the method on local file, the path was:

c:\\\Software\\\log\\\empty28.pdf
Run Code Online (Sandbox Code Playgroud)

And the value returned was correct, my suspicion was that method was not allowed to execute on a given file since it's on network drive. However, this check happens on one thread that is already authorized. No clue where the error is.

EDIT2: I updated code to provide better examples. Right now, it seems the problem is with reading file from network drive

EDIT3 I Tried using different method. Imported:

import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
Run Code Online (Sandbox Code Playgroud)

and added code:

Path path = Paths.get(localDir + localPDF);
BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class);
Run Code Online (Sandbox Code Playgroud)

with same result, again, local drive works and remote is not working.

Ale*_*nov 5

根据Javadocs,方法lastModified:

返回一个长值,表示文件上次修改的时间,以自纪元(1970 年 1 月 1 日 00:00:00 GMT)以来的毫秒为单位测量,如果文件不存在或发生 I/O 错误,则返回 0L。

因此,请检查传递给 File 构造函数的 URL。