I have the following piece of code in a try/catch block
InputStream inputstream = conn.getInputStream();
InputStreamReader inputstreamreader = new InputSt
You only need to close the actual resource. You should close the resource even if constructing decorators fails. For output, you should flush the most decorator object in the happy case.
Some complications:
URLConnection, which doesn't have a disconnect/close method as such.You may wish to consider using the Execute Around idiom so you don't have to duplicate this sort of thing.