{"record":{"id":"20d5a314313b7ed5","repo":"prestodb/presto","slug":"java-io-ioexception-wrapped-in-uncheckedioexcepti-20d5a3","errorCode":null,"errorMessage":"java.io.IOException (wrapped in UncheckedIOException)","messagePattern":"java\\.io\\.IOException \\(wrapped in UncheckedIOException\\)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatBatchStreamReader.java","lineNumber":379,"sourceCode":"\n    @Override\n    public String toString()\n    {\n        return toStringHelper(this)\n                .addValue(streamDescriptor)\n                .toString();\n    }\n\n    @Override\n    public void close()\n    {\n        try (Closer closer = Closer.create()) {\n            for (BatchStreamReader valueStreamReader : valueStreamReaders) {\n                closer.register(valueStreamReader::close);\n            }\n        }\n        catch (IOException e) {\n            throw new UncheckedIOException(e);\n        }\n    }\n\n    @Override\n    public long getRetainedSizeInBytes()\n    {\n        long retainedSize = INSTANCE_SIZE;\n\n        for (BatchStreamReader valueStreamReader : valueStreamReaders) {\n            retainedSize += valueStreamReader.getRetainedSizeInBytes();\n        }\n\n        return retainedSize;\n    }\n}\n","sourceCodeStart":361,"sourceCodeEnd":395,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatBatchStreamReader.java#L361-L395","documentation":"MapFlatBatchStreamReader.close() closes all value stream readers inside a try-with-resources Closer. Any underlying IOException is wrapped in UncheckedIOException so the AutoCloseable contract can be honored without checked exceptions. It signals an I/O failure while releasing ORC stream resources.","triggerScenarios":"Calling close() on MapFlatBatchStreamReader (directly or via OrcBatchStreamReader/reader teardown) when an underlying stream read/close fails, e.g. a closed or broken IO source.","commonSituations":"Closing readers after HDFS/S3 read failures; closing an already-failed read pipeline; double-close on a broken datasource.","solutions":["Inspect the cause via getCause() (the original IOException)","Ensure the OrcDataSource is healthy and not already closed before reading","Wrap reader teardown in try/finally and log rather than crash on close failures","Check network/storage connectivity to the underlying file source"],"exampleFix":"// before\nreader.close();\n// after\ntry { reader.close(); } catch (UncheckedIOException e) { log.warn(e.getCause(), \"ORC reader close failed\"); }","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try (OrcBatchStreamReader reader = loader.createBatchReader(...)) { ... } catch (UncheckedIOException e) { log.warn(e.getCause(), \"Failed to close ORC reader\"); }","preventionTips":["Always close readers in try-with-resources so failures are attributable","Check datasource health (HDFS/S3 connectivity) before large reads","Log and tolerate close-time IOExceptions separately from read-time errors","Avoid reusing readers after underlying IO failures"],"tags":["io","orc","uncheckedioexception","resource-cleanup"],"backgroundTag":"unchecked-io-exception","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}