mirror of
https://github.com/google/brotli.git
synced 2026-02-04 05:35:09 +00:00
[PR #1414] java: wrap decoder IllegalStateException as IOException in BrotliInputStream.read #2021
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/google/brotli/pull/1414
Author: @leofernandesmo
Created: 1/21/2026
Status: 🔄 Open
Base:
master← Head:fix-java-brotliinputstream-illegalstateexception📝 Commits (1)
2c21428java: 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.