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

Refactor some code to use AutoCloseable / try-with-resources #663

Merged
merged 1 commit into from
Sep 10, 2021

Conversation

matthew16550
Copy link
Collaborator

No description provided.

@arnaudroques arnaudroques merged commit 5e20da9 into plantuml:master Sep 10, 2021
@matthew16550 matthew16550 deleted the auto-close branch September 11, 2021 03:53
@arnaudroques
Copy link
Contributor

I have to rollback changes made on AFileZipEntry.java.

Otherwise, the following example does not work any more and raises some java.io.IOException: Stream closed.

@startuml
!import demo.zip
alice->bob : before include
!include MyService1/myMethod1.iuml
alice->bob : after include
@enduml

With demo.zip containing some MyService1/myMethod1.iuml file.

I think it's because we should not close the InputStream at https://github.com/plantuml/plantuml/blob/master/src/net/sourceforge/plantuml/AFileZipEntry.java#L71

I hope (!) the InputStream is closed further in the code and that there is no leak here. This probably means that some refactoring is also needed here :-)

Anyway, thanks for your contribution!

@matthew16550
Copy link
Collaborator Author

Oops yes my bad 🤦

@arnaudroques
Copy link
Contributor

Oops yes my bad 🤦

Don't worry, this is not important.

This probably means that we have yet another a code smell here.

We can keep it this way right now, there is enough work in progress :-)

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

Successfully merging this pull request may close these issues.

None yet

2 participants