I have a peculiar problem with the java.nio
file system API. My application is running on Windows 8, Java version 1.8. I attach an alternate data stream to my files for my application scenarios.
Below is the code:
log.info("Path for which file id will be retrieved: " + fullPath);
UserDefinedFileAttributeView fileAttributeView = Files.getFileAttributeView(fullPath, UserDefinedFileAttributeView.class); //line 2
List<String> userAttributes = fileAttributeView.list();
if (userAttributes.contains("objectid")) {
byte[] b = (byte[]) Files.getAttribute(fullPath, "user:objectid"); //line 5
String objectId = new String(b, "UTF-8");
log.info("File id retrieved successfully: " + objectId); //line 7
return objectId;
}
log.info("User attributes does not contain OBJECTID ,null file id will be returned."); //line 10
return null;
Above code is getting the file attribute view for the user defined attributes.
My custom attribute is called objectid
. For one of my users the neither log of (line 7) is recorded nor the log of line 10. And the application just gets blocked. I think it's getting blocked somewhere between line 2 and line 3 where two file API calls are made. Because in my scenario the code execution should not get to the line 5.
Question: Is there any scenario where the Files.getFileAttributeView()
or UserDefineFileAttributeView.list()
calls can get blocked? Can it be specific to any file system or any other thing which I may be missing? I have proper exception handling in the code above.
Since it is a production system I am not able to debug and also the thread dump does not show anything. This is happening only for one user which is making this case interesting.