[PR #1414] java: wrap decoder IllegalStateException as IOException in BrotliInputStream.read #2021

Open
opened 2026-01-29 20:56:59 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/1414
Author: @leofernandesmo
Created: 1/21/2026
Status: 🔄 Open

Base: masterHead: fix-java-brotliinputstream-illegalstateexception


📝 Commits (1)

  • 2c21428 java: wrap decoder IllegalStateException as IOException

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 java/org/brotli/dec/BrotliInputStream.java (+1 -1)

📄 Description

  • Problem: Decode.decompress(state) may throw IllegalStateException via Utils.makeError (e.g. "Brotli error code: -22").
    BrotliInputStream.read(...) currently wraps only BrotliRuntimeException, so this decoder failure escapes as an
    unchecked exception.

  • Fix: Wrap IllegalStateException from the decoder as IOException, consistent with existing handling of BrotliRuntimeException.

  • Impact: Only affects invalid/corrupted streams (error path). No behavior change for valid inputs.

  • Repro (example):

BrotliInputStream.read(...) -> Decode.decompress(...) -> Utils.makeError(...) throws IllegalStateException("Brotli error code: -22")


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/1414 **Author:** [@leofernandesmo](https://github.com/leofernandesmo) **Created:** 1/21/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix-java-brotliinputstream-illegalstateexception` --- ### 📝 Commits (1) - [`2c21428`](https://github.com/google/brotli/commit/2c214287ff837b262ff4b2c59c78031f22dd6c4e) java: wrap decoder IllegalStateException as IOException ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `java/org/brotli/dec/BrotliInputStream.java` (+1 -1) </details> ### 📄 Description - **Problem**: Decode.decompress(state) may throw IllegalStateException via Utils.makeError (e.g. "Brotli error code: -22"). BrotliInputStream.read(...) currently wraps only BrotliRuntimeException, so this decoder failure escapes as an unchecked exception. - **Fix**: Wrap IllegalStateException from the decoder as IOException, consistent with existing handling of BrotliRuntimeException. - **Impact**: Only affects invalid/corrupted streams (error path). No behavior change for valid inputs. - **Repro (example)**: `BrotliInputStream.read(...) -> Decode.decompress(...) -> Utils.makeError(...) throws IllegalStateException("Brotli error code: -22")` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:56:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#2021