/hg/icedtea-web: SecurityDialog return type changed from Object ...
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Tue Jun 9 11:02:24 UTC 2015
changeset 9b3cfdc71c60 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=9b3cfdc71c60
author: Jiri Vanek <jvanek at redhat.com>
date: Tue Jun 09 13:02:00 2015 +0200
SecurityDialog return type changed from Object (mostly int) to regular type
diffstat:
ChangeLog | 80 +++
netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java | 18 +-
netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java | 9 +-
netx/net/sourceforge/jnlp/security/JNLPAuthenticator.java | 5 +-
netx/net/sourceforge/jnlp/security/PluginAppVerifier.java | 9 +-
netx/net/sourceforge/jnlp/security/SecurityDialog.java | 14 +-
netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java | 5 +-
netx/net/sourceforge/jnlp/security/SecurityDialogs.java | 178 +------
netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java | 4 +-
netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageExtendedImpl.java | 2 +
netx/net/sourceforge/jnlp/security/dialogresults/AccessWarningPaneComplexReturn.java | 232 ++++++++++
netx/net/sourceforge/jnlp/security/dialogresults/BasicDialogValue.java | 129 +++++
netx/net/sourceforge/jnlp/security/dialogresults/DialogResult.java | 62 ++
netx/net/sourceforge/jnlp/security/dialogresults/NamePassword.java | 80 +++
netx/net/sourceforge/jnlp/security/dialogresults/SetValueHandler.java | 78 +++
netx/net/sourceforge/jnlp/security/dialogresults/Yes.java | 67 ++
netx/net/sourceforge/jnlp/security/dialogresults/YesCancel.java | 70 +++
netx/net/sourceforge/jnlp/security/dialogresults/YesNo.java | 64 ++
netx/net/sourceforge/jnlp/security/dialogresults/YesNoCancel.java | 68 ++
netx/net/sourceforge/jnlp/security/dialogresults/YesNoSandbox.java | 68 ++
netx/net/sourceforge/jnlp/security/dialogs/AccessWarningPane.java | 11 +-
netx/net/sourceforge/jnlp/security/dialogs/AccessWarningPaneComplexReturn.java | 141 ------
netx/net/sourceforge/jnlp/security/dialogs/AppletWarningPane.java | 8 +-
netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java | 8 +-
netx/net/sourceforge/jnlp/security/dialogs/CertsInfoPane.java | 4 +-
netx/net/sourceforge/jnlp/security/dialogs/MissingALACAttributePanel.java | 12 +-
netx/net/sourceforge/jnlp/security/dialogs/MissingPermissionsAttributePanel.java | 7 +-
netx/net/sourceforge/jnlp/security/dialogs/MoreInfoPane.java | 6 +-
netx/net/sourceforge/jnlp/security/dialogs/PasswordAuthenticationPane.java | 5 +-
netx/net/sourceforge/jnlp/security/dialogs/SecurityDialogPanel.java | 33 -
netx/net/sourceforge/jnlp/security/dialogs/remember/RememberPanel.java | 36 +-
netx/net/sourceforge/jnlp/services/ServiceUtil.java | 4 +-
netx/net/sourceforge/jnlp/util/XDesktopEntry.java | 2 +-
tests/netx/unit/net/sourceforge/jnlp/security/SecurityDialogsTest.java | 103 ----
tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/AccessWarningPaneComplexReturnTest.java | 118 +++++
tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesCancelTest.java | 77 +++
tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesNoCancelTest.java | 96 ++++
tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesNoSandboxTest.java | 97 ++++
tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesNoTestTest.java | 88 +++
tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesTest.java | 79 +++
40 files changed, 1686 insertions(+), 491 deletions(-)
diffs (truncated from 2832 to 500 lines):
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 ChangeLog
--- a/ChangeLog Mon Jun 01 14:43:43 2015 +0200
+++ b/ChangeLog Tue Jun 09 13:02:00 2015 +0200
@@ -1,3 +1,83 @@
+2015-06-01 Jiri Vanek <jvanek at redhat.com>
+
+ SecurityDialog return type changed from Object (mostly int) to regular type
+ * netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java: removed handling
+ of integer results/inputs
+ * netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java: AppletAction usage
+ replaced by YesNoSandbox
+ * netx/net/sourceforge/jnlp/security/PluginAppVerifier.java: same
+ * netx/net/sourceforge/jnlp/security/JNLPAuthenticator.java: usages of Object[]
+ replaced by regular type
+ * netx/net/sourceforge/jnlp/security/SecurityDialog.java: value changed from
+ Object to DialogResult
+ * netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java: same for
+ userResponse, class made public
+ * netx/net/sourceforge/jnlp/security/SecurityDialogs.java: removed redundant
+ AppletAction and all to/from int/boolean conversion methods. All Object returns
+ repalced by proper class/interface. Removed redundant showAppletWarning
+ * netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java: adapted
+ to removed AppletAction and new BasicDialogValue
+ * netx/net/sourceforge/jnlp/security/appletextendedsecurity/impl/UnsignedAppletActionStorageExtendedImpl.java:
+ added override annotations.
+ * netx/net/sourceforge/jnlp/security/dialogresults/AccessWarningPaneComplexReturn.java:
+ class extracted from netx/net/sourceforge/jnlp/security/dialogs/AccessWarningPaneComplexReturn.java
+ Made to implement DialogResult
+ * netx/net/sourceforge/jnlp/security/dialogresults/BasicDialogValue.java:
+ New class, which keeps together main utility methods and base classes of
+ dialog return.
+ * netx/net/sourceforge/jnlp/security/dialogresults/DialogResult.java:
+ new class, main interface of SecurityDialog return.
+ * netx/net/sourceforge/jnlp/security/dialogresults/NamePassword.java:
+ Implementation of SecurityDialog for dialog asking for username and password.
+ * netx/net/sourceforge/jnlp/security/dialogresults/SetValueHandler.java:
+ extracted from SecurityDialogPanel. Have DialogResult instead of Object.
+ It is base implementation of any click to button.
+ * netx/net/sourceforge/jnlp/security/dialogresults/Yes.java:
+ Wrapper for return from dialog, which can return only and only yes.
+ * netx/net/sourceforge/jnlp/security/dialogresults/YesCancel.java:
+ Wrapper for return from dialog, which can return only and only yes or cancel
+ * netx/net/sourceforge/jnlp/security/dialogresults/YesNo.java:
+ Wrapper for return from dialog, which can return only and only yes or no
+ * netx/net/sourceforge/jnlp/security/dialogresults/YesNoCancel.java:
+ Wrapper for return from dialog, which can return only and only yes, no or cancel
+ * netx/net/sourceforge/jnlp/security/dialogresults/YesNoSandbox.java:
+ Wrapper for return from dialog, which can return only and only yes, no or sandbox
+ * netx/net/sourceforge/jnlp/security/dialogs/AccessWarningPane.java: get rid of
+ int buttons, replaced by YesNo.
+ * netx/net/sourceforge/jnlp/security/dialogs/AppletWarningPane.java: get rid of
+ int buttons, replaced by YesNoCancel.
+ * netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java: get rid of
+ int buttons, replaced by YesNoSadnbox
+ * netx/net/sourceforge/jnlp/security/dialogs/CertsInfoPane.java: get rid of
+ int buttons, replaced by Yes.
+ * netx/net/sourceforge/jnlp/security/dialogs/MoreInfoPane.java: same
+ * netx/net/sourceforge/jnlp/security/dialogs/MissingALACAttributePanel.java:
+ get rid of int buttons, replaced by YesNo.
+ * netx/net/sourceforge/jnlp/security/dialogs/MissingPermissionsAttributePanel.java:
+ same
+ * netx/net/sourceforge/jnlp/security/dialogs/PasswordAuthenticationPane.java:
+ get rid of Object[] return, replaced by NamePassword.
+ * netx/net/sourceforge/jnlp/security/dialogs/SecurityDialogPanel.java: get rid
+ of inner SetValueHandler
+ * netx/net/sourceforge/jnlp/security/dialogs/remember/RememberPanel.java: included
+ wrappers, which allows compilation and pass tests. Must be fixed in next changesets.
+ * netx/net/sourceforge/jnlp/services/ServiceUtil.java: adapted to DialogResult
+ * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: changed import
+ * tests/netx/unit/net/sourceforge/jnlp/security/SecurityDialogsTest.java:
+ removed. Tests were checking int conversions from legacy model.
+ * tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/AccessWarningPaneComplexReturnTest.java:
+ new tests for new class
+ * tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesCancelTest.java:
+ same
+ * tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesNoCancelTest.java:
+ same
+ * tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesNoSandboxTest.java:
+ same
+ * tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesNoTestTest.java:
+ same
+ * tests/netx/unit/net/sourceforge/jnlp/security/dialogresults/YesTest.java:
+ same
+
2015-06-01 Jiri Vanek <jvanek at redhat.com>
Remember panel extracted so it can be reused
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java
--- a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Mon Jun 01 14:43:43 2015 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Tue Jun 09 13:02:00 2015 +0200
@@ -38,7 +38,7 @@
import net.sourceforge.jnlp.event.ApplicationListener;
import net.sourceforge.jnlp.security.SecurityDialogs;
import net.sourceforge.jnlp.security.SecurityDialogs.AccessType;
-import net.sourceforge.jnlp.security.dialogs.AccessWarningPaneComplexReturn;
+import net.sourceforge.jnlp.security.dialogresults.AccessWarningPaneComplexReturn;
import net.sourceforge.jnlp.util.logging.OutputController;
import net.sourceforge.jnlp.util.WeakList;
import net.sourceforge.jnlp.util.XDesktopEntry;
@@ -185,7 +185,7 @@
return;
}
AccessWarningPaneComplexReturn ics = getComplexReturn(sd);
- if (ics.getRegularReturnAsBoolean()) {
+ if (ics.toBoolean()) {
entry.createDesktopShortcuts(ics.getMenu(), ics.getDekstop(), isSigned());
}
@@ -201,7 +201,7 @@
private AccessWarningPaneComplexReturn getComplexReturn(ShortcutDesc sd) {
if (JNLPRuntime.isTrustAll()) {
boolean mainResult = (sd != null && (sd.onDesktop() || sd.getMenu() != null));
- AccessWarningPaneComplexReturn r = new AccessWarningPaneComplexReturn(mainResult?0:1);
+ AccessWarningPaneComplexReturn r = new AccessWarningPaneComplexReturn(mainResult);
if (mainResult){
if (sd.onDesktop()){
r.setDekstop(new AccessWarningPaneComplexReturn.ShortcutResult(true));
@@ -225,22 +225,22 @@
*/
switch (currentSetting) {
case ShortcutDesc.CREATE_NEVER:
- return new AccessWarningPaneComplexReturn(1);
+ return new AccessWarningPaneComplexReturn(false);
case ShortcutDesc.CREATE_ALWAYS:
- return new AccessWarningPaneComplexReturn(0);
+ return new AccessWarningPaneComplexReturn(true);
case ShortcutDesc.CREATE_ASK_USER:
- return SecurityDialogs.showAccessWarningDialogComplexReturn(AccessType.CREATE_DESTKOP_SHORTCUT, file);
+ return SecurityDialogs.showAccessWarningDialog(AccessType.CREATE_DESTKOP_SHORTCUT, file, null);
case ShortcutDesc.CREATE_ASK_USER_IF_HINTED:
if (sd != null && (sd.onDesktop() || sd.toMenu())) {
- return SecurityDialogs.showAccessWarningDialogComplexReturn(AccessType.CREATE_DESTKOP_SHORTCUT, file);
+ return SecurityDialogs.showAccessWarningDialog(AccessType.CREATE_DESTKOP_SHORTCUT, file, null);
}
case ShortcutDesc.CREATE_ALWAYS_IF_HINTED:
if (sd != null && (sd.onDesktop() || sd.toMenu())) {
- return new AccessWarningPaneComplexReturn(0);
+ return new AccessWarningPaneComplexReturn(true);
}
}
- return new AccessWarningPaneComplexReturn(1);
+ return new AccessWarningPaneComplexReturn(false);
}
/**
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java
--- a/netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java Mon Jun 01 14:43:43 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java Tue Jun 09 13:02:00 2015 +0200
@@ -46,7 +46,8 @@
import net.sourceforge.jnlp.LaunchException;
import net.sourceforge.jnlp.runtime.JNLPClassLoader.SecurityDelegate;
import net.sourceforge.jnlp.security.SecurityDialogs.AccessType;
-import net.sourceforge.jnlp.security.SecurityDialogs.AppletAction;
+import net.sourceforge.jnlp.security.dialogresults.BasicDialogValue;
+import net.sourceforge.jnlp.security.dialogresults.YesNoSandbox;
import net.sourceforge.jnlp.tools.CertInformation;
import net.sourceforge.jnlp.tools.JarCertVerifier;
@@ -120,10 +121,10 @@
dialogType = AccessType.UNVERIFIED;
}
- AppletAction action = SecurityDialogs.showCertWarningDialog(
+ YesNoSandbox action = SecurityDialogs.showCertWarningDialog(
dialogType, file, jcv, securityDelegate);
- if (action != AppletAction.CANCEL) {
- if (action == AppletAction.SANDBOX) {
+ if (action != null && action.toBoolean()) {
+ if (action.compareValue(BasicDialogValue.Primitive.SANDBOX)) {
securityDelegate.setRunInSandbox();
}
return;
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 netx/net/sourceforge/jnlp/security/JNLPAuthenticator.java
--- a/netx/net/sourceforge/jnlp/security/JNLPAuthenticator.java Mon Jun 01 14:43:43 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/JNLPAuthenticator.java Tue Jun 09 13:02:00 2015 +0200
@@ -39,6 +39,7 @@
import java.net.Authenticator;
import java.net.PasswordAuthentication;
+import net.sourceforge.jnlp.security.dialogresults.NamePassword;
public class JNLPAuthenticator extends Authenticator {
@@ -55,11 +56,11 @@
int port = getRequestingPort();
String prompt = getRequestingPrompt();
- Object[] response = SecurityDialogs.showAuthenicationPrompt(host, port, prompt, type);
+ NamePassword response = SecurityDialogs.showAuthenicationPrompt(host, port, prompt, type);
if (response == null) {
return null;
} else {
- return new PasswordAuthentication((String) response[0], (char[]) response[1]);
+ return new PasswordAuthentication(response.getName(), response.getPassword());
}
}
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 netx/net/sourceforge/jnlp/security/PluginAppVerifier.java
--- a/netx/net/sourceforge/jnlp/security/PluginAppVerifier.java Mon Jun 01 14:43:43 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/PluginAppVerifier.java Tue Jun 09 13:02:00 2015 +0200
@@ -48,7 +48,8 @@
import net.sourceforge.jnlp.LaunchException;
import net.sourceforge.jnlp.runtime.JNLPClassLoader.SecurityDelegate;
import net.sourceforge.jnlp.security.SecurityDialogs.AccessType;
-import net.sourceforge.jnlp.security.SecurityDialogs.AppletAction;
+import net.sourceforge.jnlp.security.dialogresults.BasicDialogValue;
+import net.sourceforge.jnlp.security.dialogresults.YesNoSandbox;
import net.sourceforge.jnlp.tools.CertInformation;
import net.sourceforge.jnlp.tools.JarCertVerifier;
@@ -167,10 +168,10 @@
dialogType = AccessType.UNVERIFIED;
}
- AppletAction action = SecurityDialogs.showCertWarningDialog(
+ YesNoSandbox action = SecurityDialogs.showCertWarningDialog(
dialogType, file, jcv, securityDelegate);
- if (action != AppletAction.CANCEL) {
- if (action == AppletAction.SANDBOX) {
+ if (action != null && action.toBoolean()) {
+ if (action.compareValue(BasicDialogValue.Primitive.SANDBOX)) {
securityDelegate.setRunInSandbox();
}
alreadyApprovedByUser.add(cPath);
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 netx/net/sourceforge/jnlp/security/SecurityDialog.java
--- a/netx/net/sourceforge/jnlp/security/SecurityDialog.java Mon Jun 01 14:43:43 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialog.java Tue Jun 09 13:02:00 2015 +0200
@@ -51,6 +51,7 @@
import net.sourceforge.jnlp.runtime.JNLPClassLoader.SecurityDelegate;
import net.sourceforge.jnlp.security.SecurityDialogs.AccessType;
import net.sourceforge.jnlp.security.SecurityDialogs.DialogType;
+import net.sourceforge.jnlp.security.dialogresults.DialogResult;
import net.sourceforge.jnlp.security.dialogs.AccessWarningPane;
import net.sourceforge.jnlp.security.dialogs.AppletWarningPane;
import net.sourceforge.jnlp.security.dialogs.CertWarningPane;
@@ -100,11 +101,7 @@
/** Whether or not this object has been fully initialized */
private boolean initialized = false;
- /**
- * the return value of this dialog. result: 0 = Yes, 1 = No, 2 = Cancel,
- * null = Window closed.
- */
- private Object value;
+ private DialogResult value;
/** Should show signed JNLP file warning */
private boolean requiresSignedJNLPWarning;
@@ -340,12 +337,12 @@
panel.requestFocusOnDefaultButton();
}
- public void setValue(Object value) {
+ public void setValue(DialogResult value) {
OutputController.getLogger().log("Setting value:" + value);
this.value = value;
}
- public Object getValue() {
+ public DialogResult getValue() {
OutputController.getLogger().log("Returning value:" + value);
return value;
}
@@ -366,7 +363,7 @@
* Notify all the listeners that the user has made a decision using this
* security dialog.
*/
- public void notifySelectionMade() {
+ private void notifySelectionMade() {
for (ActionListener listener : listeners) {
listener.actionPerformed(null);
}
@@ -386,5 +383,4 @@
{
return requiresSignedJNLPWarning;
}
-
}
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java
--- a/netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java Mon Jun 01 14:43:43 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java Tue Jun 09 13:02:00 2015 +0200
@@ -45,12 +45,13 @@
import net.sourceforge.jnlp.JNLPFile;
import net.sourceforge.jnlp.security.SecurityDialogs.AccessType;
import net.sourceforge.jnlp.security.SecurityDialogs.DialogType;
+import net.sourceforge.jnlp.security.dialogresults.DialogResult;
/**
* Represents a message to the security framework to show a specific security
* dialog
*/
-final class SecurityDialogMessage {
+public final class SecurityDialogMessage {
/*
* These fields contain information need to display the correct dialog type
@@ -67,7 +68,7 @@
* Volatile because this is shared between threads and we dont want threads
* to use a cached value of this.
*/
- public volatile Object userResponse;
+ public volatile DialogResult userResponse;
/*
* These two fields are used to block/unblock the application or the applet.
diff -r 39e9fe259ce7 -r 9b3cfdc71c60 netx/net/sourceforge/jnlp/security/SecurityDialogs.java
--- a/netx/net/sourceforge/jnlp/security/SecurityDialogs.java Mon Jun 01 14:43:43 2015 +0200
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialogs.java Tue Jun 09 13:02:00 2015 +0200
@@ -58,8 +58,12 @@
import net.sourceforge.jnlp.security.appletextendedsecurity.ExecuteAppletAction;
import net.sourceforge.jnlp.security.appletextendedsecurity.UnsignedAppletTrustConfirmation;
import static net.sourceforge.jnlp.security.appletextendedsecurity.UnsignedAppletTrustConfirmation.getStoredAction;
-import net.sourceforge.jnlp.security.dialogs.AccessWarningPaneComplexReturn;
+import net.sourceforge.jnlp.security.dialogresults.AccessWarningPaneComplexReturn;
+import net.sourceforge.jnlp.security.dialogresults.DialogResult;
+import net.sourceforge.jnlp.security.dialogresults.NamePassword;
+import net.sourceforge.jnlp.security.dialogresults.YesNoSandbox;
import net.sourceforge.jnlp.security.dialogs.remember.AppSigningWarningAction;
+import net.sourceforge.jnlp.security.dialogs.remember.RememberPanel;
import net.sourceforge.jnlp.util.UrlUtils;
import net.sourceforge.jnlp.util.logging.OutputController;
@@ -109,24 +113,6 @@
SIGNING_ERROR
}
- public static enum AppletAction {
- RUN,
- SANDBOX,
- CANCEL;
- public static AppletAction fromInteger(int i) {
- switch (i) {
- case 0:
- return RUN;
- case 1:
- return SANDBOX;
- case 2:
- return CANCEL;
- default:
- return CANCEL;
- }
- }
- }
-
/**
* Shows a warning dialog for different types of system access (i.e. file
* open/save, clipboard read/write, printing, etc).
@@ -135,81 +121,11 @@
* @param file the jnlp file associated with the requesting application.
* @return true if permission was granted by the user, false otherwise.
*/
- public static boolean showAccessWarningDialogB(AccessType accessType, JNLPFile file) {
- return showAccessWarningDialogB(accessType, file, null);
- }
-
- public static boolean showAccessWarningDialogB(AccessType accessType, JNLPFile file, final Object[] extras) {
- Object o = showAccessWarningDialog(accessType, file, extras);
- if (o instanceof Boolean){
- return (Boolean) o;
- }
- if (o instanceof Integer){
- return getIntegerResponseAsBoolean((Boolean)o);
- }
- if (o instanceof AccessWarningPaneComplexReturn){
- return getIntegerResponseAsBoolean(((AccessWarningPaneComplexReturn)o).getRegularReturn());
- }
- return false;
- }
-
- /**
- * unlike showAccessWarningDialogB this is returning raw int code
- * @param accessType type of dialogue
- * @param file file for which thsi dialogue is built for
- * @return return from dialogue
- */
- public static int showAccessWarningDialogI(AccessType accessType, JNLPFile file) {
- Object o = showAccessWarningDialog(accessType, file, null);
- if (o instanceof Boolean){
- boolean b =(Boolean) o;
- if (b){
- return 0;
- } else {
- return 1;
- }
- }
- if (o instanceof Integer){
- return (Integer)o;
- }
- if (o instanceof AccessWarningPaneComplexReturn){
- return ((AccessWarningPaneComplexReturn)o).getRegularReturn();
- }
- return 1;
- }
-
- public static AccessWarningPaneComplexReturn showAccessWarningDialogComplexReturn(AccessType accessType, JNLPFile file) {
- Object o = showAccessWarningDialog(accessType, file, null);
- if (o instanceof AccessWarningPaneComplexReturn){
- return (AccessWarningPaneComplexReturn)o;
- }
- if (o instanceof Boolean) {
- boolean b = (Boolean) o;
- if (b) {
- return new AccessWarningPaneComplexReturn(0);
- } else {
- return new AccessWarningPaneComplexReturn(1);
- }
- }
- if (o instanceof Integer) {
- return new AccessWarningPaneComplexReturn((int) o);
- }
- return new AccessWarningPaneComplexReturn(1);
- }
-
-
- /**
- * unlike showAccessWarningDialogB this is returning raw int code
- * @param accessType type of dialogue
- * @param file file for which thsi dialogue is built for
- * @param extras aditional parameters to dialogue
- * @return return from dialogue
- */
- public static Object showAccessWarningDialog(final AccessType accessType,
+ public static AccessWarningPaneComplexReturn showAccessWarningDialog(final AccessType accessType,
final JNLPFile file, final Object[] extras) {
if (!shouldPromptUser()) {
- return 1;
+ return new AccessWarningPaneComplexReturn(false);
}
final SecurityDialogMessage message = new SecurityDialogMessage();
@@ -219,7 +135,7 @@
message.file = file;
message.extras = extras;
- return getUserResponse(message);
+ return (AccessWarningPaneComplexReturn) getUserResponse(message);
}
@@ -246,7 +162,7 @@
message.accessType = AccessType.UNSIGNED;
message.file = file;
- return (AppSigningWarningAction) getUserResponse(message);
+ return ((RememberPanel.Garbage) getUserResponse(message)).getAction();
}
/**
@@ -264,11 +180,11 @@
* wants the applet to run with only sandbox permissions, or CANCEL if the
* user did not accept running the applet
*/
- public static AppletAction showCertWarningDialog(AccessType accessType,
+ public static YesNoSandbox showCertWarningDialog(AccessType accessType,
JNLPFile file, CertVerifier certVerifier, SecurityDelegate securityDelegate) {
if (!shouldPromptUser()) {
- return AppletAction.CANCEL;
+ return YesNoSandbox.no();
}
final SecurityDialogMessage message = new SecurityDialogMessage();
@@ -278,9 +194,9 @@
message.certVerifier = certVerifier;
message.extras = new Object[] { securityDelegate };
- Object selectedValue = getUserResponse(message);
+ DialogResult selectedValue = getUserResponse(message);
- return getIntegerResponseAsAppletAction(selectedValue);
+ return (YesNoSandbox) selectedValue;
}
/**
@@ -305,7 +221,7 @@
message.certVerifier = certVerifier;
message.extras = new Object[] { securityDelegate };
- return (AppSigningWarningAction) getUserResponse(message);
+ return ((RememberPanel.Garbage) getUserResponse(message)).getAction();
}
/**
@@ -320,7 +236,7 @@
* @return an array of objects representing user's authentication tokens
* @throws SecurityException if the caller does not have the appropriate permissions.
*/
- public static Object[] showAuthenicationPrompt(String host, int port, String prompt, String type) {
+ public static NamePassword showAuthenicationPrompt(String host, int port, String prompt, String type) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -334,8 +250,8 @@
message.dialogType = DialogType.AUTHENTICATION;
message.extras = new Object[] { host, port, prompt, type };
- Object response = getUserResponse(message);
- return (Object[]) response;
More information about the distro-pkg-dev
mailing list