diff --git a/server/src/org/apache/cloudstack/region/RegionsApiUtil.java b/server/src/org/apache/cloudstack/region/RegionsApiUtil.java index 92c5ed4e17ef..7fbcfa0795ed 100644 --- a/server/src/org/apache/cloudstack/region/RegionsApiUtil.java +++ b/server/src/org/apache/cloudstack/region/RegionsApiUtil.java @@ -186,8 +186,12 @@ protected static UserAccount makeUserAccountAPICall(Region region, String comman XStream xstream = new XStream(new DomDriver()); xstream.alias("useraccount", UserAccountVO.class); xstream.aliasField("id", UserAccountVO.class, "uuid"); - ObjectInputStream in = xstream.createObjectInputStream(is); - return (UserAccountVO)in.readObject(); + try(ObjectInputStream in = xstream.createObjectInputStream(is);) { + return (UserAccountVO)in.readObject(); + } catch (IOException e) { + s_logger.error(e.getMessage()); + return null; + } } else { return null; } @@ -304,4 +308,4 @@ private static String signRequest(String request, String key) { } } -} \ No newline at end of file +}