From 9a42498247f49a09b56c381ddb009e02127c2234 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 21 Sep 2018 10:37:29 -0400 Subject: new sonar issues in policy/common Only throw one type of exception in Serializer. Try to increase test coverage in Serializer. Change-Id: I170de0ab727041aa42731c08d6cc454731d29a20 Issue-ID: POLICY-1130 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/common/utils/io/Serializer.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'utils-test/src/main') diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/io/Serializer.java b/utils-test/src/main/java/org/onap/policy/common/utils/io/Serializer.java index 227b810a..31e0b850 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/io/Serializer.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/io/Serializer.java @@ -83,9 +83,6 @@ public class Serializer { * so we'll just do it with a factory method. */ return clazz.cast(factory.readObject(ois)); - - } catch (ClassNotFoundException e) { - throw new IOException(e); } } @@ -127,8 +124,13 @@ public class Serializer { oos.writeObject(object); } - public Object readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { - return ois.readObject(); + public Object readObject(ObjectInputStream ois) throws IOException { + try { + return ois.readObject(); + + } catch (ClassNotFoundException e) { + throw new IOException(e); + } } } -- cgit 1.2.3-korg