[rfc][icedtea-web]: Hide unsupported security options in itw-settings
Andrew Su
asu at redhat.com
Tue Jan 4 08:07:35 PST 2011
On 01/04/2011 05:31 AM, Deepak Bhole wrote:
> * Andrew Su<asu at redhat.com> [2011-01-04 10:51]:
>> Hello,
>>
>> This is a simple patch for hiding the values. getProperty() in DeploymentConfigurations.java was changed such that null is returned instead of a NullPointerException being thrown in the case that the value is not set. This patch adds a check to see if the value is null and proceed to next item.
>>
>
> If getProperty returns null, s will be null and Boolean.parseBoolean(s)
> will throw an exception, so existing code will still work.
>
> Is this patch to do it the 'right way' or to fix some sort of error you
> are encountering?
Hi Deepak,
Boolean.parseBoolean(s) will return false for any string that isn't "true".
looking at the Boolean class it says: return ((name != null) &&
name.equalsIgnoreCase("true"));
Thus no exception will be thrown.
Regards,
Andrew
> Cheers,
> Deepak
>
>> Comments?
>>
>> --Andrew
>> diff -r c7922247b6d2 netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java
>> --- a/netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java Thu Dec 23 16:55:17 2010 -0500
>> +++ b/netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java Tue Jan 04 10:47:54 2011 -0500
>> @@ -114,16 +114,16 @@
>>
>> // Only display the ones with properties that are valid or existent.
>> for (int i = 0; i< properties.length; i++) {
>> - try {
>> - String s = config.getProperty(properties[i]);
>> - securityGeneralOptions[i].setSelected(Boolean.parseBoolean(s));
>> - securityGeneralOptions[i].setActionCommand(properties[i]);
>> - securityGeneralOptions[i].addActionListener(this);
>> - c.gridy = i + 1;
>> - topPanel.add(securityGeneralOptions[i], c);
>> - } catch (Exception e) {
>> + String s = config.getProperty(properties[i]);
>> + if (s == null) {
>> securityGeneralOptions[i] = null;
>> + continue;
>> }
>> + securityGeneralOptions[i].setSelected(Boolean.parseBoolean(s));
>> + securityGeneralOptions[i].setActionCommand(properties[i]);
>> + securityGeneralOptions[i].addActionListener(this);
>> + c.gridy = i + 1;
>> + topPanel.add(securityGeneralOptions[i], c);
>> }
>>
>> Component filler = Box.createRigidArea(new Dimension(1, 1));
More information about the distro-pkg-dev
mailing list