Fokko commented on a change in pull request #7968: Enable Spotbugs: 
OS_OPEN_STREAM
URL: https://github.com/apache/incubator-druid/pull/7968#discussion_r303539111
 
 

 ##########
 File path: 
processing/src/main/java/org/apache/druid/guice/PropertiesModule.java
 ##########
 @@ -69,8 +69,8 @@ public void configure(Binder binder)
 
         if (stream != null) {
           log.info("Loading properties from %s", propertiesFile);
-          try {
-            fileProps.load(new InputStreamReader(stream, 
StandardCharsets.UTF_8));
+          try (InputStreamReader isr = new InputStreamReader(stream, 
StandardCharsets.UTF_8)) {
+            fileProps.load(isr);
 
 Review comment:
   This file has been changed on `master`. On master this cannot be rewritten 
since the stream is being consumed after it has been closed, which will throw 
an exception. Also, these constructions don't help: 
https://github.com/apache/incubator-druid/blob/master/processing/src/main/java/org/apache/druid/guice/PropertiesModule.java#L81
 
   Curious in which case `.exists()` lies 🤔 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to