I am trying to use the 'file' variable that should be available according to https://docs.openkm.com/kcenter/view/ok ... Automation
However whenever I try to do anything with it I get null pointer exceptions. What am I doing wrong?
The following script is run on document creation (I have tried both pre and post and I get the same result)
However whenever I try to do anything with it I get null pointer exceptions. What am I doing wrong?
The following script is run on document creation (I have tried both pre and post and I get the same result)
Code: Select all
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
File file2 = (File) file;//cast from Object to File so I can call toPath method
BasicFileAttributes attr = null;
try {
attr = Files.readAttributes(file2.toPath(), BasicFileAttributes.class);//line where null pointer exception occurs on file2 variable
System.out.println("creationTime: " + attr.creationTime());
} catch (IOException e) {
e.printStackTrace();
}