Description
OBL: Method may fail to clean up java.io.InputStream
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.
In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.
沒有關閉串流或有可能在關閉之前發生問題。
Solution
- 使用try, catch與finally,並在finally中去close stream。
- try-with-resources。
Example
無。
留言
張貼留言