This issue occurs only under `MetalLookAndFeel` on Linux.
It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. > component.setBounds(ownerX, ownerY, 1, 1); This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. The fix is to do not proceed with `paint()` for negative sizes. The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. ------------- Commit messages: - reduce timeout - initial Changes: https://git.openjdk.java.net/jdk/pull/2761/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2761&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8262085 Stats: 160 lines in 2 files changed: 157 ins; 2 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/2761.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2761/head:pull/2761 PR: https://git.openjdk.java.net/jdk/pull/2761 |
On Sat, 27 Feb 2021 17:02:13 GMT, Alexander Zvegintsev <[hidden email]> wrote:
> This issue occurs only under `MetalLookAndFeel` on Linux. > > It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. > >> component.setBounds(ownerX, ownerY, 1, 1); > > This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. > > If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. > > The fix is to do not proceed with `paint()` for negative sizes. > The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. Any idea why Linux is affected only? test/jdk/javax/swing/JToolTip/FastTooltipSwitchIAE.java line 52: > 50: SwingUtilities.invokeLater(() -> { > 51: try { > 52: UIManager.setLookAndFeel(new MetalLookAndFeel()); Can the test checks all installed L&F just to check for similar bugs? ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
On Sat, 27 Feb 2021 21:56:47 GMT, Sergey Bylokhov <[hidden email]> wrote:
>> This issue occurs only under `MetalLookAndFeel` on Linux. >> >> It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. >> >>> component.setBounds(ownerX, ownerY, 1, 1); >> >> This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. >> >> If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. >> >> The fix is to do not proceed with `paint()` for negative sizes. >> The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. > > Any idea why Linux is affected only? BTW the test can be simplified to something like this UIManager.setLookAndFeel(new MetalLookAndFeel()); JToolTip tp = new JToolTip(); tp.setTipText("<html><h1>Hello world</h1></html>"); tp.setMinimumSize(new Dimension(1, 1)); tp.setMaximumSize(new Dimension(1, 1)); tp.setPreferredSize(new Dimension(1, 1)); tp.setBounds(100, 100, 1, 1); BufferedImage img = new BufferedImage(100, 100, TYPE_INT_ARGB); Graphics2D g2d = img.createGraphics(); tp.paint(g2d); g2d.dispose(); ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Alexander Zvegintsev-2
> This issue occurs only under `MetalLookAndFeel` on Linux.
> > It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. > >> component.setBounds(ownerX, ownerY, 1, 1); > > This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. > > If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. > > The fix is to do not proceed with `paint()` for negative sizes. > The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: simplified test ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2761/files - new: https://git.openjdk.java.net/jdk/pull/2761/files/4ee75411..034425b0 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2761&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2761&range=00-01 Stats: 113 lines in 1 file changed: 8 ins; 80 del; 25 mod Patch: https://git.openjdk.java.net/jdk/pull/2761.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2761/head:pull/2761 PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Sergey Bylokhov-2
On Sat, 27 Feb 2021 21:42:30 GMT, Sergey Bylokhov <[hidden email]> wrote:
>> Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: >> >> simplified test > > test/jdk/javax/swing/JToolTip/FastTooltipSwitchIAE.java line 52: > >> 50: SwingUtilities.invokeLater(() -> { >> 51: try { >> 52: UIManager.setLookAndFeel(new MetalLookAndFeel()); > > Can the test checks all installed L&F just to check for similar bugs? Sure. > Any idea why Linux is affected only? Actually it is not. It is just can be easily reproduced during normal use on Linux only. After test simplification it fails on every platform before the fix. ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Alexander Zvegintsev-2
On Sun, 28 Feb 2021 07:39:20 GMT, Alexander Zvegintsev <[hidden email]> wrote:
>> This issue occurs only under `MetalLookAndFeel` on Linux. >> >> It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. >> >>> component.setBounds(ownerX, ownerY, 1, 1); >> >> This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. >> >> If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. >> >> The fix is to do not proceed with `paint()` for negative sizes. >> The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. > > Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: > > simplified test Marked as reviewed by serb (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Alexander Zvegintsev-2
On Sun, 28 Feb 2021 07:39:20 GMT, Alexander Zvegintsev <[hidden email]> wrote:
>> This issue occurs only under `MetalLookAndFeel` on Linux. >> >> It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. >> >>> component.setBounds(ownerX, ownerY, 1, 1); >> >> This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. >> >> If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. >> >> The fix is to do not proceed with `paint()` for negative sizes. >> The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. > > Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: > > simplified test test/jdk/javax/swing/JToolTip/FastTooltipSwitchIAE.java line 61: > 59: } catch (ClassNotFoundException | InstantiationException | > 60: UnsupportedLookAndFeelException | IllegalAccessException e) { > 61: throw new RuntimeException(e); Normally for UnsupportedLookAndFeelException, we dont throw Exception, rather print and continue to next L&F. ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Alexander Zvegintsev-2
On Sun, 28 Feb 2021 07:39:20 GMT, Alexander Zvegintsev <[hidden email]> wrote:
>> This issue occurs only under `MetalLookAndFeel` on Linux. >> >> It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. >> >>> component.setBounds(ownerX, ownerY, 1, 1); >> >> This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. >> >> If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. >> >> The fix is to do not proceed with `paint()` for negative sizes. >> The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. > > Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: > > simplified test src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java line 124: > 122: if (paintTextR.width <= 0 || paintTextR.height <= 0) { > 123: return; > 124: } Any idea why only MetalToolTip is affected only? JDK-8040630 fix was generic so shouldn't we apply this fix in BasicToolTipUI#paint instead? ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Alexander Zvegintsev-2
> This issue occurs only under `MetalLookAndFeel` on Linux.
> > It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. > >> component.setBounds(ownerX, ownerY, 1, 1); > > This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. > > If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. > > The fix is to do not proceed with `paint()` for negative sizes. > The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: Do not fail on UnsupportedLookAndFeelException. ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2761/files - new: https://git.openjdk.java.net/jdk/pull/2761/files/034425b0..1651de87 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2761&range=02 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2761&range=01-02 Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/jdk/pull/2761.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2761/head:pull/2761 PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Prasanta Sadhukhan-2
On Mon, 1 Mar 2021 04:08:43 GMT, Prasanta Sadhukhan <[hidden email]> wrote:
>> Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: >> >> simplified test > > test/jdk/javax/swing/JToolTip/FastTooltipSwitchIAE.java line 61: > >> 59: } catch (ClassNotFoundException | InstantiationException | >> 60: UnsupportedLookAndFeelException | IllegalAccessException e) { >> 61: throw new RuntimeException(e); > > Normally for UnsupportedLookAndFeelException, we dont throw Exception, rather print and continue to next L&F. Done. > src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java line 124: > >> 122: if (paintTextR.width <= 0 || paintTextR.height <= 0) { >> 123: return; >> 124: } > > Any idea why only MetalToolTip is affected only? JDK-8040630 fix was generic so shouldn't we apply this fix in BasicToolTipUI#paint instead? Only Metal LaF uses `BasicHTML#getHTMLBaseline` for HTML tooltips painting. Changing of `BasicToolTipUI#paint` will have no effect since it is not on the call stack. ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Alexander Zvegintsev-2
On Mon, 1 Mar 2021 11:15:09 GMT, Alexander Zvegintsev <[hidden email]> wrote:
>> This issue occurs only under `MetalLookAndFeel` on Linux. >> >> It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. >> >>> component.setBounds(ownerX, ownerY, 1, 1); >> >> This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. >> >> If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. >> >> The fix is to do not proceed with `paint()` for negative sizes. >> The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. > > Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision: > > Do not fail on UnsupportedLookAndFeelException. Marked as reviewed by psadhukhan (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
In reply to this post by Alexander Zvegintsev-2
On Sat, 27 Feb 2021 17:02:13 GMT, Alexander Zvegintsev <[hidden email]> wrote:
> This issue occurs only under `MetalLookAndFeel` on Linux. > > It was introduced by [JDK-8040630](https://bugs.openjdk.java.net/browse/JDK-8040630) fix. > >> component.setBounds(ownerX, ownerY, 1, 1); > > This line adds an extra reshape call with `1x1` size right before getting another one with correct sizes. > > If `MetalToolTipUI#paint()` call happens before getting correct sizes, it calculates `paintTextR` with negative sizes for component with `1x1` size, thus IAE is thrown. > > The fix is to do not proceed with `paint()` for negative sizes. > The provided test fails for me in 0-30s interval(before the fix), other testing(client-tier1,2,3) looks good. This pull request has now been integrated. Changeset: c569f1d6 Author: Alexander Zvegintsev <[hidden email]> URL: https://git.openjdk.java.net/jdk/commit/c569f1d6 Stats: 89 lines in 2 files changed: 86 ins; 2 del; 1 mod 8262085: Hovering Metal HTML Tooltips in different windows cause IllegalArgExc on Linux Reviewed-by: serb, psadhukhan ------------- PR: https://git.openjdk.java.net/jdk/pull/2761 |
Free forum by Nabble | Edit this page |