When might an IOError be thrown?

Console, Path#toAbsolutePath, and Path#toUri declare this particular exception to be thrown. Of course, that’s a documentation fact and not an actual declaration; since Error is a runtime exception, declaring it to be thrown in the signature would have no meaning.

From what it looks like in code, Console#readLine and Console#readPassword catch an IOException that results through its normal operation, then propagate that to an IOError.

Essentially, IOError represents a critical failing of the underlying filesystem, or accessing some resource that ties Java to the file system. It’s not thrown often, but it has the potential to be thrown if something serious happens from within the file system.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)