RFR: 8356439: Rename JavaLangAccess::*NoRepl methods [v3]
Volkan Yazici
vyazici at openjdk.org
Tue Aug 12 12:11:17 UTC 2025
On Tue, 29 Jul 2025 14:22:56 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/String.java line 1262:
>>
>>> 1260: MalformedInputException mie = new MalformedInputException(nb);
>>> 1261: String msg = "malformed input off : " + off + ", length : " + nb;
>>> 1262: mie.initCause(new IllegalArgumentException(msg));
>>
>> Earlier `throw(Malformed|Unmappable)` methods were throwing `IAE` containing _extra diagnostics information_ and wrapping a `CCE` as a cause. After switching methods to throw `CCE`, which doesn't have a ctor accepting a `String` message, to retain this extra diagnostics information, I've added swapped their causal chain placement, and wrapped `IAE` with a `CCE` this time.
>>
>> This played well with `CCE`-throwing methods, yet there are other `public` methods which did not have `throws CCE` in their footprint. For backward compatibility, in those spots, I've used `cce2iae` to obtain, again, a `IAE` wrapping the `CCE`, which matched the old behavior.
>
> Introducing CCE (an IOException) into more places in string handling is going in the wrong direction.
> As declared exceptions, they have to be caught and handled or re-thrown. That makes the source more complex and harder to maintain, as seen in the cce2iae mechanism.
> The prior use of IAE encapsulating a CCE as needed is simpler and more consistent with other Runtime exception handling in most of the String class.
Since the need for `cce2iae` is disapperaed, I'm resolving this conversation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2269607697
More information about the security-dev
mailing list