Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-02-26 17:13:10 +0000
committerAlexander Kurtakov2015-02-26 17:13:10 +0000
commit66c9297a230aeb57eb49d07f77eebf9c68d5b9ad (patch)
tree8ef9f1148e3aed53501cfca5f613b03940007956 /bundles/org.eclipse.equinox.p2.repository
parentf92c74ac081d929a7ce96a85b26bf60b5364a101 (diff)
downloadrt.equinox.p2-66c9297a230aeb57eb49d07f77eebf9c68d5b9ad.tar.gz
rt.equinox.p2-66c9297a230aeb57eb49d07f77eebf9c68d5b9ad.tar.xz
rt.equinox.p2-66c9297a230aeb57eb49d07f77eebf9c68d5b9ad.zip
Bug 460967 - Use type safe service retrievingI20150303-0800
Instead of retrieving services based on their String class name there is newer implementation that takes the class directly and returns the correct class preventing casts. Change-Id: I8b26f4d294b927f4c28a6ba4e68e35bd401df4ec Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository')
-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.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java5
3 files changed, 10 insertions, 8 deletions
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 96cd71426..ed34c2a05 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* The code, documentation and other materials contained herein have been
* licensed under the Eclipse Public License - v 1.0 by the copyright holder
* listed above, as the Initial Contributor under such license. The text of
@@ -8,6 +8,7 @@
* IBM Corporation - Initial API and implementation
* Cloudsmith Inc - Implementation
* Sonatype Inc - Ongoing development
+ * Red Hat Inc. - Bug 460967
******************************************************************************/
package org.eclipse.equinox.internal.p2.repository;
@@ -218,7 +219,7 @@ public class Credentials {
throw new LoginCanceledException();
return latest == null ? lastUsed : latest; // keep client failing on the latest known
}
- IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(Activator.getContext(), IProvisioningAgent.SERVICE_NAME);
+ IProvisioningAgent agent = ServiceHelper.getService(Activator.getContext(), IProvisioningAgent.class);
UIServices adminUIService = (UIServices) agent.getService(UIServices.SERVICE_NAME);
if (adminUIService != null)
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
index 27d495053..548958307 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation 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
@@ -9,7 +9,7 @@
* IBM Corporation - initial API and implementation
* Wind River - fix for bug 299227
* Sonatype, Inc. - transport split
- * Red Hat,Inc. - fix for bug 249133
+ * Red Hat,Inc. - fixes for bugs 249133, 460967
* Ericsson AB (Pascal Rapicault) - reading preferences from base in shared install
*******************************************************************************/
package org.eclipse.equinox.internal.p2.repository.helpers;
@@ -494,7 +494,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
Preferences getPreferences() {
if (agentLocation == null)
return null;
- IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(Activator.getContext(), IPreferencesService.class.getName());
+ IPreferencesService prefService = ServiceHelper.getService(Activator.getContext(), IPreferencesService.class);
if (prefService == null)
return null;
try {
@@ -509,7 +509,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
Preferences getSharedPreferences() {
if (agentLocation == null)
return null;
- IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(Activator.getContext(), IPreferencesService.class.getName());
+ IPreferencesService prefService = ServiceHelper.getService(Activator.getContext(), IPreferencesService.class);
if (prefService == null)
return null;
try {
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
index e2f29b76f..267274de2 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.p2.repository.helpers;
@@ -23,7 +24,7 @@ public class DebugHelper {
public static final boolean DEBUG_REPOSITORY_TRANSPORT;
static {
- DebugOptions options = (DebugOptions) ServiceHelper.getService(Activator.getContext(), DebugOptions.class.getName());
+ DebugOptions options = ServiceHelper.getService(Activator.getContext(), DebugOptions.class);
if (options != null) {
DEBUG_REPOSITORY_CREDENTIALS = options.getBooleanOption(Activator.ID + "/credentials/debug", false); //$NON-NLS-1$
DEBUG_REPOSITORY_TRANSPORT = options.getBooleanOption(Activator.ID + "/transport/debug", false); //$NON-NLS-1$

Back to the top