<AWT Dev> [8] Review request for 7117595: ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed

Sergey Bylokhov sergey.bylokhov at oracle.com
Tue Sep 24 02:35:23 PDT 2013

> I didn't know it was Artem's suggestion. And I still think that the 
> current fix is riskier than just returning null.

> However, I agree that an app is likely to die either way. So if everyone 
> else is OK with this fix, let it be. I think that 
> CGraphicsEnvironment.getDefaultScreenDevice() should be rewritten too in 
> that case, since it should never encounter an empty devices list 
> anymore, so the current logic in that method looks redundant.
This is a question to Andrew who adds this code. But code in the CGraphicsEnvironment.getDefaultScreenDevice() don't check number of screens, but verify that default screen is in our list(not sure is it possible that we can get race here, when default screen is changed).

On 09/24/2013 01:12 PM, Sergey Bylokhov wrote:
> No. If we return null here we just die sometimes later.
> if it return null then this occured.
> https://java.net/jira/browse/MACOSX_PORT-203
> Actually AWTError is a Artem's suggestion. I think headless exception is better.
> ====================================================================
> Hi Sergey,
> I think that throwing an AWTError is too risky for JDK 8. We might want
> to implement this early in JDK 9 though.
> For now, I think returning null is OK. E.g., see
> CGraphicsEnvironment.getDefaultScreenDevice(). It simply returns null if
> there's no screen devices found after a second re-initialization
> attempt. The rest of code (user apps and tests) seem to be happy with
> this implementation.
> --
> best regards,
> Anthony
> On 09/23/2013 09:59 PM, sergey malenkov wrote:
>> Could you please review the second version of the fix:
>> http://cr.openjdk.java.net/~malenkov/7117595.8.1/
>> I throw AWTError if there are no more screen devices.
>> On 23.09.2013 16:47, sergey malenkov wrote:
>>> Hello,
>>> Could you please review the following fix:
>>> fix:http://cr.openjdk.java.net/~malenkov/7117595.8.0/
>>> bug:https://bugs.openjdk.java.net/browse/JDK-7117595
>>> Thanks,
>>> SAM

More information about the awt-dev mailing list