add try catch to getFileAttributes