/hg/release/icedtea-web-1.6: Add -defaultfile switch to PolicyEd...
Jiri Vanek
jvanek at redhat.com
Fri Jul 31 06:05:30 UTC 2015
On 07/30/2015 07:26 PM, aazores at icedtea.classpath.org wrote:
> changeset 9e24c2ff6b46 in /hg/release/icedtea-web-1.6
> details: http://icedtea.classpath.org/hg/release/icedtea-web-1.6?cmd=changeset;node=9e24c2ff6b46
> author: Andrew Azores <aazores at redhat.com>
> date: Thu Jul 30 13:11:53 2015 -0400
>
> Add -defaultfile switch to PolicyEditor
hi Andrew!
The commit message strongly disagree with rest of changeset. May you fix it?
Or have I missed somethin?
J.
>
> 2015-07-30 Andrew Azores <aazores at redhat.com>
>
> PolicyEditor -file switch and main argument cannot be used in conjunction
> * NEWS: add note
> * netx/net/sourceforge/jnlp/resources/Messages.properties
> (PEMainArgAndFileSwitchSpecifiedError): new message
> * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
> (main): die when both main arg and -file are given
> (getFilePathArgument): new method
> (cleanFilePathArgument): new method
>
>
> diffstat:
>
> ChangeLog | 11 ++
> NEWS | 1 +
> netx/net/sourceforge/jnlp/resources/Messages.properties | 1 +
> netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java | 38 +++++++--
> 4 files changed, 42 insertions(+), 9 deletions(-)
>
> diffs (102 lines):
>
> diff -r 7fe258be550a -r 9e24c2ff6b46 ChangeLog
> --- a/ChangeLog Thu Jul 30 14:06:57 2015 +0200
> +++ b/ChangeLog Thu Jul 30 13:11:53 2015 -0400
> @@ -1,3 +1,14 @@
> +2015-07-30 Andrew Azores <aazores at redhat.com>
> +
> + PolicyEditor -file switch and main argument cannot be used in conjunction
> + * NEWS: add note
> + * netx/net/sourceforge/jnlp/resources/Messages.properties
> + (PEMainArgAndFileSwitchSpecifiedError): new message
> + * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
> + (main): die when both main arg and -file are given
> + (getFilePathArgument): new method
> + (cleanFilePathArgument): new method
> +
> 2015-07-27 Jiri Vanek <jvanek at redhat.com>
>
> Removed last remains of BOOT_DIR
> diff -r 7fe258be550a -r 9e24c2ff6b46 NEWS
> --- a/NEWS Thu Jul 30 14:06:57 2015 +0200
> +++ b/NEWS Thu Jul 30 13:11:53 2015 -0400
> @@ -22,6 +22,7 @@
> - fixed issue with -html receiving garbage in width and height
> * PolicyEditor
> - file flag made to work when used standalone
> + - file flag and main argument cannot be used in combination
>
> New in release 1.6 (2015-04-29):
> * Massively improved offline abilities. Added Xoffline switch to force work without inet connection.
> diff -r 7fe258be550a -r 9e24c2ff6b46 netx/net/sourceforge/jnlp/resources/Messages.properties
> --- a/netx/net/sourceforge/jnlp/resources/Messages.properties Thu Jul 30 14:06:57 2015 +0200
> +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Thu Jul 30 13:11:53 2015 -0400
> @@ -752,6 +752,7 @@
> PEClipboardError=Clipboard does not appear to contain properly formatted policy entries
> PEInvalidPolicy=Paste Failed: Could not read policy entry for codebase {0} from system clipboard
> PEClipboardAccessError=Could not read from clipboard
> +PEMainArgAndFileSwitchSpecifiedError=Either -file may be specified or a main argument may be specified, but not both
>
> PEHelpMenu=Help
> PEAboutPolicyEditorItem=About PolicyEditor
> diff -r 7fe258be550a -r 9e24c2ff6b46 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
> --- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Thu Jul 30 14:06:57 2015 +0200
> +++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Thu Jul 30 13:11:53 2015 -0400
> @@ -59,6 +59,8 @@
> import java.lang.ref.WeakReference;
> import java.lang.reflect.InvocationTargetException;
> import java.net.MalformedURLException;
> +import java.net.URISyntaxException;
> +import java.net.URI;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.Collection;
> @@ -1628,15 +1630,7 @@
> SwingUtilities.invokeLater(new Runnable() {
> @Override
> public void run() {
> - String filepath = optionParser.getParam(OptionsDefinitions.OPTIONS.FILE);
> - if (filepath.isEmpty()) {
> - if (optionParser.getMainArgs().size() == 0) {
> - filepath = null;
> - } else {
> - // maybe the user just forgot the -file flag, so try to open anyway
> - filepath = optionParser.getMainArg();
> - }
> - }
> + final String filepath = getFilePathArgument(optionParser);
> final PolicyEditorWindow frame = getPolicyEditorFrame(filepath);
> frame.asWindow().setVisible(true);
> final List<String> codebases = optionParser.getParams(OptionsDefinitions.OPTIONS.CODEBASE);
> @@ -1647,6 +1641,32 @@
> });
> }
>
> + private static String getFilePathArgument(OptionParser optionParser) {
> + final boolean hasFileArgument = optionParser.hasOption(OptionsDefinitions.OPTIONS.FILE);
> + final boolean hasMainArgument = optionParser.mainArgExists();
> + if (hasFileArgument && hasMainArgument) {
> + throw new IllegalArgumentException(R("PEMainArgAndFileSwitchSpecifiedError"));
> + }
> +
> + String filepath = null;
> + if (hasFileArgument) {
> + filepath = cleanFilePathArgument(optionParser.getParam(OptionsDefinitions.OPTIONS.FILE));
> + } else if (hasMainArgument) {
> + filepath = cleanFilePathArgument(optionParser.getMainArg());
> + }
> + return filepath;
> + }
> +
> + private static String cleanFilePathArgument(String filepath) {
> + if (filepath == null) {
> + return null;
> + } else if (filepath.isEmpty() || filepath.trim().isEmpty()) {
> + return null;
> + } else {
> + return filepath;
> + }
> + }
> +
> /**
> * Create a new PolicyEditor instance without passing argv. The returned instance is not
> * yet set visible.
>
More information about the distro-pkg-dev
mailing list