Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 87bf4e4

Browse files
kunall17niftynei
authored andcommitted
Simplify same catch blocks
1 parent ba74e0c commit 87bf4e4

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

app/src/main/java/com/zulip/android/models/Message.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,7 @@ private static Spanned formatContent(String source, ZulipApp app) {
473473
Parser parser = new Parser();
474474
try {
475475
parser.setProperty(Parser.schemaProperty, schema);
476-
} catch (org.xml.sax.SAXNotRecognizedException e) {
477-
// Should not happen.
478-
throw new RuntimeException(e);
479-
} catch (org.xml.sax.SAXNotSupportedException e) {
476+
} catch (org.xml.sax.SAXNotRecognizedException | org.xml.sax.SAXNotSupportedException e) {
480477
// Should not happen.
481478
throw new RuntimeException(e);
482479
}

app/src/main/java/com/zulip/android/util/CustomHtmlToSpannedConverter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,9 @@ public Spanned convert() {
8585
mReader.setContentHandler(this);
8686
try {
8787
mReader.parse(new InputSource(new StringReader(mSource)));
88-
} catch (IOException e) {
88+
} catch (IOException | SAXException e) {
8989
// We are reading from a string. There should not be IO problems.
9090
throw new RuntimeException(e);
91-
} catch (SAXException e) {
92-
// TagSoup doesn't throw parse exceptions.
93-
throw new RuntimeException(e);
9491
}
9592

9693
// Fix flags and range for paragraph-type markup.

app/src/main/java/com/zulip/android/util/MD5Util.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ public static String md5Hex(String message) {
2727
try {
2828
MessageDigest md = MessageDigest.getInstance("MD5");
2929
return hex(md.digest(message.getBytes("CP1252")));
30-
} catch (NoSuchAlgorithmException e) {
31-
Log.e(TAG, e.getMessage(), e);
32-
} catch (UnsupportedEncodingException e) {
30+
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
3331
Log.e(TAG, e.getMessage(), e);
3432
}
3533
return null;

0 commit comments

Comments
 (0)