Codereview request for 8006295: Base64.Decoder.wrap(java.io.InputStream) returns InputStream which throws unspecified IOException on attempt to decode invalid Base64 byte stream (original) (raw)

Alan Bateman Alan.Bateman at oracle.com
Fri Feb 1 11:40:36 UTC 2013


On 01/02/2013 10:14, Patrick Wright wrote:

Would it be appropriate to have a "format" exception extending RuntimeException? That could then be documented in the API, but optional to catch explicitly. "Format exceptions", as a name, are already used for converting numbers and dates, for example. It could be "upgraded" to a checked exception in a later release, it people found it useful. A nice thing about a format exception is you could (possibly) include more detail about where the conversion failed, and why, via fields/getters on the exception. This is an InputStream and so will be used with libraries and code that will rightly expect it to behave as an InputStream. So I think it would be better to keep it as an IOException (whether a specialized IOException is needed is debatable). That would be consistent with how we handle malformed and unmappable input in other areas.

-Alan.



More information about the core-libs-dev mailing list