Close potential filedescriptor leak.

This commit is contained in:
alron 2011-03-12 01:35:07 -08:00
parent 0007acd05b
commit 77cc1a70c4

View File

@ -87,8 +87,15 @@ public class ClientUpdateHandler implements HttpHandler {
response.fields.put(HttpField.ContentLength, Integer.toString(bytes.length)); response.fields.put(HttpField.ContentLength, Integer.toString(bytes.length));
response.status = HttpStatus.OK; response.status = HttpStatus.OK;
BufferedOutputStream out = new BufferedOutputStream(response.getBody()); BufferedOutputStream out = null;
out.write(bytes); try {
out.flush(); out = new BufferedOutputStream(response.getBody());
out.write(bytes);
out.flush();
}
finally
{
out.close();
}
} }
} }