Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-02-26 12:13:10 -0500
committerAlexander Kurtakov2015-02-26 12:13:10 -0500
commit66c9297a230aeb57eb49d07f77eebf9c68d5b9ad (patch)
tree8ef9f1148e3aed53501cfca5f613b03940007956 /bundles/org.eclipse.equinox.p2.engine/src
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.engine/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java10
4 files changed, 16 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
index 0726908d9..58c9fdbac 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/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.engine;
@@ -31,7 +32,7 @@ public class DebugHelper {
public static final boolean DEBUG_CERTIFICATE_CHECKER_UNTRUSTED;
static {
- DebugOptions options = (DebugOptions) ServiceHelper.getService(EngineActivator.getContext(), DebugOptions.class.getName());
+ DebugOptions options = ServiceHelper.getService(EngineActivator.getContext(), DebugOptions.class);
if (options != null) {
DEBUG_PROFILE_REGISTRY = options.getBooleanOption(EngineActivator.ID + "/profileregistry/debug", false); //$NON-NLS-1$
DEBUG_ENGINE = options.getBooleanOption(EngineActivator.ID + "/engine/debug", false); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java
index 96d94f274..70080ff80 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java
@@ -1,10 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others. All rights reserved. This
+ * 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 http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: IBM Corporation - initial API and implementation
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
******************************************************************************/
package org.eclipse.equinox.internal.p2.engine;
@@ -34,7 +36,7 @@ public class ProfileLock {
}
private static Location createLockLocation(File parent) {
- Location anyLoc = (Location) ServiceHelper.getService(EngineActivator.getContext(), Location.class.getName());
+ Location anyLoc = ServiceHelper.getService(EngineActivator.getContext(), Location.class);
try {
final URL url = parent.toURL();
Location location = anyLoc.createLocation(null, url, false);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
index b5e23013a..c1e5b1437 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 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 http://www.eclipse.org/legal/epl-v10.html
@@ -7,7 +7,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson AB - ongoing development
- * Red Hat, Inc. - fragments support added.
+ * Red Hat, Inc. - fragments support added, Bug 460967
******************************************************************************/
package org.eclipse.equinox.internal.p2.engine;
@@ -154,7 +154,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
private boolean updateRoamingProfile(Profile selfProfile) {
if (DebugHelper.DEBUG_PROFILE_REGISTRY)
DebugHelper.debug(PROFILE_REGISTRY, "SimpleProfileRegistry.updateRoamingProfile"); //$NON-NLS-1$
- Location installLocation = (Location) ServiceHelper.getService(EngineActivator.getContext(), Location.class.getName(), Location.INSTALL_FILTER);
+ Location installLocation = ServiceHelper.getService(EngineActivator.getContext(), Location.class, Location.INSTALL_FILTER);
File location = new File(installLocation.getURL().getPath());
boolean changed = false;
if (!location.equals(new File(selfProfile.getProperty(IProfile.PROP_INSTALL_FOLDER)))) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
index 0b258bb03..ac2529664 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson AB - Bug 400011 - [shared] Cleanup the SurrogateProfileHandler code
- * Red Hat, Inc. - fragments support added.
+ * Red Hat, Inc. - fragments support added., Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine;
@@ -54,7 +54,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
private static void addSharedProfileBaseIUs(final IProfile sharedProfile, final Profile userProfile) {
IQuery<IInstallableUnit> rootIUQuery = QueryUtil.createMatchQuery( //
- "profileProperties[$0] == 'true' || (touchpointType != null && touchpointType.id == $1)",//$NON-NLS-1$
+ "profileProperties[$0] == 'true' || (touchpointType != null && touchpointType.id == $1)", //$NON-NLS-1$
IProfile.PROP_PROFILE_ROOT_IU, NATIVE_TOUCHPOINT_TYPE);
IQueryResult<IInstallableUnit> rootIUs = sharedProfile.query(rootIUQuery, null);
for (Iterator<IInstallableUnit> iterator = rootIUs.iterator(); iterator.hasNext();) {
@@ -96,7 +96,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
}
private static void updateProperties(final IProfile sharedProfile, Profile userProfile) {
- Location installLocation = (Location) ServiceHelper.getService(EngineActivator.getContext(), Location.class.getName(), Location.INSTALL_FILTER);
+ Location installLocation = ServiceHelper.getService(EngineActivator.getContext(), Location.class, Location.INSTALL_FILTER);
File installFolder = new File(installLocation.getURL().getPath());
if (Boolean.valueOf(sharedProfile.getProperty(IProfile.PROP_ROAMING)).booleanValue()) {
@@ -109,7 +109,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
userProfile.setProperty(IProfile.PROP_SHARED_CACHE, cache);
}
- Location configurationLocation = (Location) ServiceHelper.getService(EngineActivator.getContext(), Location.class.getName(), Location.CONFIGURATION_FILTER);
+ Location configurationLocation = ServiceHelper.getService(EngineActivator.getContext(), Location.class, Location.CONFIGURATION_FILTER);
File configurationFolder = new File(configurationLocation.getURL().getPath());
userProfile.setProperty(IProfile.PROP_CONFIGURATION_FOLDER, configurationFolder.getAbsolutePath());

Back to the top