[Solved] org.apache.tika.exception.AccessPermissionException


AccessPermissionException is a subclass on TikaException. This exception occurred when a document/file does not allow content extraction. For Example, This exception is most common for PDF type documents, which might cause this type of exception.

public class AccessPermissionException extends TikaException

Solutions

Always check file access, read, write and executable permission before going to use with TIKA, accordingly perform operations.

File file = new File("TEST-File");

With Java NIO Libraries
boolean isRegularFile = Files.isRegularFile(file);
boolean isHidden = Files.isReadable(file);
boolean isReadable = Files.isReadable(file);
boolean isExecutable = Files.isExecutable(file);
boolean isSymbolicLink = Files.isSymbolicLink(file);
boolean isWritable = Files.isWritable(directory);

With Java IO Libraries
boolean isReadable=file.isReadable();
boolean isWritable=file.setWritable();
boolean isExecutable=file.setExecutable();

Constructors

Here are list of Constructor for this exception class:

  • AccessPermissionException() : Default constructor
  • AccessPermissionException(String info) : Constructor with exception message
  • AccessPermissionException(String info, Throwable th): Throw exception with message and stack trace.
  • AccessPermissionException(Throwable th): Throw exception message stack trace.

References

https://tika.apache.org/1.22/api/org/apache/tika/exception/AccessPermissionException.html

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s