mirror of https://github.com/apache/lucene.git
LUCENE-3251: Directory#copy leaks file handles
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1140498 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9e74a6a295
commit
aff519123c
|
@ -484,6 +484,11 @@ Bug fixes
|
|||
|
||||
======================= Lucene 3.x (not yet released) ================
|
||||
|
||||
Bug fixes
|
||||
|
||||
* LUCENE-3251: Directory#copy failed to close target output if opening the
|
||||
source stream failed. (Simon Willnauer)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-3201, LUCENE-3218: CompoundFileSystem code has been consolidated
|
||||
|
|
|
@ -224,10 +224,12 @@ public abstract class Directory implements Closeable {
|
|||
* overwrite it if it does.
|
||||
*/
|
||||
public void copy(Directory to, String src, String dest) throws IOException {
|
||||
IndexOutput os = to.createOutput(dest);
|
||||
IndexInput is = openInput(src);
|
||||
IndexOutput os = null;
|
||||
IndexInput is = null;
|
||||
IOException priorException = null;
|
||||
try {
|
||||
os = to.createOutput(dest);
|
||||
is = openInput(src);
|
||||
is.copyBytes(os, is.length());
|
||||
} catch (IOException ioe) {
|
||||
priorException = ioe;
|
||||
|
|
Loading…
Reference in New Issue