ascheman commented on PR #561:
URL: https://github.com/apache/maven-jar-plugin/pull/561#issuecomment-5574113456
@elharo — reviewing as requested.
The narrowing itself looks correct: `catch (MavenArchiverException |
ArchiverException e)` still compiles against `throws MojoException`, so no
checked exception leaks, and I agree archiver failures should be wrapped rather
than propagated raw.
My main point is sequencing rather than the diff: I'd suggest we **merge
#508 first and then re-evaluate #561.** #508 rewrites `createArchive()` to
write archive content via the JDK `jar` ToolProvider (keeping `MavenArchiver`
only for the manifest), which removes both the `catch` block this PR narrows
and the `addDirectory(...)` call on the following line. So once #508 lands,
#561 is likely superseded entirely — re-evaluating afterwards avoids a
guaranteed conflict and some throwaway work.
If #561 does proceed independently of #508, two small follow-ups:
- The PR description no longer matches the code (also the open "To be
addressed" thread): it says the catch is narrowed to *only*
`MavenArchiverException` and that `ArchiverException` is a `RuntimeException`
that propagates — but the code multi-catches both, and plexus
`ArchiverException` is a *checked* exception (`extends Exception`). Worth
aligning the description with the code.
- Scout rule: the adjacent `addDirectory(File, String[], String[])` is
`@Deprecated` in plexus-archiver 4.12.0 (all four `File`-based overloads —
"Will go away in next major version"). The non-deprecated form is:
```java
archiver.getArchiver().addFileSet(
DefaultFileSet.fileSet(contentDirectory.toFile())
.includeExclude(getIncludes(), getExcludes()));
```
Both are moot if we take the #508-first route.
--
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]