<Swing Dev> RFR JDK-8240877: NPE at javax.swing.text.html.FormView.appendBuffer with null option values

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Apr 8 09:10:10 UTC 2020


On 4/8/20 1:56 am, Prasanta Sadhukhan wrote:
> Not sure what you are pointing to...But, we already had code in loadElementDataIntoBuffer() where if value is null, then appendBuffer() is not called. I just extrapolated it to 2 other cases.

So we do not need to use empty string here?

> 
> Regards
> Prasant
> On 08-Apr-20 2:23 PM, Sergey Bylokhov wrote:
>> HI, Prasanta.
>>
>> I am not sure what we should do in this code, but did you check
>> other possible solutions like using empty value instead of null?
>>
>> On 4/7/20 5:54 am, Prasanta Sadhukhan wrote:
>>> Hi All,
>>>
>>> Please review a fix for an issue where it is seen that javax.swing.text.html.FormView.appendBuffer will throw an NPE if "select" option value is null.
>>>
>>> This is because FormView#appendBuffer calls URLEncoder.encode(String s) where it does new StringBuilder(s.length()); without verifying if "s" is null or not,
>>>
>>> so proposed fix is to check for null string.
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8240877
>>>
>>> webrev: cr.openjdk.java.net/~psadhukhan/8240877/webrev.0/
>>>
>>> Regards
>>> Prasanta
>>
>>


-- 
Best regards, Sergey.


More information about the swing-dev mailing list