clintropolis commented on a change in pull request #7968: Enable Spotbugs:
OS_OPEN_STREAM
URL: https://github.com/apache/incubator-druid/pull/7968#discussion_r303149278
##########
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:
could you collapse this into a single try?
```
try (
HeapByteBufferWriteOutBytes valuesOut = new
HeapByteBufferWriteOutBytes()
HeapByteBufferWriteOutBytes headerOut = new
HeapByteBufferWriteOutBytes();
) {
...
```
----------------------------------------------------------------
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]