You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/09/16 11:50:27 UTC
(maven-scm) branch throwable created (now c47a59f2d)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a change to branch throwable
in repository https://gitbox.apache.org/repos/asf/maven-scm.git
at c47a59f2d Don't catch Throwable. Don't use exceptions for flow control.
This branch includes the following new commits:
new c47a59f2d Don't catch Throwable. Don't use exceptions for flow control.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-scm) 01/01: Don't catch Throwable. Don't use exceptions for flow control.
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch throwable
in repository https://gitbox.apache.org/repos/asf/maven-scm.git
commit c47a59f2d5130b3be2e277932abf66dd39a0c881
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Tue Sep 16 07:50:18 2025 -0400
Don't catch Throwable. Don't use exceptions for flow control.
---
.../maven/scm/provider/git/sshd/git/pack/GitPackCommand.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/sshd/git/pack/GitPackCommand.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/sshd/git/pack/GitPackCommand.java
index e702e9eb1..5af04226d 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/sshd/git/pack/GitPackCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gittest/src/main/java/org/apache/maven/scm/provider/git/sshd/git/pack/GitPackCommand.java
@@ -70,7 +70,7 @@ public void run() {
}
if (args.length != 2) {
- throw new IllegalArgumentException("Invalid git command line (no arguments): " + command);
+ onExit(-1, "Invalid git command line (no arguments): " + command);
}
Path rootDir = resolveRootDirectory(command, args);
@@ -82,12 +82,12 @@ public void run() {
} else if (RemoteConfig.DEFAULT_RECEIVE_PACK.equals(subCommand)) {
new ReceivePack(db).receive(getInputStream(), getOutputStream(), getErrorStream());
} else {
- throw new IllegalArgumentException("Unknown git command: " + command);
+ onExit(-1, "Unknown git command: " + command);
}
}
onExit(0);
- } catch (Throwable t) {
- onExit(-1, t.getClass().getSimpleName());
+ } catch (IOException ex) {
+ onExit(-1, ex.getMessage());
}
}