[rfc][icedtea-web][policyeditor] File Changed check

Jiri Vanek jvanek at redhat.com
Wed Mar 12 15:34:38 UTC 2014


On 03/12/2014 02:38 PM, Andrew Azores wrote:
> On 03/12/2014 06:04 AM, Jiri Vanek wrote:
>> On 03/10/2014 08:57 PM, Andrew Azores wrote:
>>> Hi,
>>>
>>> As promised, here's a patch that lets PolicyEditor detect when the policy file has been externally
>>> modified since it was opened, using MD5SumWatcher.
>>>
>>> ChangeLog:
>>> Added check for external file modification to PolicyEditor
>>> * netx/net/sourceforge/jnlp/resources/Messages.properties: (PEFileModified,
>>> PEFileModifiedDetail) new messages
>>> * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java:
>>> (updateCheckboxes) avoid NPE. (openAndParsePolicyFile, savePolicyFile) use
>>> MD5SumWatcher to detect when the policy file has been externally modified.
>>> (updateMd5WithDialog) new method
>>> * tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorTest.java:
>>> all URLs changed to example.com
>>>
>>> Thanks,
>>>
>>
>>     final int response = updateMd5WithDialog();
>> +                    switch (response) {
>> +                        case JOptionPane.YES_OPTION:
>> +                            openAndParsePolicyFile();
>> +                            return;
>> +                        case JOptionPane.NO_OPTION:
>> +                            break;
>> +                        case JOptionPane.CANCEL_OPTION:
>> +                            return;
>> +                        default:
>> +                            break;
>> +                    }
>>
>> What happens with gui in case of yes?
>>
>> eg - I have something selected, click save, md5 warning jump out, I click reload, underlyiing
>> policy file reload, and my gui? Will the selected boxes/ceodebases whatever remain as I have
>> selected, or as it in new file?  Not sure what is better here - but probably to rest gui to match
>> new file.
>> Does it openAndParsePolicyFile ?
>>
>> If so ok to head..
>>
>> Otherwise probbaly ok to head after answer.
>>
>> J.
>
> Yep, if you click "Yes to Reload", then the GUI (and internal representations) update to match what
> was read in the file. openAndParsePolicyFile() also updates the GUI as it goes along with parsing.
> "No" writes your current changes into the file without re-parsing the new file contents first, and
> "Cancel" just does nothing, so you can decide if you want to throw away your changes, or maybe save
> somewhere else, or whatever.
>
> Thanks,
>
Keep it simple. ook to go.


More information about the distro-pkg-dev mailing list