CLOUDSTACK-8692: Resource leak found by the internal coverity instance at Citrix fixed.

This commit is contained in:
Kshitij Kansal 2015-07-30 16:23:50 +05:30
parent b400608162
commit e0ba5302b6
1 changed files with 7 additions and 3 deletions

View File

@ -186,8 +186,12 @@ public class RegionsApiUtil {
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 @@ public class RegionsApiUtil {
}
}
}
}