Close potential filedescriptor leak.
This commit is contained in:
parent
2f0d5c2e56
commit
bc9a0d54d0
1 changed files with 11 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package org.dynmap.web.handlers;
|
package org.dynmap.web.handlers;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -32,8 +33,15 @@ public class ClientConfigurationHandler implements HttpHandler {
|
||||||
response.fields.put("Content-Length", Integer.toString(cachedConfiguration.length));
|
response.fields.put("Content-Length", Integer.toString(cachedConfiguration.length));
|
||||||
response.status = HttpStatus.OK;
|
response.status = HttpStatus.OK;
|
||||||
|
|
||||||
BufferedOutputStream out = new BufferedOutputStream(response.getBody());
|
BufferedOutputStream out = null;
|
||||||
out.write(cachedConfiguration);
|
try {
|
||||||
out.flush();
|
out = new BufferedOutputStream(response.getBody());
|
||||||
|
out.write(cachedConfiguration);
|
||||||
|
out.flush();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue