Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
Reviewed
Description
In KMSClientProvider# createConnection
try { is = conn.getInputStream(); ret = mapper.readValue(is, klass); } catch (IOException ex) { if (is != null) { is.close(); <== close may throw exception } throw ex; } finally { if (is != null) { is.close(); } } }
ex may be swallowed when close highlighted in the code throws exception. Thanks Harsh J for pointing this out.
BTW, I think we should be able to consolidate the two is.close() in the above code, so we don't close the same stream twice. The one in the finally block may be called after an exception is thrown or not, and it may throw exception too, we need to be careful not to swallow exception here too.