Revision 8299
Added by Matt Jones over 10 years ago
ReplicationService.java | ||
---|---|---|
55 | 55 |
import javax.servlet.http.HttpServletRequest; |
56 | 56 |
import javax.servlet.http.HttpServletResponse; |
57 | 57 |
|
58 |
import org.apache.commons.io.IOUtils; |
|
58 | 59 |
import org.apache.http.HttpResponse; |
59 | 60 |
import org.apache.http.conn.scheme.Scheme; |
60 | 61 |
import org.apache.http.conn.ssl.SSLSocketFactory; |
... | ... | |
1311 | 1312 |
fos = new FileOutputStream(documentPath); |
1312 | 1313 |
di.toXml(fos, null, null, true); |
1313 | 1314 |
fos.close(); |
1314 |
fos = null; |
|
1315 | 1315 |
} |
1316 | 1316 |
|
1317 | 1317 |
// read the file from disk and send it to outputstream |
... | ... | |
1356 | 1356 |
// e.printStackTrace(System.out); |
1357 | 1357 |
errorMsg = me.getMessage(); |
1358 | 1358 |
} finally { |
1359 |
if (fos != null) { |
|
1360 |
try { |
|
1361 |
fos.close(); |
|
1362 |
} catch (IOException ioe) { |
|
1363 |
// Do nothing |
|
1364 |
} |
|
1365 |
} |
|
1359 |
IOUtils.closeQuietly(fos); |
|
1366 | 1360 |
} |
1367 | 1361 |
|
1368 | 1362 |
// report any errors if we got here |
Also available in: Unified diff
Refactor to use IOUtils.closeQuietly() which handles nulls and streams that are already closed.