Skip to content

Commit

Permalink
Fix file descriptor leak
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Nov 23, 2022
1 parent 818bb41 commit c6fa10d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected Reader prepareReader() {
@Override
protected void releaseReader(Reader reader) {
try {
prepareReader().close();
reader.close();
}
catch (IOException e) {
log.warn( "Unable to close file reader for generation script source" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
Expand Down Expand Up @@ -56,7 +58,12 @@ public void setUp() throws Exception {
public void tearDown() {
serviceRegistry.close();
if ( defaultImportFile.exists() ) {
defaultImportFile.delete();
try {
Files.delete( defaultImportFile.toPath() );
}
catch (IOException e) {
throw new RuntimeException( e );
}
}
}

Expand Down

0 comments on commit c6fa10d

Please sign in to comment.