<AWT Dev> [9] Review request for 8132706 [macosx] Toolkit.getImage() throws NPE for null URL

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Fri Apr 15 15:52:31 UTC 2016


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 
> url.toString().toLowerCase()
>
> 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.

   Thanks,
   Alexandr.

> Regards
> Prasanta
> On 4/15/2016 8:32 PM, Alexander Scherbatiy wrote:
>>
>> Hello,
>>
>> 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.
>>
>>   Thanks,
>>   Alexandr.
>



More information about the awt-dev mailing list