Throw IllegalStateException instead of RuntimeException
It's a best practise to treat base exception classes as abstract and
throw concrete exceptions instead.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I0eea0f960171a34935221de73965a6f56f777b02
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
index 85705c4..c8a84e8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
@@ -72,7 +72,7 @@
URLEncoder.encode(
userProvider.get().getUserName().get(), StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException("No UTF-8 support", e);
+ throw new IllegalStateException("No UTF-8 support", e);
}
r.append("@");
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
index b39b953..04a6fc2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
@@ -98,7 +98,7 @@
try {
r.append(URLEncoder.encode(username.get(), StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException("No UTF-8 support", e);
+ throw new IllegalStateException("No UTF-8 support", e);
}
r.append("@");
r.append(ensureSlash(sshdAddress));