desruisseaux commented on issue #230:
URL:
https://github.com/apache/maven-clean-plugin/issues/230#issuecomment-2767378965
It may be resolved as a side effect of #243. There is two issues that were
addressed. First, they were some codes like below:
```java
try {
...
} catch (IOException e) {
throw new IOException("Cannot delete " + file, e);
}
```
The problem is that the exception subtype (`AccessDeniedException`,
`DirectoryNotEmptyException`, _etc._) become hidden behind the cause of the
`IOException`, making it less easy to see. The message _"Cannot delete file"_
does not really bring value as the original exception usually already had the
file name.
A second issue is that some parts of the code continued its operation
despite the exception, causing another exception of different kind later. For
example, if a file was read-only, Java throws `AccessDeniedException`. But the
code was continuing despite that exception, and throwing
`DirectoryNotEmptyException` later when it tried to delete the directory
containing the read-only file. The exception reported to the user was
`DirectoryNotEmptyException`. The `AccessDeniedException` was available as a
cause or suppressed exception, but it was not obvious to the user that it was
the root cause.
#243 no longer wraps the exceptions. The `IOException` that the user get is
the root cause. In above example with a read-only file, the user gets the
`AccessDeniedException`, there is no longer a `DirectoryNotEmptyException`.
This change can be seen in a change in the JUnit tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]