clintropolis commented on a change in pull request #7968: Enable Spotbugs:
OS_OPEN_STREAM
URL: https://github.com/apache/incubator-druid/pull/7968#discussion_r303150109
##########
File path:
processing/src/main/java/org/apache/druid/segment/data/GenericIndexedWriter.java
##########
@@ -454,11 +453,13 @@ private void writeHeaderLong(FileSmoosher smoosher, int
bagSizePower)
private void initializeHeaderOutLong() throws IOException
{
headerOutLong = new LongArrayList();
- DataInput headerOutAsIntInput = new
DataInputStream(headerOut.asInputStream());
- for (int i = 0; i < numWritten; i++) {
- int count = headerOutAsIntInput.readInt();
- headerOutLong.add(count);
+ try (InputStream is = headerOut.asInputStream()) {
Review comment:
same thing about collapsing try,
```
try (
InputStream is = headerOut.asInputStream();
DataInputStream headerOutAsIntInput = new DataInputStream(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]