On Mon, 5 Aug 2024 17:56:41 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:
>> added null check > > @alisenchung > > Shouldn't both cases be handled here? > when parentComponent is null - JOptionPane.showMessageDialog(null, t), it > does not work in this case. > when parentComponent is NOT null - JOptionPane.showMessageDialog(f, t) I looked into the JOptionPane code so when parentComponent is null, for some cases [getRootFrame()](https://github.com/openjdk/jdk/blob/e2c07d5044587476fc0fff14260e2b73816d2062/src/java.desktop/share/classes/javax/swing/JOptionPane.java#L1692) is used, this returns a hidden frame (in case nothing is set as RootFrame) and thus the test case is not applicable here. Hence "when parentComponent is null" is not valid case here. The fix looks good. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20359#discussion_r1704537952