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

 ##########
 File path: 
processing/src/main/java/org/apache/druid/segment/data/GenericIndexed.java
 ##########
 @@ -508,47 +508,49 @@ public void close()
 
     int count = 0;
 
-    HeapByteBufferWriteOutBytes headerOut = new HeapByteBufferWriteOutBytes();
-    HeapByteBufferWriteOutBytes valuesOut = new HeapByteBufferWriteOutBytes();
-    try {
-      T prevVal = null;
-      do {
-        count++;
-        T next = objects.next();
-        if (allowReverseLookup && prevVal != null && 
!(strategy.compare(prevVal, next) < 0)) {
-          allowReverseLookup = false;
+    try (HeapByteBufferWriteOutBytes valuesOut = new 
HeapByteBufferWriteOutBytes()) {
 
 Review comment:
   Also, I'm not sure this actually needs closed either, from `WriteOutBytes` 
javadoc:
   
   ```
    * WriteOutBytes is a resource that is managed by {@link 
SegmentWriteOutMedium}, so it's own {@link #close()} method
    * does nothing. However WriteOutBytes should appear closed, i. e. {@link 
#isOpen()} returns false, after the parental
    * SegmentWriteOutMedium is closed.
   ```
   Maybe we just ignore this one and leave it as is?

----------------------------------------------------------------
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