[rfc][icedtea-web] PolicyEditor NPE-on-save fix

Andrew Azores aazores at redhat.com
Tue May 27 13:22:38 UTC 2014


On 05/21/2014 09:51 AM, Andrew Azores wrote:
> Hi,
>
> Currently, PolicyEditor has an NPE bug which can be reproduced as 
> follows:
>
> 1) Open PolicyEditor with no arguments
> 2) Select and deselect a checkbox
> 3) Click "Close"
> 4) "Yes" to save changes before exiting
> 5) NPE occurs
>
> I think this is a regression from the 
> PolicyEditorFrame/PolicyEditorDialog refactor, but I'm not sure of 
> that as it doesn't seem worth the time to go back and check anyway. 
> The problem is just that the quit() methods provided by these two 
> classes do not verify that there is a File to save to before 
> attempting to save to that file, so unless PolicyEditor is opened with 
> a file path argument or the user specifically uses the Open or 
> Save/Save As options, no file will ever be selected to save to, hence 
> the NPE in the savePolicyFile method. The attached patch simply 
> performs a check in the quit() methods and adds a file chooser dialog 
> if the file has not yet been selected and the user chooses to save 
> their changes.
>
> After applying the patch, the NPE in (5) should no longer occur, and a 
> file chooser should appear instead, allowing the file to be saved to 
> the desired location.
>
> ChangeLog:
>
> * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java 
> (quit): select file to save to using fileChooser if file is null
>
> Thanks,
>

Ping.

Thanks,

-- 
Andrew A



More information about the distro-pkg-dev mailing list