<AWT Dev>  Review request for 8132706 [macosx] Toolkit.getImage() throws NPE for null URL
philip.race at oracle.com
Fri Apr 15 18:04:02 UTC 2016
This sounds terribly messy.
Is the getImage(File) doing the same ?
Really I would have expected an NPE in all cases that null was passed
ie both methods, regardless of SM ?
Else what are you getting back as an Image ?
Something that never actually completes /produces pixels,
equivalent to having an unresponsive URL as the source ?
On 04/15/2016 08:52 AM, Alexander Scherbatiy wrote:
> On 15/04/16 19:26, prasanta sadhukhan wrote:
>> Hi Alex,
>> Just one observation.
>> If url is null in getImageFromHash() then wouldn't we be getting NPE
>> from checkPermissions(url) as
>> it calls URLUtil.getConnectPermission(url); which calls
>> so it will not come to your check , right?
>> String key = (url == null) ? null : url.toString();
> The behavior of the Toolkit.getImage(URL) method before the fix
> JDK-8011059 was that it did not throw NPE for null URL if the security
> manager is not set and threw NPE if it is set.
> It was the behavior that some applications can rely on.
> I am not sure if it is now possible to change the
> Toolkit.getImage(URL) method behavior that it does not throw NPE with
> null URL when the SecurityManager is set.
>> On 4/15/2016 8:32 PM, Alexander Scherbatiy wrote:
>>> Could you review the fix:
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132706
>>> webrev: http://cr.openjdk.java.net/~alexsch/8132706/webrev.00
>>> The fix makes the Toolkit.getDefaultToolkit().getImage(URL) return
>>> a ToolkitImage based on URLImageSource with null url as it was
>>> before the fix JDK-8011059.
More information about the awt-dev