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

StyleLoader#loadStyle(URL) doesn't close the stream. #121

Open
zt2mUTDm opened this issue Jan 25, 2024 · 0 comments
Open

StyleLoader#loadStyle(URL) doesn't close the stream. #121

zt2mUTDm opened this issue Jan 25, 2024 · 0 comments

Comments

@zt2mUTDm
Copy link

The method loadStyle(URL) in com.simsilica.lemur.style.StyleLoader doesn't close the InputStream.

I would change it in this way:

@@ -158,8 +158,8 @@                                                                                                                                                                                                                                                                                                               
     }                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                  
     public void loadStyle( URL u ) {
-        try {
-            loadStyle(u.toString(), new InputStreamReader(u.openStream()));
+        try( Reader in = new InputStreamReader(u.openStream()) ) {
+            loadStyle(u.toString(), in);
         } catch( IOException e ) {
             throw new RuntimeException("Error opening stream for:" + u, e);
         }
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

1 participant