summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantinos Kanonakis <konstantinos.kanonakis@huawei.com>2017-10-06 09:49:22 -0500
committerKonstantinos Kanonakis <konstantinos.kanonakis@huawei.com>2017-10-06 10:07:14 -0500
commitde53901eb8599679d96933abdbdb5f3d05b44112 (patch)
tree2683adb9bba759bb7d81bed53e25617b2e6c6a80
parentdd02b0266eb444f3839b7f1fca8cd5722db98ff7 (diff)
Using multi-catch statements in EventPublisher
Issue-Id: DCAEGEN2-129 Change-Id: I501334e555e8c83a48525a5f1a059634c266f837 Signed-off-by: Konstantinos Kanonakis <konstantinos.kanonakis@huawei.com>
-rw-r--r--src/main/java/org/onap/dcae/commonFunction/EventPublisher.java18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/main/java/org/onap/dcae/commonFunction/EventPublisher.java b/src/main/java/org/onap/dcae/commonFunction/EventPublisher.java
index f870ffac..0d9cf91e 100644
--- a/src/main/java/org/onap/dcae/commonFunction/EventPublisher.java
+++ b/src/main/java/org/onap/dcae/commonFunction/EventPublisher.java
@@ -153,16 +153,8 @@ public class EventPublisher {
CommonStartup.oplog.info(String.format("URL:%sTOPIC:%sEvent Published:%s",
ueburl, topic, event));
- } catch (IOException e) {
- log.error("IOException:Unable to publish event:" + event + " streamid:" + streamid
- + " Exception:" + e);
- } catch (GeneralSecurityException e) {
- // TODO Auto-generated catch block
- log.error("GeneralSecurityException:Unable to publish event:" + event + " streamid:"
- + streamid + " Exception:" + e);
- } catch (IllegalArgumentException e) {
- log.error("IllegalArgumentException:Unable to publish event:" + event + " streamid:"
- + streamid + " Exception:" + e);
+ } catch (IOException | GeneralSecurityException | IllegalArgumentException e) {
+ log.error("Unable to publish event: {} streamid: {}. Exception: {}", event, streamid, e);
}
}
@@ -177,10 +169,8 @@ public class EventPublisher {
log.error(stuck.size() + " messages unsent");
}
}
- } catch (InterruptedException ie) {
- log.error("Caught an Interrupted Exception on Close event");
- } catch (IOException ioe) {
- log.error("Caught IO Exception: " + ioe);
+ } catch (InterruptedException | IOException e) {
+ log.error("Caught Exception on Close event: {}", e);
}
}