summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oberlies2012-01-12 11:40:05 (EST)
committerTobias Oberlies2012-01-13 08:46:03 (EST)
commit78e1fa6669af8e6b9dff994d4670856830d91899 (patch)
treef95960df61bd9881d5845e1bdcc0c78c93c59cb4
parentb25110d66c3fee4132d6357c19e9858d0dd59790 (diff)
downloadrt.equinox.p2-78e1fa6669af8e6b9dff994d4670856830d91899.zip
rt.equinox.p2-78e1fa6669af8e6b9dff994d4670856830d91899.tar.gz
rt.equinox.p2-78e1fa6669af8e6b9dff994d4670856830d91899.tar.bz2
348366 Work around API tooling error in back-portv20120113-1346R3_7_2R3_7_maintenance
- Adding a constant to an API class is an API extension and therefore would require a minor version increment. This, however, is not allowed in maintenance branches. - This commit works around this problem by moving the new constant to a non-API class. This is ugly (just like the whole situation), but IMHO the bug is severe and needs to be fixed.
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/UIServicesHelper_R37x.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java5
4 files changed, 44 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/UIServicesHelper_R37x.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/UIServicesHelper_R37x.java
new file mode 100644
index 0000000..8eb6d3b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/UIServicesHelper_R37x.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 SAP AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.core.helpers;
+
+import org.eclipse.equinox.p2.core.UIServices;
+import org.eclipse.equinox.p2.core.UIServices.AuthenticationInfo;
+
+/**
+ * This class is only intended for the R37x branch, where the constant
+ * <code>AUTHENTICATION_PROMPT_CANCELED</code> cannot be added to the API class
+ * {@link UIServices}. Adding new API would require a minor version increment,
+ * which is not allowed in maintenance branches.
+ */
+public final class UIServicesHelper_R37x {
+ /**
+ * This constant may be returned by the <code>getUsernamePassword</code> methods if the user
+ * explicitly canceled the authentication prompt.
+ *
+ * @see UIServices#getUsernamePassword(String)
+ * @see UIServices#getUsernamePassword(String, AuthenticationInfo)
+ */
+ public static final AuthenticationInfo AUTHENTICATION_PROMPT_CANCELED = new AuthenticationInfo("", "", false); //$NON-NLS-1$//$NON-NLS-2$
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java
index d033186..83c1538 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.p2.core;
import java.security.cert.Certificate;
+import org.eclipse.equinox.internal.p2.core.helpers.UIServicesHelper_R37x;
/**
* Service used for prompting for user information from within lower level code.
@@ -33,10 +34,10 @@ public abstract class UIServices {
/**
* This constant may be returned by the <code>getUsernamePassword</code> methods if the user
* explicitly canceled the authentication prompt.
- *
- * @since 2.1.1
*/
- public static final AuthenticationInfo AUTHENTICATION_PROMPT_CANCELED = new AuthenticationInfo("", "", false); //$NON-NLS-1$//$NON-NLS-2$
+ // For the back-port of 348366 to R37x, this constant was moved to the class
+ // UIServicesHelper_R37x in an internal package so that no minor version increment is required
+ // public static final AuthenticationInfo AUTHENTICATION_PROMPT_CANCELED = new AuthenticationInfo("", "", false); //$NON-NLS-1$//$NON-NLS-2$
/**
* Authentication information returned from an authentication prompt request.
@@ -117,7 +118,7 @@ public abstract class UIServices {
* Opens a UI prompt for authentication details
*
* @param location - the location requiring login details, may be <code>null</code>.
- * @return The authentication result, or <code>null</code>, or {@link #AUTHENTICATION_PROMPT_CANCELED}
+ * @return The authentication result, or <code>null</code>, or {@link UIServicesHelper_R37x#AUTHENTICATION_PROMPT_CANCELED}
*/
public abstract AuthenticationInfo getUsernamePassword(String location);
@@ -127,7 +128,7 @@ public abstract class UIServices {
*
* @param location the location requiring login details
* @param previousInfo - the previously used authentication details - may not be null.
- * @return The authentication result, or <code>null</code>, or {@link #AUTHENTICATION_PROMPT_CANCELED}
+ * @return The authentication result, or <code>null</code>, or {@link UIServicesHelper_R37x#AUTHENTICATION_PROMPT_CANCELED}
*/
public abstract AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo);
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
index 96cd714..0330d20 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
@@ -19,6 +19,7 @@ import java.net.URLEncoder;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.UIServicesHelper_R37x;
import org.eclipse.equinox.internal.p2.repository.helpers.DebugHelper;
import org.eclipse.equinox.p2.core.*;
import org.eclipse.equinox.p2.repository.IRepository;
@@ -233,11 +234,11 @@ public class Credentials {
loginDetails = lastUsed != null ? adminUIService.getUsernamePassword(host, lastUsed) : adminUIService.getUsernamePassword(host);
//null result means user canceled password dialog
if (DebugHelper.DEBUG_REPOSITORY_CREDENTIALS) {
- if (loginDetails == UIServices.AUTHENTICATION_PROMPT_CANCELED)
+ if (loginDetails == UIServicesHelper_R37x.AUTHENTICATION_PROMPT_CANCELED)
DebugHelper.debug("Credentials", "forLocation:PROMPTED - USER CANCELED (PROMPT LOCK RELEASED)", // //$NON-NLS-1$ //$NON-NLS-2$
new Object[] {"host", location}); //$NON-NLS-1$
}
- if (loginDetails == UIServices.AUTHENTICATION_PROMPT_CANCELED) {
+ if (loginDetails == UIServicesHelper_R37x.AUTHENTICATION_PROMPT_CANCELED) {
rememberCancel(host);
throw new LoginCanceledException();
} else if (loginDetails == null) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
index ff6209f..f8a72e6 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.internal.p2.ui;
import java.security.cert.Certificate;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.equinox.internal.p2.core.helpers.UIServicesHelper_R37x;
import org.eclipse.equinox.internal.p2.ui.dialogs.TrustCertificateDialog;
import org.eclipse.equinox.internal.p2.ui.dialogs.UserValidationDialog;
import org.eclipse.equinox.internal.p2.ui.viewers.CertificateLabelProvider;
@@ -67,7 +68,7 @@ public class ValidationDialogServiceUI extends UIServices {
if (dialogCode == Window.OK) {
result[0] = dialog.getResult();
} else if (dialogCode == Window.CANCEL) {
- result[0] = AUTHENTICATION_PROMPT_CANCELED;
+ result[0] = UIServicesHelper_R37x.AUTHENTICATION_PROMPT_CANCELED;
}
}
@@ -177,7 +178,7 @@ public class ValidationDialogServiceUI extends UIServices {
if (dialogCode == Window.OK) {
result[0] = dialog.getResult();
} else if (dialogCode == Window.CANCEL) {
- result[0] = AUTHENTICATION_PROMPT_CANCELED;
+ result[0] = UIServicesHelper_R37x.AUTHENTICATION_PROMPT_CANCELED;
}
}