Skip to content

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

@zt2mUTDm

Description

@zt2mUTDm

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);
         }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions