Skip to content

Commit

Permalink
Fix resource leak in OFDevTransformationService
Browse files Browse the repository at this point in the history
  • Loading branch information
Barteks2x committed Jun 25, 2023
1 parent 7714f0f commit ade86ab
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,10 @@ public class OFDevTransformationService implements ITransformationService {

// called from asm-generated code
@SuppressWarnings("unused") public static InputStream getResourceStream(String path) {
try {
try(FileSystem fs = FileSystems.newFileSystem(mcJar, OFDevTransformationService.class.getClassLoader())){
if (!path.startsWith("/")) {
path = '/' + path;
}
FileSystem fs = FileSystems.newFileSystem(mcJar, OFDevTransformationService.class.getClassLoader());
Path file = fs.getPath(path);
return Files.newInputStream(file);
} catch (IOException e) {
Expand Down

0 comments on commit ade86ab

Please sign in to comment.