-
-
Notifications
You must be signed in to change notification settings - Fork 347
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: load(InputStream) of SerializationModelStreamer #2635
Conversation
We are trying a fix a static warning. Maybe it's a false positive that is not important. Is there a way to write a test case showing a real problem? |
where can I see it?
the problem - if any - is in concept that method has InputStream input parameter and that this method is responsible to close that InputStream. The safer approach is that creator of InputStream is closing it too. But I don't think that it is problem in this case. |
Completely agree, this is bad design.
Yes.
@zielint0 what warning is it? |
This PR was created to make sure that resource is closed. I tried to use modern 'try with resource' construct but I failed - it broke tests. So I proposed good, old 'finally'. I suspected that this piece of code is tricky, so asked for deep review to make sure that it is a good fix. I found this place in code by inspection: AutoCloseable used without 'try'-with resources. I just wanted to be sure that resource is always released. In this case it is not a sophisticated checker. It simply points resources without modern 'try'. As well I could find it by code review. The full description of checker is here below. Reports AutoCloseable instances which are not used in a try-with-resources statement, also known as Automatic Resource Management. This means that the open resource before/in try, close in finally style which was used before try-with-resources was available is also reported. This inspection is meant to replace all opened but not safely closed inspections when developing in Java 7 and higher. |
For now, we can proceed with this solution. |
alternative to #2627