Missing exception warning
No. 247
Q: |
According to the API documentation the Files.copy(...) method throws the following exceptions:
We consider the following code: static void copy(final String sourceFileName, final String destinationFileName) throws FileAlreadyExistsException /* Compile time warning: Exception 'java.nio.file.FileAlreadyExistsException' is never thrown in the method */ { try { Files.copy(Paths.get(sourceFileName), Paths.get(destinationFileName)); } catch(final IOException e) { System.out.println("Error copying file"); } } Though there is no |
||
A: |
The exception class |