Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-09-25 19:46:56 +0000
committerAlexander Kurtakov2019-10-14 12:52:57 +0000
commitaa3e83b820b65e64a3db410632e20c44edcca832 (patch)
tree8532f7291207f3a0c336e452b81101f314d91f0e
parent14f4c89602076e92050a11bf8d9e3ed9b9c08e14 (diff)
downloadrt.equinox.p2-aa3e83b820b65e64a3db410632e20c44edcca832.tar.gz
rt.equinox.p2-aa3e83b820b65e64a3db410632e20c44edcca832.tar.xz
rt.equinox.p2-aa3e83b820b65e64a3db410632e20c44edcca832.zip
Use jdk 5 for-each loop
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: Ic18d9c7ab9195e53db97264b63672c6b4510fbe4 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherImpl.java9
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java10
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java178
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java31
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java155
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java13
6 files changed, 222 insertions, 174 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherImpl.java
index 9c239a2c3..0c4a59925 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherImpl.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherImpl.java
@@ -25,8 +25,8 @@ import org.osgi.service.log.LogService;
public class EclipseLauncherImpl {
static String getStringOfCmd(String[] cmdarray) {
StringBuilder sb = new StringBuilder();
- for (int i = 0; i < cmdarray.length; i++) {
- sb.append(cmdarray[i]);
+ for (String cmd : cmdarray) {
+ sb.append(cmd);
sb.append(" "); //$NON-NLS-1$
}
return sb.toString();
@@ -38,7 +38,8 @@ public class EclipseLauncherImpl {
this.fwAdmin = fwAdmin;
}
- public Process launch(Manipulator manipulator, File cwd) throws IllegalArgumentException, IOException, FrameworkAdminRuntimeException {
+ public Process launch(Manipulator manipulator, File cwd)
+ throws IllegalArgumentException, IOException, FrameworkAdminRuntimeException {
SimpleBundlesState.checkAvailability(fwAdmin);
Log.log(LogService.LOG_DEBUG, this, "launch(Manipulator , File )", ""); //$NON-NLS-1$ //$NON-NLS-2$
LauncherData launcherData = manipulator.getLauncherData();
@@ -52,7 +53,7 @@ public class EclipseLauncherImpl {
if (launcherData.getLauncher() == null)
throw new IllegalStateException(Messages.exception_launcherLocationNotSet);
- String[] cmdarray = new String[] {launcherData.getLauncher().getAbsolutePath()};
+ String[] cmdarray = new String[] { launcherData.getLauncher().getAbsolutePath() };
if (cwd == null)
cwd = launcherData.getLauncher().getParentFile();
Process process = Runtime.getRuntime().exec(cmdarray, null, cwd);
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
index d6ca572eb..4d264f86d 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
@@ -156,8 +156,7 @@ public class EclipseLauncherParser {
private void getJVMArgs(List<String> lines, LauncherData launcherData) {
ArrayList<String> vmargs = new ArrayList<>(lines.size());
boolean foundVmArgs = false;
- for (Iterator<String> iterator = lines.iterator(); iterator.hasNext();) {
- String line = iterator.next();
+ for (String line : lines) {
if (!foundVmArgs) {
if (EquinoxConstants.OPTION_VMARGS.equals(line))
foundVmArgs = true;
@@ -176,15 +175,14 @@ public class EclipseLauncherParser {
return;
String[] args = launcherData.getJvmArgs();
lines.add(EquinoxConstants.OPTION_VMARGS);
- for (int i = 0; i < args.length; i++) {
- lines.add(args[i]);
+ for (String arg : args) {
+ lines.add(arg);
}
}
private void getProgramArgs(List<String> lines, LauncherData launcherData) {
ArrayList<String> args = new ArrayList<>(lines.size());
- for (Iterator<String> iterator = lines.iterator(); iterator.hasNext();) {
- String line = iterator.next();
+ for (String line : lines) {
if (EquinoxConstants.OPTION_VMARGS.equals(line))
break;
args.add(line);
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
index 97496a844..efe677a31 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java
@@ -37,16 +37,19 @@ public class EquinoxBundlesState implements BundlesState {
private static final String INTERNAL_AMD64 = "amd64"; //$NON-NLS-1$
private static final String INTERNAL_ARCH_I386 = "i386"; //$NON-NLS-1$
@SuppressWarnings("deprecation")
- public static final String[] PROPS = {"osgi.os", "osgi.ws", "osgi.nl", "osgi.arch", Constants.FRAMEWORK_SYSTEMPACKAGES, "osgi.resolverMode", Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "osgi.resolveOptional", "osgi.genericAliases"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ public static final String[] PROPS = { "osgi.os", "osgi.ws", "osgi.nl", "osgi.arch", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Constants.FRAMEWORK_SYSTEMPACKAGES, "osgi.resolverMode", Constants.FRAMEWORK_EXECUTIONENVIRONMENT, //$NON-NLS-1$
+ "osgi.resolveOptional", "osgi.genericAliases" }; //$NON-NLS-1$ //$NON-NLS-2$
static boolean checkFullySupported() {
- //TODO - This was previously doing a bogus check by attempting to instantiate a particular class - it's not clear what this is trying to do
+ // TODO - This was previously doing a bogus check by attempting to instantiate a
+ // particular class - it's not clear what this is trying to do
return true;
}
/**
- * eclipse.exe will launch a fw where plugins/org.eclipse.osgi_*.*.*.*.jar
- * is an implementation of fw.
+ * eclipse.exe will launch a fw where plugins/org.eclipse.osgi_*.*.*.*.jar is an
+ * implementation of fw.
*
* @param launcherData
* @param configData
@@ -86,9 +89,9 @@ public class EquinoxBundlesState implements BundlesState {
// check -D arguments of jvmArgs ?
String[] jvmArgs = launcherData.getJvmArgs();
String location = null;
- for (int i = 0; i < jvmArgs.length; i++) {
- if (jvmArgs[i].endsWith("-D" + "osgi.framework=")) { //$NON-NLS-1$ //$NON-NLS-2$
- location = jvmArgs[i].substring(("-D" + "osgi.framework=").length()); //$NON-NLS-1$ //$NON-NLS-2$
+ for (String jvmArg : jvmArgs) {
+ if (jvmArg.endsWith("-D" + "osgi.framework=")) {//$NON-NLS-1$ //$NON-NLS-2$
+ location = jvmArg.substring(("-D" + "osgi.framework=").length()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
if (location != null) {
@@ -102,22 +105,23 @@ public class EquinoxBundlesState implements BundlesState {
}
}
return null;
- // return getSystemBundleBySearching(launcherData);
+ // return getSystemBundleBySearching(launcherData);
}
private static long getMaxId(State state) {
BundleDescription[] bundleDescriptions = state.getBundles();
long maxId = DEFAULT_TIMESTAMP;
- for (int i = 0; i < bundleDescriptions.length; i++)
- if (maxId < bundleDescriptions[i].getBundleId()) {
- maxId = bundleDescriptions[i].getBundleId();
+ for (BundleDescription bundleDescription : bundleDescriptions) {
+ if (maxId < bundleDescription.getBundleId()) {
+ maxId = bundleDescription.getBundleId();
}
+ }
return maxId;
}
private static File getSystemBundleFromBundleInfos(BundleInfo[] bundleInfos) {
- for (int i = 0; i < bundleInfos.length; i++) {
- File match = isSystemBundle(bundleInfos[i]);
+ for (BundleInfo bundleInfo : bundleInfos) {
+ File match = isSystemBundle(bundleInfo);
if (match != null)
return match;
}
@@ -140,9 +144,11 @@ public class EquinoxBundlesState implements BundlesState {
File[] lists = file.listFiles();
if (lists == null)
return ret;
- for (int i = 0; i < lists.length; i++)
- if (ret < lists[i].lastModified())
- ret = lists[i].lastModified();
+ for (File list : lists) {
+ if (ret < list.lastModified()) {
+ ret = list.lastModified();
+ }
+ }
return ret;
}
@@ -194,11 +200,14 @@ public class EquinoxBundlesState implements BundlesState {
arch = org.eclipse.osgi.service.environment.Constants.ARCH_X86_64;
else
arch = name;
- platformProperties.setProperty("osgi.arch", arch); //$NON-NLS-1$
-
- platformProperties.setProperty(Constants.FRAMEWORK_SYSTEMPACKAGES, context.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES));
- platformProperties.setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, context.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT));
- platformProperties.setProperty("osgi.resolveOptional", "" + "true".equals(context.getProperty("osgi.resolveOptional"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ platformProperties.setProperty("osgi.arch", arch); //$NON-NLS-1$
+
+ platformProperties.setProperty(Constants.FRAMEWORK_SYSTEMPACKAGES,
+ context.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES));
+ platformProperties.setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT,
+ context.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT));
+ platformProperties.setProperty("osgi.resolveOptional", //$NON-NLS-1$
+ "" + "true".equals(context.getProperty("osgi.resolveOptional"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} finally {
context.ungetService(environmentRef);
}
@@ -220,22 +229,23 @@ public class EquinoxBundlesState implements BundlesState {
private HashMap<URI, BundleDescription> locationStateIndex = new HashMap<>();
/**
- * Map of String->BundleDescription, where the key is the bundle name
- * and version as defined by the {@link #getKey(BundleDescription)} method.
+ * Map of String->BundleDescription, where the key is the bundle name and
+ * version as defined by the {@link #getKey(BundleDescription)} method.
*/
private HashMap<String, BundleDescription> nameVersionStateIndex = new HashMap<>();
private final PlatformAdmin platformAdmin;
/**
- * If useFwPersistentData flag equals false, this constructor will not take
- * a framework persistent data into account. Otherwise, it will.
+ * If useFwPersistentData flag equals false, this constructor will not take a
+ * framework persistent data into account. Otherwise, it will.
*
* @param context
* @param fwAdmin
* @param manipulator
* @param useFwPersistentData
*/
- EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, PlatformAdmin admin, boolean useFwPersistentData) {
+ EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, PlatformAdmin admin,
+ boolean useFwPersistentData) {
this.context = context;
this.fwAdmin = fwAdmin;
this.platformAdmin = admin;
@@ -248,15 +258,16 @@ public class EquinoxBundlesState implements BundlesState {
}
/**
- * This constructor does NOT take a framework persistent data into account.
- * It will create State object based on the specified platformProperties.
+ * This constructor does NOT take a framework persistent data into account. It
+ * will create State object based on the specified platformProperties.
*
* @param context
* @param fwAdmin
* @param manipulator
* @param platformProperties
*/
- EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, PlatformAdmin admin, Properties platformProperties) {
+ EquinoxBundlesState(BundleContext context, EquinoxFwAdminImpl fwAdmin, Manipulator manipulator, PlatformAdmin admin,
+ Properties platformProperties) {
super();
this.context = context;
this.fwAdmin = fwAdmin;
@@ -286,16 +297,17 @@ public class EquinoxBundlesState implements BundlesState {
/**
* compose new state without reading framework persistent data. The given
- * properties is used for the composition. If system bundle is not included
- * in the given bInfos, the fw jar launcherData contains will be used.
+ * properties is used for the composition. If system bundle is not included in
+ * the given bInfos, the fw jar launcherData contains will be used.
*
* @param launcherData
* @param configData
* @param properties
* @param bInfos
*/
- private void composeNewState(LauncherData launcherData, ConfigData configData, Properties properties, BundleInfo[] bInfos) {
- //Note, there use to be a lot more code in this method
+ private void composeNewState(LauncherData launcherData, ConfigData configData, Properties properties,
+ BundleInfo[] bInfos) {
+ // Note, there use to be a lot more code in this method
File fwJar = getSystemBundleFromBundleInfos(configData);
launcherData.setFwJar(fwJar);
this.setFwJar(fwJar);
@@ -313,7 +325,8 @@ public class EquinoxBundlesState implements BundlesState {
* @throws IllegalArgumentException
* @throws FrameworkAdminRuntimeException
*/
- private boolean composeState(BundleInfo[] bInfos, Dictionary<Object, Object> props, File fwPersistentDataLocation) throws IllegalArgumentException, FrameworkAdminRuntimeException {
+ private boolean composeState(BundleInfo[] bInfos, Dictionary<Object, Object> props, File fwPersistentDataLocation)
+ throws IllegalArgumentException, FrameworkAdminRuntimeException {
BundleInfo[] infos = manipulator.getConfigData().getBundles();
this.manipulator.getConfigData().setBundles(null);
SimpleBundlesState.checkAvailability(fwAdmin);
@@ -321,8 +334,10 @@ public class EquinoxBundlesState implements BundlesState {
state = null;
boolean flagNewState = false;
if (fwPersistentDataLocation != null) {
- //NOTE Here there was a big chunk of code reading the framework state persisted on disk
- // and I removed it because it was causing various problems. See in previous revision
+ // NOTE Here there was a big chunk of code reading the framework state persisted
+ // on disk
+ // and I removed it because it was causing various problems. See in previous
+ // revision
this.manipulator.getConfigData().setBundles(infos);
return false;
}
@@ -358,7 +373,8 @@ public class EquinoxBundlesState implements BundlesState {
newBundleInfos[0] = bInfos[indexSystemBundle];
System.arraycopy(bInfos, 0, newBundleInfos, 1, indexSystemBundle);
if (indexSystemBundle < bInfos.length - 1)
- System.arraycopy(bInfos, indexSystemBundle + 1, newBundleInfos, indexSystemBundle + 1, bInfos.length - indexSystemBundle - 1);
+ System.arraycopy(bInfos, indexSystemBundle + 1, newBundleInfos, indexSystemBundle + 1,
+ bInfos.length - indexSystemBundle - 1);
bInfos = newBundleInfos;
}
}
@@ -369,7 +385,7 @@ public class EquinoxBundlesState implements BundlesState {
this.installBundle(bInfos[j]);
// System.out.println("install bInfos[" + j + "]=" + bInfos[j]);
} catch (RuntimeException e) {
- //catch the exception and continue
+ // catch the exception and continue
Log.log(LogService.LOG_ERROR, this, "composeExpectedState()", "BundleInfo:" + bInfos[j], e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -402,7 +418,8 @@ public class EquinoxBundlesState implements BundlesState {
return createBundleInfo(toConvert, markedAsStarted, sl, location, null);
}
- private BundleInfo createBundleInfo(BundleDescription toConvert, boolean markedAsStarted, int sl, URI location, String fragmentHost) {
+ private BundleInfo createBundleInfo(BundleDescription toConvert, boolean markedAsStarted, int sl, URI location,
+ String fragmentHost) {
BundleInfo result = new BundleInfo();
result.setSymbolicName(toConvert.getSymbolicName());
result.setVersion(toConvert.getVersion().toString());
@@ -418,13 +435,14 @@ public class EquinoxBundlesState implements BundlesState {
public BundleInfo[] convertState(BundleDescription[] bundles) {
BundleInfo[] originalBInfos = manipulator.getConfigData().getBundles();
Map<URI, BundleInfo> bundleInfoMap = new HashMap<>();
- for (int i = 0; i < originalBInfos.length; i++) {
- bundleInfoMap.put(originalBInfos[i].getLocation(), originalBInfos[i]);
+ for (BundleInfo originalBInfo : originalBInfos) {
+ bundleInfoMap.put(originalBInfo.getLocation(), originalBInfo);
}
BundleInfo[] result = new BundleInfo[bundles.length];
for (int i = 0; i < bundles.length; i++) {
- if (bundles[i].getBundleId() == 0 && EquinoxConstants.FW_SYMBOLIC_NAME.equals(bundles[i].getSymbolicName())) {
+ if (bundles[i].getBundleId() == 0
+ && EquinoxConstants.FW_SYMBOLIC_NAME.equals(bundles[i].getSymbolicName())) {
result[i] = convertSystemBundle(bundles[i]);
continue;
}
@@ -432,14 +450,16 @@ public class EquinoxBundlesState implements BundlesState {
boolean markedAsStarted = false;
int sl = BundleInfo.NO_LEVEL;
- //URI location = FileUtils.getEclipseRealLocation(manipulator, bundles[i].getLocation());
- //TODO: I believe this is always an absolute URI
+ // URI location = FileUtils.getEclipseRealLocation(manipulator,
+ // bundles[i].getLocation());
+ // TODO: I believe this is always an absolute URI
URI location;
try {
location = new URI(bundles[i].getLocation());
} catch (URISyntaxException e) {
e.printStackTrace();
- throw new IllegalStateException("BundleDescription conversion problem" + e.getMessage(), e); //$NON-NLS-1$ //TODO path_fun
+ throw new IllegalStateException("BundleDescription conversion problem" + e.getMessage(), e); //$NON-NLS-1$ //TODO
+ // path_fun
}
String fragmentHost = null;
BundleInfo original = bundleInfoMap.get(location);
@@ -469,17 +489,20 @@ public class EquinoxBundlesState implements BundlesState {
URI realLocation = bInfo.getLocation();
BundleDescription bundle = getBundleByLocation(realLocation);
ImportPackageSpecification[] imports = bundle.getImportPackages();
- for (int i = 0; i < imports.length; i++) {
- BaseDescription supplier = imports[i].getSupplier();
+ for (ImportPackageSpecification importspec : imports) {
+ BaseDescription supplier = importspec.getSupplier();
if (supplier == null) {
- if (!imports[i].getDirective(Constants.RESOLUTION_DIRECTIVE).equals(ImportPackageSpecification.RESOLUTION_OPTIONAL))
+ if (!importspec.getDirective(Constants.RESOLUTION_DIRECTIVE)
+ .equals(ImportPackageSpecification.RESOLUTION_OPTIONAL)) {
throw new IllegalStateException("Internal error: import supplier should not be null"); //$NON-NLS-1$
- } else
+ }
+ } else {
set.add(supplier.getSupplier());
+ }
}
BundleDescription[] requires = bundle.getResolvedRequires();
- for (int i = 0; i < requires.length; i++) {
- set.add(requires[i]);
+ for (BundleDescription require : requires) {
+ set.add(require);
}
BundleDescription[] bundles = new BundleDescription[set.size()];
set.toArray(bundles);
@@ -487,7 +510,8 @@ public class EquinoxBundlesState implements BundlesState {
}
private int getStartLevel(int startLevel) {
- return (startLevel == BundleInfo.NO_LEVEL ? manipulator.getConfigData().getInitialBundleStartLevel() : startLevel);
+ return (startLevel == BundleInfo.NO_LEVEL ? manipulator.getConfigData().getInitialBundleStartLevel()
+ : startLevel);
}
@Override
@@ -540,7 +564,8 @@ public class EquinoxBundlesState implements BundlesState {
composeNewState(launcherData, configData, bInfos);
} else {
if (manipulator.getLauncherData().getFwPersistentDataLocation() == null) {
- File installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configData.getProperties(), launcherData);
+ File installArea = ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()),
+ configData.getProperties(), launcherData);
if (DEBUG)
Log.log(LogService.LOG_DEBUG, this, "initialize(useFwPersistentDat)", "installArea=" + installArea); //$NON-NLS-1$ //$NON-NLS-2$
if (installArea == null)
@@ -577,7 +602,8 @@ public class EquinoxBundlesState implements BundlesState {
try {
bInfo.setBundleId(++maxId);
- BundleDescription newBundleDescription = soFactory.createBundleDescription(state, manifest, realLocation.toString(), bInfo.getBundleId());
+ BundleDescription newBundleDescription = soFactory.createBundleDescription(state, manifest,
+ realLocation.toString(), bInfo.getBundleId());
addBundleToState(newBundleDescription);
manipulator.getConfigData().addBundle(bInfo);
} catch (BundleException e) {
@@ -644,8 +670,8 @@ public class EquinoxBundlesState implements BundlesState {
for (Enumeration<Object> enumeration = props.keys(); enumeration.hasMoreElements();) {
String key = (String) enumeration.nextElement();
- for (int i = 0; i < PROPS.length; i++) {
- if (key.equals(PROPS[i])) {
+ for (String property : PROPS) {
+ if (key.equals(property)) {
platformProperties.put(key, props.get(key));
break;
}
@@ -667,24 +693,26 @@ public class EquinoxBundlesState implements BundlesState {
return null;
StringBuilder sb = new StringBuilder();
BundleDescription[] bundleDescriptions = state.getBundles();
- for (int i = 0; i < bundleDescriptions.length; i++) {
- sb.append(bundleDescriptions[i].getBundleId() + ":"); //$NON-NLS-1$
- sb.append(bundleDescriptions[i].toString() + "("); //$NON-NLS-1$
- sb.append(bundleDescriptions[i].isResolved() + ")"); //$NON-NLS-1$
- String[] ees = bundleDescriptions[i].getExecutionEnvironments();
- for (int j = 0; j < ees.length; j++)
- sb.append(ees[j] + " "); //$NON-NLS-1$
+ for (BundleDescription bundleDescription : bundleDescriptions) {
+ sb.append(bundleDescription.getBundleId() + ":"); //$NON-NLS-1$
+ sb.append(bundleDescription.toString() + "("); //$NON-NLS-1$
+ sb.append(bundleDescription.isResolved() + ")"); //$NON-NLS-1$
+ String[] ees = bundleDescription.getExecutionEnvironments();
+ for (String ee : ees) {
+ sb.append(ee + " "); //$NON-NLS-1$
+ // $NON-NLS-1$
+ }
sb.append("\n"); //$NON-NLS-1$
}
sb.append("PlatformProperties:\n"); //$NON-NLS-1$
@SuppressWarnings("rawtypes")
Dictionary[] dics = state.getPlatformProperties();
- for (int i = 0; i < dics.length; i++) {
+ for (Dictionary dic : dics) {
// don't disable this warning because it will cause build-time warning.
// see bug 423628 and 423625.
- for (Enumeration<String> enumeration = dics[i].keys(); enumeration.hasMoreElements();) {
+ for (Enumeration<String> enumeration = dic.keys(); enumeration.hasMoreElements();) {
String key = enumeration.nextElement();
- String value = (String) dics[i].get(key);
+ String value = (String) dic.get(key);
sb.append(" (" + key + "," + value + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
@@ -705,10 +733,12 @@ public class EquinoxBundlesState implements BundlesState {
try {
Dictionary<String, String> manifest = Utils.getOSGiManifest(bInfo.getLocation());
if (manifest == null) {
- Log.log(LogService.LOG_WARNING, this, "uninstallBundle(BundleInfo)", NLS.bind(Messages.exception_bundleManifest, bInfo.getLocation())); //$NON-NLS-1$
+ Log.log(LogService.LOG_WARNING, this, "uninstallBundle(BundleInfo)", //$NON-NLS-1$
+ NLS.bind(Messages.exception_bundleManifest, bInfo.getLocation()));
return;
}
- BundleDescription bundleDescription = soFactory.createBundleDescription(state, manifest, realLocation.toString(), id);
+ BundleDescription bundleDescription = soFactory.createBundleDescription(state, manifest,
+ realLocation.toString(), id);
removeBundleFromState(bundleDescription);
manipulator.getConfigData().removeBundle(bInfo);
} catch (BundleException e) {
@@ -728,8 +758,8 @@ public class EquinoxBundlesState implements BundlesState {
}
/**
- * Returns a key for a bundle description containing the bundle name and version,
- * for use in the name/version state index map.
+ * Returns a key for a bundle description containing the bundle name and
+ * version, for use in the name/version state index map.
*/
private String getKey(BundleDescription bundle) {
return bundle.getSymbolicName() + ';' + bundle.getVersion();
@@ -737,10 +767,10 @@ public class EquinoxBundlesState implements BundlesState {
private void createStateIndexes() {
BundleDescription[] currentInstalledBundles = state.getBundles();
- for (int i = 0; i < currentInstalledBundles.length; i++) {
- URI location = FileUtils.getRealLocation(manipulator, currentInstalledBundles[i].getLocation());
- locationStateIndex.put(location, currentInstalledBundles[i]);
- nameVersionStateIndex.put(getKey(currentInstalledBundles[i]), currentInstalledBundles[i]);
+ for (BundleDescription currentInstalledBundle : currentInstalledBundles) {
+ URI location = FileUtils.getRealLocation(manipulator, currentInstalledBundle.getLocation());
+ locationStateIndex.put(location, currentInstalledBundle);
+ nameVersionStateIndex.put(getKey(currentInstalledBundle), currentInstalledBundle);
}
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java
index 1f6c76714..3cead4796 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java
@@ -99,16 +99,16 @@ public class EquinoxFwConfigFileParser {
BundleInfo[] fwExtensions = parseBundleList(manipulator, props.getProperty(EquinoxConstants.PROP_FW_EXTENSIONS));
if (fwExtensions != null) {
- for (int i = 0; i < fwExtensions.length; i++) {
- fwExtensions[i].setFragmentHost(Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
- configData.addBundle(fwExtensions[i]);
+ for (BundleInfo fwExtension : fwExtensions) {
+ fwExtension.setFragmentHost(Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
+ configData.addBundle(fwExtension);
}
}
BundleInfo[] bundles = parseBundleList(manipulator, props.getProperty(EquinoxConstants.PROP_BUNDLES));
if (bundles != null) {
- for (int i = 0; i < bundles.length; i++) {
- configData.addBundle(bundles[i]);
+ for (BundleInfo bundle : bundles) {
+ configData.addBundle(bundle);
}
}
}
@@ -119,10 +119,9 @@ public class EquinoxFwConfigFileParser {
List<BundleInfo> bundles = new ArrayList<>();
String[] bInfoStrings = Utils.getTokens(value, ","); //$NON-NLS-1$
- for (int i = 0; i < bInfoStrings.length; i++) {
- String entry = bInfoStrings[i].trim();
+ for (String bInfoString : bInfoStrings) {
+ String entry = bInfoString.trim();
entry = FileUtils.removeEquinoxSpecificProtocols(entry);
-
int indexStartInfo = entry.indexOf('@');
String location = (indexStartInfo == -1) ? entry : entry.substring(0, indexStartInfo);
URI realLocation = null;
@@ -136,10 +135,8 @@ public class EquinoxFwConfigFileParser {
}
}
String slAndFlag = (indexStartInfo > -1) ? entry.substring(indexStartInfo + 1) : null;
-
boolean markedAsStarted = getMarkedAsStartedFormat(slAndFlag);
int startLevel = getStartLevel(slAndFlag);
-
if (realLocation != null) {
bundles.add(new BundleInfo(realLocation, startLevel, markedAsStarted));
continue;
@@ -151,7 +148,6 @@ public class EquinoxFwConfigFileParser {
} catch (URISyntaxException e) {
//Ignore
}
-
//Fallback case, we use the location as a string
bundles.add(new BundleInfo(location, null, null, startLevel, markedAsStarted));
}
@@ -161,9 +157,7 @@ public class EquinoxFwConfigFileParser {
private void writeBundlesList(File fwJar, Properties props, BundleInfo[] bundles) {
StringBuilder osgiBundlesList = new StringBuilder();
StringBuilder osgiFrameworkExtensionsList = new StringBuilder();
- for (int j = 0; j < bundles.length; j++) {
- BundleInfo bundle = bundles[j];
-
+ for (BundleInfo bundle : bundles) {
//framework jar does not get stored on the bundle list, figure out who that is.
if (fwJar != null) {
if (URIUtil.sameURI(fwJar.toURI(), bundle.getLocation()))
@@ -586,12 +580,13 @@ public class EquinoxFwConfigFileParser {
private void canonicalizePathsForComparison(StringBuffer s) {
final String[] tokens = new String[] {"\\\\", "\\", "//", "/"}; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- for (int t = 0; t < tokens.length; t++) {
+ for (String token : tokens) {
int idx = s.length();
for (int i = s.length(); i != 0 && idx != -1; i--) {
- idx = s.toString().lastIndexOf(tokens[t], idx);
- if (idx != -1)
- s.replace(idx, idx + tokens[t].length(), "^"); //$NON-NLS-1$
+ idx = s.toString().lastIndexOf(token, idx);
+ if (idx != -1) {
+ s.replace(idx, idx + token.length(), "^"); //$NON-NLS-1$
+ }
}
}
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
index d570bdf8f..f982e3f25 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java
@@ -41,9 +41,9 @@ public class EquinoxManipulatorImpl implements Manipulator {
/**
* If the fwConfigLocation is a file and its name does not equal "config.ini",
- * throw an IllegaStateException.
- * If the fwConfigLocation is a file and its name equals "config.ini",
- * fwConfigLocation will be updated by its parent directory.
+ * throw an IllegaStateException. If the fwConfigLocation is a file and its name
+ * equals "config.ini", fwConfigLocation will be updated by its parent
+ * directory.
*
* Then, reset fwConfigLocation and fwPersistentDataLocation to be matched.
*
@@ -58,12 +58,15 @@ public class EquinoxManipulatorImpl implements Manipulator {
if (fwConfigLocation.getName().equals(EquinoxConstants.CONFIG_INI))
fwConfigLocation = fwConfigLocation.getParentFile();
else
- throw new IllegalStateException(NLS.bind(Messages.exception_unexpectedfwConfigLocation, fwConfigLocation.getAbsolutePath(), EquinoxConstants.CONFIG_INI));
+ throw new IllegalStateException(NLS.bind(Messages.exception_unexpectedfwConfigLocation,
+ fwConfigLocation.getAbsolutePath(), EquinoxConstants.CONFIG_INI));
launcherData.setFwConfigLocation(fwConfigLocation);
}
if (fwPersistentDataLocation != null) {
if (!fwConfigLocation.equals(fwPersistentDataLocation))
- throw new IllegalStateException(NLS.bind(Messages.exception_persistantLocationNotEqualConfigLocation, fwPersistentDataLocation.getAbsolutePath(), fwConfigLocation.getAbsolutePath()));
+ throw new IllegalStateException(
+ NLS.bind(Messages.exception_persistantLocationNotEqualConfigLocation,
+ fwPersistentDataLocation.getAbsolutePath(), fwConfigLocation.getAbsolutePath()));
} else
launcherData.setFwPersistentDataLocation(fwConfigLocation, launcherData.isClean());
} else {
@@ -80,7 +83,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
}
}
- //This returns the location of the <eclipse>.ini file
+ // This returns the location of the <eclipse>.ini file
static File getLauncherConfigLocation(LauncherData launcherData) {
File launcherIni = launcherData.getLauncherConfigLocation();
if (launcherIni != null)
@@ -106,8 +109,10 @@ public class EquinoxManipulatorImpl implements Manipulator {
return result;
}
- ConfigData configData = new ConfigData(EquinoxConstants.FW_NAME, EquinoxConstants.FW_VERSION, EquinoxConstants.LAUNCHER_NAME, EquinoxConstants.LAUNCHER_VERSION);
- EquinoxLauncherData launcherData = new EquinoxLauncherData(EquinoxConstants.FW_NAME, EquinoxConstants.FW_VERSION, EquinoxConstants.LAUNCHER_NAME, EquinoxConstants.LAUNCHER_VERSION);
+ ConfigData configData = new ConfigData(EquinoxConstants.FW_NAME, EquinoxConstants.FW_VERSION,
+ EquinoxConstants.LAUNCHER_NAME, EquinoxConstants.LAUNCHER_VERSION);
+ EquinoxLauncherData launcherData = new EquinoxLauncherData(EquinoxConstants.FW_NAME, EquinoxConstants.FW_VERSION,
+ EquinoxConstants.LAUNCHER_NAME, EquinoxConstants.LAUNCHER_VERSION);
BundleContext context = null;
private Properties platformProperties = new Properties();
@@ -117,14 +122,15 @@ public class EquinoxManipulatorImpl implements Manipulator {
private final PlatformAdmin platformAdmin;
private final StartLevel startLevelService;
- // private final boolean runtime;
+ // private final boolean runtime;
ConfiguratorManipulator configuratorManipulator;
EquinoxFwAdminImpl fwAdmin = null;
- @SuppressWarnings({"rawtypes", "unchecked"})
- EquinoxManipulatorImpl(BundleContext context, EquinoxFwAdminImpl fwAdmin, PlatformAdmin admin, StartLevel slService, boolean runtime) {
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ EquinoxManipulatorImpl(BundleContext context, EquinoxFwAdminImpl fwAdmin, PlatformAdmin admin, StartLevel slService,
+ boolean runtime) {
this.context = context;
this.fwAdmin = fwAdmin;
this.platformAdmin = admin;
@@ -133,13 +139,15 @@ public class EquinoxManipulatorImpl implements Manipulator {
cmTracker = new ServiceTracker(context, ConfiguratorManipulator.class.getName(), null);
cmTracker.open();
}
- // this.runtime = runtime;
+ // this.runtime = runtime;
if (runtime)
initializeRuntime();
// XXX For Equinox, default value of Initial Bundle Start Level is 4.
// Precisely speaking, it's not correct.
- // Equinox doesn't support setting initial bundle start level as an OSGi terminology.
- // Only bundles installed by config.ini and updateconfigurator will have that start level(4).
+ // Equinox doesn't support setting initial bundle start level as an OSGi
+ // terminology.
+ // Only bundles installed by config.ini and updateconfigurator will have that
+ // start level(4).
// Others has a start level of 1.
configData.setInitialBundleStartLevel(4);
}
@@ -154,7 +162,9 @@ public class EquinoxManipulatorImpl implements Manipulator {
if (platformProperties.isEmpty())
return new EquinoxBundlesState(context, fwAdmin, this, platformAdmin, false);
- // XXX checking if fwDependent or fwIndependent platformProperties are updated after the platformProperties was created might be required for better implementation.
+ // XXX checking if fwDependent or fwIndependent platformProperties are updated
+ // after the platformProperties was created might be required for better
+ // implementation.
return new EquinoxBundlesState(context, fwAdmin, this, platformAdmin, platformProperties);
}
@@ -165,7 +175,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
@Override
public BundleInfo[] getExpectedState() throws IllegalArgumentException, FrameworkAdminRuntimeException {
- //Log.log(LogService.LOG_DEBUG, this, "getExpectedState()", "BEGIN");
+ // Log.log(LogService.LOG_DEBUG, this, "getExpectedState()", "BEGIN");
SimpleBundlesState.checkAvailability(fwAdmin);
BundlesState bundleState = this.getBundlesState();
@@ -186,7 +196,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
*
* @see Location
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
+ @SuppressWarnings({ "rawtypes", "unchecked" })
private File getRunningConfigurationLocation() {
ServiceTracker tracker = null;
Filter filter = null;
@@ -229,10 +239,11 @@ public class EquinoxManipulatorImpl implements Manipulator {
private Properties getRunningPlatformProperties() {
Properties props = new Properties();
- for (int i = 0; i < EquinoxBundlesState.PROPS.length; i++) {
- String value = context.getProperty(EquinoxBundlesState.PROPS[i]);
- if (value != null)
- props.setProperty(EquinoxBundlesState.PROPS[i], value);
+ for (String property : EquinoxBundlesState.PROPS) {
+ String value = context.getProperty(property);
+ if (value != null) {
+ props.setProperty(property, value);
+ }
}
return props;
}
@@ -273,13 +284,15 @@ public class EquinoxManipulatorImpl implements Manipulator {
}
private void initializeRuntime() {
- //TODO refine the implementation. using some MAGIC dependent on Eclipse.exe and Equinox implementation,
+ // TODO refine the implementation. using some MAGIC dependent on Eclipse.exe and
+ // Equinox implementation,
// set parameters according to the current running fw.
// 1. retrieve location data from Location services registered by equinox fw.
String fwJarLocation = context.getProperty(EquinoxConstants.PROP_OSGI_FW);
if (!fwJarLocation.startsWith("file:")) //$NON-NLS-1$
- throw new IllegalStateException(NLS.bind(Messages.exception_fileURLExpected, EquinoxConstants.PROP_OSGI_FW, fwJarLocation));
+ throw new IllegalStateException(
+ NLS.bind(Messages.exception_fileURLExpected, EquinoxConstants.PROP_OSGI_FW, fwJarLocation));
File fwJar = new File(fwJarLocation.substring("file:".length())); //$NON-NLS-1$
File fwConfigLocation = getRunningConfigurationLocation();
File launcherFile = getRunningLauncherFile();
@@ -300,12 +313,18 @@ public class EquinoxManipulatorImpl implements Manipulator {
Bundle[] bundles = context.getBundles();
BundleInfo[] bInfos = new BundleInfo[bundles.length];
for (int i = 0; i < bundles.length; i++) {
- // System.out.println("bundles[" + i + "]=" + bundles[i]);
+ // System.out.println("bundles[" + i + "]=" + bundles[i]);
try {
if (bundles[i].getBundleId() == 0) // SystemBundle
- bInfos[i] = new BundleInfo(bundles[i].getSymbolicName(), bundles[i].getHeaders("").get(Constants.BUNDLE_VERSION), FileLocator.getBundleFile(bundles[i]).getAbsoluteFile().toURI(), -1, true); //$NON-NLS-1$
+ bInfos[i] = new BundleInfo(bundles[i].getSymbolicName(),
+ bundles[i].getHeaders("").get(Constants.BUNDLE_VERSION), //$NON-NLS-1$
+ FileLocator.getBundleFile(bundles[i]).getAbsoluteFile().toURI(), -1, true);
else {
- bInfos[i] = new BundleInfo(bundles[i].getSymbolicName(), bundles[i].getHeaders("").get(Constants.BUNDLE_VERSION), FileLocator.getBundleFile(bundles[i]).getAbsoluteFile().toURI(), startLevel.getBundleStartLevel(bundles[i]), startLevel.isBundlePersistentlyStarted(bundles[i])); //$NON-NLS-1$
+ bInfos[i] = new BundleInfo(bundles[i].getSymbolicName(),
+ bundles[i].getHeaders("").get(Constants.BUNDLE_VERSION), //$NON-NLS-1$
+ FileLocator.getBundleFile(bundles[i]).getAbsoluteFile().toURI(),
+ startLevel.getBundleStartLevel(bundles[i]),
+ startLevel.isBundlePersistentlyStarted(bundles[i]));
}
} catch (IOException e) {
e.printStackTrace();
@@ -344,8 +363,8 @@ public class EquinoxManipulatorImpl implements Manipulator {
platformProperties.clear();
}
updateAccordingToExpectedState(bundlesState);
- // if (!useConfigurator)
- // return;
+ // if (!useConfigurator)
+ // return;
setConfiguratorManipulator();
if (this.configuratorManipulator == null)
return;
@@ -370,7 +389,8 @@ public class EquinoxManipulatorImpl implements Manipulator {
try {
parser.readFwConfig(this, fwConfigFile);
} catch (URISyntaxException e) {
- throw new FrameworkAdminRuntimeException(e, NLS.bind(Messages.exception_errorReadingFile, fwConfigFile.getAbsolutePath()));
+ throw new FrameworkAdminRuntimeException(e,
+ NLS.bind(Messages.exception_errorReadingFile, fwConfigFile.getAbsolutePath()));
}
}
@@ -441,24 +461,25 @@ public class EquinoxManipulatorImpl implements Manipulator {
this.configData.setInitialBundleStartLevel(configData.getInitialBundleStartLevel());
this.configData.setBeginningFwStartLevel(configData.getBeginingFwStartLevel());
BundleInfo[] bInfos = configData.getBundles();
- for (int i = 0; i < bInfos.length; i++)
- this.configData.addBundle(bInfos[i]);
+ for (BundleInfo bInfo : bInfos) {
+ this.configData.addBundle(bInfo);
+ }
this.configData.setProperties(configData.getProperties());
if (this.configData.getFwName().equals(configData.getFwName()))
if (this.configData.getFwVersion().equals(configData.getFwVersion())) {
// TODO refine the algorithm to copying fw dependent props.
- // configData.getFwName()/getFwVersion()/
- // getLauncherName()/getLauncherVersion() might be taken into consideration.
+ // configData.getFwName()/getFwVersion()/
+ // getLauncherName()/getLauncherVersion() might be taken into consideration.
this.configData.setProperties(configData.getProperties());
}
}
/**
- * 1. get all ServiceReferences of ConfiguratorManipulator.
- * 2. Check if there any ConfiguratorBundle in the Bundles list that can be manipulated by
- * the available ConfiguratorManipulators.
- * 3. Choose the one that will be firstly started among them.
- * 4. set the object that corresponds to the chosen ConfiguratorBundle.
+ * 1. get all ServiceReferences of ConfiguratorManipulator. 2. Check if there
+ * any ConfiguratorBundle in the Bundles list that can be manipulated by the
+ * available ConfiguratorManipulators. 3. Choose the one that will be firstly
+ * started among them. 4. set the object that corresponds to the chosen
+ * ConfiguratorBundle.
*
*/
@SuppressWarnings("unchecked")
@@ -471,26 +492,30 @@ public class EquinoxManipulatorImpl implements Manipulator {
if (references == null)
return null;
- // int count = cmTracker.getTrackingCount();
- // if (count == this.trackingCount)
- // return;
- // this.trackingCount = count;
+ // int count = cmTracker.getTrackingCount();
+ // if (count == this.trackingCount)
+ // return;
+ // this.trackingCount = count;
BundleInfo[] bInfos = configData.getBundles();
int initialBSL = configData.getInitialBundleStartLevel();
bInfos = Utils.sortBundleInfos(bInfos, initialBSL);
- //int index = -1;
+ // int index = -1;
ConfiguratorManipulator previousConfiguratorManipulator = configuratorManipulator;
configuratorManipulator = null;
- for (int i = 0; i < bInfos.length; i++) {
- URI location = bInfos[i].getLocation();
- if (!bInfos[i].isMarkedAsStarted())
+ for (BundleInfo bInfo : bInfos) {
+ URI location = bInfo.getLocation();
+ if (!bInfo.isMarkedAsStarted()) {
continue;
- for (int j = 0; j < references.length; j++)
- if (references[j].getProperty(ConfiguratorManipulator.SERVICE_PROP_KEY_CONFIGURATOR_BUNDLESYMBOLICNAME).equals(Utils.getPathFromClause(Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME)))) {
- configuratorManipulator = (ConfiguratorManipulator) cmTracker.getService(references[j]);
+ }
+ for (ServiceReference<?> reference : references) {
+ if (reference.getProperty(ConfiguratorManipulator.SERVICE_PROP_KEY_CONFIGURATOR_BUNDLESYMBOLICNAME)
+ .equals(Utils.getPathFromClause(
+ Utils.getManifestMainAttributes(location, Constants.BUNDLE_SYMBOLICNAME)))) {
+ configuratorManipulator = (ConfiguratorManipulator) cmTracker.getService(reference);
break;
}
+ }
if (configuratorManipulator != null)
break;
}
@@ -510,8 +535,8 @@ public class EquinoxManipulatorImpl implements Manipulator {
if (launcherData.getFwName().equals(value.getFwName()))
if (launcherData.getFwVersion().equals(value.getFwVersion())) {
// TODO launcherData.getFwName()/getFwVersion()/
- // getLauncherName()/getLauncherVersion() might be taken into consideration
- // for copying .
+ // getLauncherName()/getLauncherVersion() might be taken into consideration
+ // for copying .
launcherData.setFwJar(value.getFwJar());
launcherData.setHome(value.getHome());
launcherData.setLauncher(value.getLauncher());
@@ -522,12 +547,13 @@ public class EquinoxManipulatorImpl implements Manipulator {
/**
* Temporal implementation.
*
- * If a property of the given key should be eliminated
- * from FwDependentProperties and FwIndependentProperties,
- * return true. Otherwise false.
+ * If a property of the given key should be eliminated from
+ * FwDependentProperties and FwIndependentProperties, return true. Otherwise
+ * false.
*
* @param key
- * @return true if it should be elimineted from FwDependentProperties and FwIndependentProperties,
+ * @return true if it should be elimineted from FwDependentProperties and
+ * FwIndependentProperties,
*/
private boolean toBeEliminated(String key) {
if (key.startsWith("java.")) //$NON-NLS-1$
@@ -549,12 +575,12 @@ public class EquinoxManipulatorImpl implements Manipulator {
}
private void updateAccordingToExpectedState(BundlesState bundlesState) {
- // File newFwJar = EquinoxBundlesState.getFwJar(launcherData, configData);
- // if (bundlesState instanceof EquinoxBundlesState)
- // ((EquinoxBundlesState) bundlesState).setFwJar(newFwJar);
+ // File newFwJar = EquinoxBundlesState.getFwJar(launcherData, configData);
+ // if (bundlesState instanceof EquinoxBundlesState)
+ // ((EquinoxBundlesState) bundlesState).setFwJar(newFwJar);
//
- // if (launcherData.getFwJar() == null && newFwJar != null)
- // launcherData.setFwJar(newFwJar);
+ // if (launcherData.getFwJar() == null && newFwJar != null)
+ // launcherData.setFwJar(newFwJar);
BundleInfo[] newBundleInfos = bundlesState.getExpectedState();
configData.setBundles(newBundleInfos);
}
@@ -565,7 +591,7 @@ public class EquinoxManipulatorImpl implements Manipulator {
if (!path.isAbsolute())
return original;
- //Returns the original string if no relativization has been done
+ // Returns the original string if no relativization has been done
IPath result = path.makeRelativeTo(new Path(rootPath));
return path.equals(result) ? original : result.toString();
}
@@ -597,7 +623,8 @@ public class EquinoxManipulatorImpl implements Manipulator {
IPath two = new Path(rootString.substring(rootString.indexOf(FILE_PROTOCOL) + 5));
String deviceOne = one.getDevice();
String deviceTwo = two.getDevice();
- // do checking here because we want to return the exact string we got initially if
+ // do checking here because we want to return the exact string we got initially
+ // if
// we are unable to make it relative.
if (deviceOne != deviceTwo && (deviceOne == null || !deviceOne.equalsIgnoreCase(two.getDevice())))
return urlString;
@@ -630,8 +657,8 @@ public class EquinoxManipulatorImpl implements Manipulator {
}
/*
- * Make the given path absolute to the specified root, if applicable. If not, then
- * return the path as-is.
+ * Make the given path absolute to the specified root, if applicable. If not,
+ * then return the path as-is.
*
* TODO: can we use URIUtil in these #make* methods?
*/
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java
index 4a5b08258..ae1764f90 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java
@@ -145,28 +145,25 @@ public class FileUtils {
File result = null;
Version maxVersion = null;
- for (int i = 0; i < candidates.length; i++) {
- String candidateName = candidates[i].getName();
+ for (File candidate : candidates) {
+ String candidateName = candidate.getName();
if (!candidateName.startsWith(pluginName))
continue;
-
if (candidateName.length() > pluginName.length() && candidateName.charAt(pluginName.length()) != '_') {
// allow jar file with no _version tacked on the end
- if (!candidates[i].isFile() || (candidateName.length() != 4 + pluginName.length()) || !candidateName.endsWith(".jar")) //$NON-NLS-1$
+ if (!candidate.isFile() || (candidateName.length() != 4 + pluginName.length()) || !candidateName.endsWith(".jar")) {
continue;
+ }
}
-
String candidateVersion = ""; //$NON-NLS-1$
if (candidateName.length() > pluginName.length() + 1 && candidateName.charAt(pluginName.length()) == '_')
candidateVersion = candidateName.substring(pluginName.length() + 1);
-
Version currentVersion = getVersion(candidateVersion);
if (currentVersion == null)
continue;
-
if (maxVersion == null || maxVersion.compareTo(currentVersion) < 0) {
maxVersion = currentVersion;
- result = candidates[i];
+ result = candidate;
}
}
return result != null ? result.getAbsoluteFile().toURI() : null;

Back to the top