Skip to content

Commit 897796f

Browse files
committed
Narrow catch clause in createArchive() to MavenArchiverException
Instead of catching the broad Exception type, catch only MavenArchiverException which is the specific checked exception that createArchive() declares. ArchiverException (from addDirectory) is a RuntimeException and propagates naturally.
1 parent 2cd6685 commit 897796f

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ public Path createArchive() throws MojoException {
288288
archiver.createArchive(session, project, archive);
289289

290290
return jarFile;
291-
} catch (Exception e) {
292-
// TODO: improve error handling
291+
} catch (MavenArchiverException e) {
293292
throw new MojoException("Error assembling JAR", e);
294293
}
295294
}

0 commit comments

Comments
 (0)