Multi-catch.

This commit is contained in:
akwizgran
2017-11-16 11:26:24 +00:00
committed by Torsten Grote
parent 5fa6b0ca1c
commit a5b321a93b
15 changed files with 25 additions and 89 deletions

View File

@@ -294,11 +294,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
for (Feed feed : feeds) {
try {
newFeeds.add(fetchFeed(feed));
} catch (IOException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
newFeeds.add(feed);
} catch (DbException e) {
} catch (IOException | DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
newFeeds.add(feed);
@@ -381,9 +377,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
SyndFeedInput input = new SyndFeedInput();
try {
return input.build(new XmlReader(stream));
} catch (IllegalArgumentException e) {
throw new IOException(e);
} catch (FeedException e) {
} catch (IllegalArgumentException | FeedException e) {
throw new IOException(e);
}
}
@@ -469,13 +463,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
BlogPost post = blogPostFactory
.createBlogPost(groupId, time, null, localAuthor, body);
blogManager.addLocalPost(txn, post);
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch (GeneralSecurityException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch (FormatException e) {
} catch (DbException | GeneralSecurityException | FormatException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch (IllegalArgumentException e) {

View File

@@ -134,9 +134,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
try {
p = forumPostFactory.createPost(groupId, timestamp, parentId,
author, body);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch (FormatException e) {
} catch (GeneralSecurityException | FormatException e) {
throw new RuntimeException(e);
}
return p;

View File

@@ -519,9 +519,7 @@ class IntroduceeManager {
try {
processStateUpdate(txn, null,
engine.onLocalAction(state, localAction));
} catch (DbException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch (IOException e) {
} catch (DbException | IOException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
}
}

View File

@@ -173,9 +173,7 @@ class IntroducerManager {
try {
processStateUpdate(txn,
engine.onLocalAction(state, localAction));
} catch (DbException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch (IOException e) {
} catch (DbException | IOException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
}
}

View File

@@ -251,12 +251,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
LOG.warning("Unknown role '" + role + "'");
throw new DbException();
}
} catch (DbException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
if (role == ROLE_INTRODUCER) introducerManager.abort(txn, state);
else introduceeManager.abort(txn, state);
} catch (FormatException e) {
// FIXME necessary?
} catch (DbException | FormatException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
if (role == ROLE_INTRODUCER) introducerManager.abort(txn, state);
else introduceeManager.abort(txn, state);

View File

@@ -63,9 +63,7 @@ class GroupMessageFactoryImpl implements GroupMessageFactory {
Message m = clientHelper.createMessage(groupId, timestamp, body);
return new GroupMessage(m, null, member);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch (FormatException e) {
} catch (GeneralSecurityException | FormatException e) {
throw new RuntimeException(e);
}
}
@@ -91,9 +89,7 @@ class GroupMessageFactoryImpl implements GroupMessageFactory {
Message m = clientHelper.createMessage(groupId, timestamp, body);
return new GroupMessage(m, parentId, author);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch (FormatException e) {
} catch (GeneralSecurityException | FormatException e) {
throw new RuntimeException(e);
}
}

View File

@@ -324,9 +324,7 @@ public class TestDataCreatorImpl implements TestDataCreator {
.createBlogPost(blog.getId(), timestamp, null, author,
body);
blogManager.addLocalPost(blogPost);
} catch (FormatException e) {
throw new RuntimeException(e);
} catch (GeneralSecurityException e) {
} catch (FormatException | GeneralSecurityException e) {
throw new RuntimeException(e);
}
}

View File

@@ -924,9 +924,7 @@ public class IntroductionIntegrationTest
time);
}
}
} catch (DbException exception) {
eventWaiter.rethrow(exception);
} catch (FormatException exception) {
} catch (DbException | FormatException exception) {
eventWaiter.rethrow(exception);
} finally {
eventWaiter.resume();