Skip to content

Commit 693c56d

Browse files
committed
8290162: Reset recursion counter missed in fix of JDK-8224267
Backport-of: 6e18883d8ffd9a7b7d495da05e9859dc1d1a2677
1 parent 82140d5 commit 693c56d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java

+4
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ protected Container createMessageArea() {
374374
"OptionPane.messageAnchor", GridBagConstraints.CENTER);
375375
cons.insets = new Insets(0,0,3,0);
376376

377+
recursionCount = 0;
377378
addMessageComponents(body, cons, getMessage(),
378379
getMaxCharactersPerLineCount(), false);
379380
top.add(realBody, BorderLayout.CENTER);
@@ -478,8 +479,11 @@ public Dimension getPreferredSize() {
478479
}
479480
// Prevent recursion of more than
480481
// 200 successive newlines in a message
482+
// and indicate message is truncated via ellipsis
481483
if (recursionCount++ > 200) {
482484
recursionCount = 0;
485+
addMessageComponents(container, cons, new String("..."),
486+
maxll,false);
483487
return;
484488
}
485489
addMessageComponents(container, cons, s.substring(nl + nll), maxll,

test/jdk/javax/swing/JOptionPane/TestOptionPaneStackOverflow.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323

2424
/* @test
25-
@bug 8224267
25+
@bug 8224267 8290162
2626
@key headful
2727
@summary Verifies if StackOverflowError is not thrown for multiple newlines
2828
@run main TestOptionPaneStackOverflow

0 commit comments

Comments
 (0)