Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileInputStream is not closed and the refFile cannot be deleted #1620

Closed
lijiajun05 opened this issue Oct 19, 2021 · 1 comment
Closed

FileInputStream is not closed and the refFile cannot be deleted #1620

lijiajun05 opened this issue Oct 19, 2021 · 1 comment
Assignees

Comments

@lijiajun05
Copy link

1、Springboot project. maven dependency:

io.swagger
swagger-parser
1.0.55

2、Issue location:
class: io.swagger.parser.util.RefUtils
method: readExternalRef()
line nums: 141, 152

3、Issue description:
Source code:result = IOUtils.toString(new FileInputStream(pathToUse.toFile()), "UTF-8");
The method IOUtils.toString() do not flush or close the stream. So new FileInputStream(pathToUse.toFile() is not closed and the file cannot be deleted.
In my project, the refFiles are temporary and need be deleted, then found this issue.
Thanks for replying to this issue.

4、Suggestion:
FileUtils.readFileToString() could be considered.

@frantuma
Copy link
Member

frantuma commented May 9, 2022

fixed in #1721

@frantuma frantuma closed this as completed May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants