Fix file descriptor leak
This commit is contained in:
parent
818bb41091
commit
c6fa10de6e
|
@ -60,7 +60,7 @@ public class ScriptSourceInputFromUrl extends AbstractScriptSourceInput {
|
||||||
@Override
|
@Override
|
||||||
protected void releaseReader(Reader reader) {
|
protected void releaseReader(Reader reader) {
|
||||||
try {
|
try {
|
||||||
prepareReader().close();
|
reader.close();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log.warn( "Unable to close file reader for generation script source" );
|
log.warn( "Unable to close file reader for generation script source" );
|
||||||
|
|
|
@ -2,7 +2,9 @@ package org.hibernate.orm.test.tool.schema;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -56,7 +58,12 @@ public class DefaultImportFileExecutionTest {
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
serviceRegistry.close();
|
serviceRegistry.close();
|
||||||
if ( defaultImportFile.exists() ) {
|
if ( defaultImportFile.exists() ) {
|
||||||
defaultImportFile.delete();
|
try {
|
||||||
|
Files.delete( defaultImportFile.toPath() );
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue