You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/07/15 17:03:15 UTC

[GitHub] [incubator-druid] Fokko commented on a change in pull request #7968: Enable Spotbugs: OS_OPEN_STREAM

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org