Summary:public The code: DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); creates a resource with `FileInputStream()` and wraps it twice as a field of `BufferedInputStream` and then as a field of `DataInputStream`. Then calling: in.close(); needs to go down the wrappers hierachy: `DataInputStream.close()` -> `FilterInputStream.close()` which then calls `BufferedInputStream.close()` -> `FilterInputStream.close()` -> `FileInputStream.close()`. Going down the wrapper was not working before because `FilterInputStream.close()` was only going further when the type of field `in` was `FileInputStream` wheras it should also continue when the type of the field is any subtype of `FilterInputStream`, e.g. `DataInputStream` and `BufferedInputStream` like in the test example. This diff fixes this last aspect. Reviewed By: sblackshear Differential Revision: D3174822 fb-gh-sync-id: 3adbb7e fbshipit-source-id: 3adbb7emaster
parent
f8ecbd800a
commit
ad3e32d935
Loading…
Reference in new issue