RFR: 8290162: Reset recursion counter missed in fix of JDK-8224267
Andrey Turbanov
aturbanov at openjdk.org
Tue Jul 19 13:27:52 UTC 2022
On Tue, 12 Jul 2022 09:44:52 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> `recursionCount` counter added in fix of JDK-8224267 is only reset when limit is reached, so it will behave incorrectly if JOptionPane.showMessageDialog continuously with the same message having newlines, so it needs to be reset also at appropriate location.
> Fix to reset the counter before the recursive method is called.
>
> Also, fix added to indicate the original message is truncated by adding ... (ellipsis) to the previous line of text if it recurses more than limit set.
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java line 485:
> 483: if (recursionCount++ > 200) {
> 484: recursionCount = 0;
> 485: addMessageComponents(container, cons, new String("..."),
Hm. What was the reason to use `new String` constructor here? Is it some security issue?
Seems redundant to me.
-------------
PR: https://git.openjdk.org/jdk/pull/9464
More information about the client-libs-dev
mailing list