<AWT Dev> hg: jdk8/awt/jdk: 6995769: occasion NPE thrown from SwingUtilities.computeIntersection()

Artem Ananiev artem.ananiev at oracle.com
Thu Jul 28 11:03:02 PDT 2011


On 7/28/2011 9:57 PM, Roman Kennke wrote:
> Hi there,
>> 2011/7/28<pavel.porvatov at oracle.com>:
>>> Changeset: 34fdcdb70d20
>>> Author:    rupashka
>>> Date:      2011-07-28 18:13 +0400
>>> URL:       http://hg.openjdk.java.net/jdk8/awt/jdk/rev/34fdcdb70d20
>>> 6995769: occasion NPE thrown from SwingUtilities.computeIntersection()
>>> Reviewed-by: alexp
>>> ! src/share/classes/javax/swing/RepaintManager.java
>> Hi Pavel,
>> I'm not very happy with this patch, what is the rationale behind it?
>> The bug report doesn't explain much, but from what I can see, I
>> believe this could be related to the fact that the RepaintManager is
>> not reentrant.
> I agree with Mario. As one who suffered from this bug I can confirm that
> it is (can be?) triggered when re-entering the RepaintManager. For
> example, when you override paint() of a Swing component and inside there
> bring up a modal dialog (I know I know), which launches a nested
> dispatch loop, you may end up calling into the RM again. At this point
> the internal datastructures goes crazy and throws the NPE. Catching null
> there seems dangerous as it hides the problem, and may cause breakage
> later. I propose to throw an IllegalStateException instead, for example
> in java.awt.Dialog or when launching the nested dispatch loop, in the
> case when we are coming from a RepaintManager call. This would increase
> overall robustness.
> If it helps, I can try to construct a testcase (should be something like
> I outlined above).
> Best regards, Roman

More information about the awt-dev mailing list