From 133e82412ac9c6bcdc06ca1ac5b7faa0e7c7ceb7 Mon Sep 17 00:00:00 2001 From: Krzysztof Daniel Date: Mon, 9 Dec 2013 17:30:50 +0100 Subject: bug 418662 - Get rid of compile warnings in official build:org.eclipse.equinox.frameworkadmin.equinox Change-Id: Ic38817e9e77b7caa67372b650bd78cf4d2591c26 Signed-off-by: Krzysztof Daniel --- .../equinox/EclipseLauncherImpl.java | 2 +- .../equinox/EclipseLauncherParser.java | 54 +++++++++++----------- .../equinox/EquinoxBundlesState.java | 49 +++++++++++--------- .../frameworkadmin/equinox/EquinoxFwAdminImpl.java | 4 +- .../equinox/EquinoxFwConfigFileParser.java | 12 ++--- .../equinox/EquinoxManipulatorImpl.java | 10 ++-- .../internal/frameworkadmin/equinox/Log.java | 19 ++++---- .../frameworkadmin/equinox/ParserUtils.java | 28 +++++------ .../frameworkadmin/equinox/utils/FileUtils.java | 6 +-- 9 files changed, 97 insertions(+), 87 deletions(-) (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox') 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 8058023d9..49b774a31 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 @@ -62,7 +62,7 @@ public class EclipseLauncherImpl { Utils.checkAbsoluteFile(launcherData.getFwJar(), "fwJar"); //$NON-NLS-1$ Utils.checkAbsoluteDir(cwd, "cwd"); //$NON-NLS-1$ - List cmdList = new LinkedList(); + List cmdList = new LinkedList(); if (launcherData.getJvm() != null) cmdList.add(launcherData.getJvm().getAbsolutePath()); else 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 8daad28df..87c22c4f3 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 @@ -29,7 +29,7 @@ public class EclipseLauncherParser { public static final String MACOSX_BUNDLED = "macosx-bundled"; //$NON-NLS-1$ //this figures out the location of the data area on partial data read from the .ini - private URI getOSGiInstallArea(List lines, URI base, LauncherData launcherData) { + private URI getOSGiInstallArea(List lines, URI base, LauncherData launcherData) { //does the eclipse.ini say anything for osgi.install.area? File osgiInstallArea = ParserUtils.getOSGiInstallArea(lines, null, base); if (osgiInstallArea == null) { @@ -41,7 +41,7 @@ public class EclipseLauncherParser { return null; } - private void setInstall(List lines, LauncherData launcherData, File launcherFolder) { + private void setInstall(List lines, LauncherData launcherData, File launcherFolder) { if (launcherData.getFwConfigLocation() == null || launcherData.getFwJar() == null) { ParserUtils.removeArgument(EquinoxConstants.OPTION_INSTALL, lines); return; @@ -62,7 +62,7 @@ public class EclipseLauncherParser { if (!launcherConfigFile.exists()) return; - List lines = FileUtils.loadFile(launcherConfigFile); + List lines = FileUtils.loadFile(launcherConfigFile); URI launcherFolder = launcherData.getLauncher().getParentFile().toURI(); getStartup(lines, launcherFolder); @@ -83,7 +83,7 @@ public class EclipseLauncherParser { Log.log(LogService.LOG_INFO, NLS.bind(Messages.log_configFile, launcherConfigFile.getAbsolutePath())); } - private void getFrameworkJar(List lines, URI launcherFolder, LauncherData launcherData) { + private void getFrameworkJar(List lines, URI launcherFolder, LauncherData launcherData) { File fwJar = launcherData.getFwJar(); if (fwJar != null) return; @@ -92,14 +92,14 @@ public class EclipseLauncherParser { launcherData.setFwJar(URIUtil.toFile(location)); } - private void getPersistentDataLocation(List lines, URI osgiInstallArea, URI configArea, LauncherData launcherData) { + private void getPersistentDataLocation(List lines, URI osgiInstallArea, URI configArea, LauncherData launcherData) { //TODO The setting of the -clean could only do properly once config.ini has been read if (launcherData.getFwPersistentDataLocation() == null) { launcherData.setFwPersistentDataLocation(URIUtil.toFile(configArea), ParserUtils.isArgumentSet(EquinoxConstants.OPTION_CLEAN, lines)); } } - private void getVM(List lines, URI launcherFolder, LauncherData launcherData) { + private void getVM(List lines, URI launcherFolder, LauncherData launcherData) { String vm = ParserUtils.getValueForArgument(EquinoxConstants.OPTION_VM, lines); if (vm == null) return; @@ -115,7 +115,7 @@ public class EclipseLauncherParser { } } - private void setVM(List lines, File vm, URI launcherFolder) { + private void setVM(List lines, File vm, URI launcherFolder) { if (vm == null) { if (ParserUtils.getValueForArgument(EquinoxConstants.OPTION_VM, lines) != null) return; @@ -140,11 +140,11 @@ public class EclipseLauncherParser { ParserUtils.setValueForArgument(EquinoxConstants.OPTION_VM, FileUtils.toPath(vmRelativePath).replace('\\', '/'), lines); } - private void getJVMArgs(List lines, LauncherData launcherData) { - ArrayList vmargs = new ArrayList(lines.size()); + private void getJVMArgs(List lines, LauncherData launcherData) { + ArrayList vmargs = new ArrayList(lines.size()); boolean foundVmArgs = false; - for (Iterator iterator = lines.iterator(); iterator.hasNext();) { - String line = (String) iterator.next(); + for (Iterator iterator = lines.iterator(); iterator.hasNext();) { + String line = iterator.next(); if (!foundVmArgs) { if (EquinoxConstants.OPTION_VMARGS.equals(line)) foundVmArgs = true; @@ -154,10 +154,10 @@ public class EclipseLauncherParser { } launcherData.setJvmArgs(null); - launcherData.setJvmArgs((String[]) vmargs.toArray(new String[vmargs.size()])); + launcherData.setJvmArgs(vmargs.toArray(new String[vmargs.size()])); } - private void setJVMArgs(List lines, LauncherData launcherData) { + private void setJVMArgs(List lines, LauncherData launcherData) { ParserUtils.removeArgument(EquinoxConstants.OPTION_VMARGS, lines); if (launcherData.getJvmArgs() == null || launcherData.getJvmArgs().length == 0) return; @@ -168,19 +168,19 @@ public class EclipseLauncherParser { } } - private void getProgramArgs(List lines, LauncherData launcherData) { - ArrayList args = new ArrayList(lines.size()); - for (Iterator iterator = lines.iterator(); iterator.hasNext();) { - String line = (String) iterator.next(); + private void getProgramArgs(List lines, LauncherData launcherData) { + ArrayList args = new ArrayList(lines.size()); + for (Iterator iterator = lines.iterator(); iterator.hasNext();) { + String line = iterator.next(); if (EquinoxConstants.OPTION_VMARGS.equals(line)) break; args.add(line); } launcherData.setProgramArgs(null); - launcherData.setProgramArgs((String[]) args.toArray(new String[args.size()])); + launcherData.setProgramArgs(args.toArray(new String[args.size()])); } - private URI getLauncherLibrary(List lines, URI launcherFolder) { + private URI getLauncherLibrary(List lines, URI launcherFolder) { String launcherLibrary = ParserUtils.getValueForArgument(EquinoxConstants.OPTION_LAUNCHER_LIBRARY, lines); if (launcherLibrary == null) return null; @@ -195,7 +195,7 @@ public class EclipseLauncherParser { return result; } - private void setLauncherLibrary(List lines, URI launcherFolder) { + private void setLauncherLibrary(List lines, URI launcherFolder) { String launcherLibrary = ParserUtils.getValueForArgument(EquinoxConstants.OPTION_LAUNCHER_LIBRARY, lines); if (launcherLibrary == null) return; @@ -209,7 +209,7 @@ public class EclipseLauncherParser { } } - private URI getConfigurationLocation(List lines, URI osgiInstallArea, LauncherData data) { + private URI getConfigurationLocation(List lines, URI osgiInstallArea, LauncherData data) { String configuration = ParserUtils.getValueForArgument(EquinoxConstants.OPTION_CONFIGURATION, lines); if (configuration == null) try { @@ -230,7 +230,7 @@ public class EclipseLauncherParser { return result; } - private void setConfigurationLocation(List lines, URI osgiInstallArea, LauncherData data) { + private void setConfigurationLocation(List lines, URI osgiInstallArea, LauncherData data) { String result = FileUtils.toPath(URIUtil.makeRelative(data.getFwConfigLocation().toURI(), osgiInstallArea)); //We don't write the default if (CONFIGURATION_FOLDER.equals(result)) { @@ -245,7 +245,7 @@ public class EclipseLauncherParser { return; } - private URI getStartup(List lines, URI launcherFolder) { + private URI getStartup(List lines, URI launcherFolder) { String startup = ParserUtils.getValueForArgument(EquinoxConstants.OPTION_STARTUP, lines); if (startup == null) return null; @@ -261,7 +261,7 @@ public class EclipseLauncherParser { return result; } - private void setStartup(List lines, URI launcherFolder) { + private void setStartup(List lines, URI launcherFolder) { String startup = ParserUtils.getValueForArgument(EquinoxConstants.OPTION_STARTUP, lines); if (startup == null) return; @@ -285,7 +285,7 @@ public class EclipseLauncherParser { } //Tweak all the values to make them relative File launcherFolder = launcherData.getLauncher().getParentFile(); - List newlines = new ArrayList(); + List newlines = new ArrayList(); newlines.addAll(Arrays.asList(launcherData.getProgramArgs())); setStartup(newlines, launcherFolder.toURI()); @@ -300,7 +300,7 @@ public class EclipseLauncherParser { //We are done, let's update the program args in the launcher data launcherData.setProgramArgs(null); - launcherData.setProgramArgs((String[]) newlines.toArray(new String[newlines.size()])); + launcherData.setProgramArgs(newlines.toArray(new String[newlines.size()])); //append jvm args setJVMArgs(newlines, launcherData); @@ -320,7 +320,7 @@ public class EclipseLauncherParser { try { bw = new BufferedWriter(new FileWriter(launcherConfigFile)); for (int j = 0; j < newlines.size(); j++) { - String arg = (String) newlines.get(j); + String arg = newlines.get(j); if (arg == null) continue; bw.write(arg); 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 1a8574478..b7a886b6f 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 @@ -32,6 +32,7 @@ public class EquinoxBundlesState implements BundlesState { // this internally to be x86_64. 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$ static boolean checkFullySupported() { @@ -159,11 +160,12 @@ public class EquinoxBundlesState implements BundlesState { // "osgi.os", "osgi.ws", "osgi.nl", "osgi.arch", // Constants.FRAMEWORK_SYSTEMPACKAGES, "osgi.resolverMode", // Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "osgi.resolveOptional" + @SuppressWarnings("deprecation") private Properties setDefaultPlatformProperties() { Properties platformProperties = new Properties(); // set default value - ServiceReference environmentRef = context.getServiceReference(EnvironmentInfo.class); + ServiceReference environmentRef = context.getServiceReference(EnvironmentInfo.class); EnvironmentInfo environment = environmentRef == null ? null : (EnvironmentInfo) context.getService(environmentRef); if (environment != null) { try { @@ -209,15 +211,15 @@ public class EquinoxBundlesState implements BundlesState { State state = null; /** - * Map of String->BundleDescription, where the key is the bundle location. + * Map of URI->BundleDescription, where the key is the bundle location. */ - private HashMap locationStateIndex = new HashMap(); + private HashMap locationStateIndex = new HashMap(); /** * Map of String->BundleDescription, where the key is the bundle name * and version as defined by the {@link #getKey(BundleDescription)} method. */ - private HashMap nameVersionStateIndex = new HashMap(); + private HashMap nameVersionStateIndex = new HashMap(); private final PlatformAdmin platformAdmin; /** @@ -307,7 +309,7 @@ public class EquinoxBundlesState implements BundlesState { * @throws IllegalArgumentException * @throws FrameworkAdminRuntimeException */ - private boolean composeState(BundleInfo[] bInfos, Dictionary props, File fwPersistentDataLocation) throws IllegalArgumentException, FrameworkAdminRuntimeException { + private boolean composeState(BundleInfo[] bInfos, Dictionary props, File fwPersistentDataLocation) throws IllegalArgumentException, FrameworkAdminRuntimeException { BundleInfo[] infos = manipulator.getConfigData().getBundles(); this.manipulator.getConfigData().setBundles(null); SimpleBundlesState.checkAvailability(fwAdmin); @@ -411,7 +413,7 @@ public class EquinoxBundlesState implements BundlesState { public BundleInfo[] convertState(BundleDescription[] bundles) { BundleInfo[] originalBInfos = manipulator.getConfigData().getBundles(); - Map bundleInfoMap = new HashMap(); + Map bundleInfoMap = new HashMap(); for (int i = 0; i < originalBInfos.length; i++) { bundleInfoMap.put(originalBInfos[i].getLocation(), originalBInfos[i]); } @@ -436,7 +438,7 @@ public class EquinoxBundlesState implements BundlesState { throw new IllegalStateException("BundleDescription conversion problem" + e.getMessage()); //$NON-NLS-1$ //TODO path_fun } String fragmentHost = null; - BundleInfo original = (BundleInfo) bundleInfoMap.get(location); + BundleInfo original = bundleInfoMap.get(location); if (original != null) { markedAsStarted = original.isMarkedAsStarted(); sl = getStartLevel(original.getStartLevel()); @@ -457,7 +459,7 @@ public class EquinoxBundlesState implements BundlesState { } public BundleInfo[] getPrerequisteBundles(BundleInfo bInfo) { - Set set = new HashSet(); + Set set = new HashSet(); URI realLocation = bInfo.getLocation(); BundleDescription bundle = getBundleByLocation(realLocation); ImportPackageSpecification[] imports = bundle.getImportPackages(); @@ -550,15 +552,15 @@ public class EquinoxBundlesState implements BundlesState { if (getBundleByLocation(realLocation) != null) return; - Dictionary manifest = Utils.getOSGiManifest(realLocation); + Dictionary manifest = Utils.getOSGiManifest(realLocation); if (manifest == null) return; - String newSymbolicName = (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME); + String newSymbolicName = manifest.get(Constants.BUNDLE_SYMBOLICNAME); int position = newSymbolicName.indexOf(";"); //$NON-NLS-1$ if (position >= 0) newSymbolicName = newSymbolicName.substring(0, position).trim(); - String newVersion = (String) manifest.get(Constants.BUNDLE_VERSION); + String newVersion = manifest.get(Constants.BUNDLE_VERSION); if (getBundleByNameVersion(newSymbolicName, newVersion) != null) return; @@ -603,11 +605,12 @@ public class EquinoxBundlesState implements BundlesState { * @param state */ private void setPlatformProperties(State state) { - Dictionary platformProperties = state.getPlatformProperties()[0]; + @SuppressWarnings("unchecked") + Dictionary platformProperties = state.getPlatformProperties()[0]; platfromProperties.clear(); if (platformProperties != null) { - for (Enumeration enumeration = platformProperties.keys(); enumeration.hasMoreElements();) { - String key = (String) enumeration.nextElement(); + for (Enumeration enumeration = platformProperties.keys(); enumeration.hasMoreElements();) { + String key = enumeration.nextElement(); Object value = platformProperties.get(key); platfromProperties.setProperty(key, (String) value); } @@ -620,12 +623,12 @@ public class EquinoxBundlesState implements BundlesState { * set platfromProperties required to compose state object into * platformProperties of this state. * - * @param props + * @param props2 */ - private void setPlatformPropertiesToState(Dictionary props) { + private void setPlatformPropertiesToState(Dictionary props) { Properties platformProperties = setDefaultPlatformProperties(); - for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) { + for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); for (int i = 0; i < PROPS.length; i++) { if (key.equals(PROPS[i])) { @@ -657,10 +660,12 @@ public class EquinoxBundlesState implements BundlesState { 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 (Enumeration enumeration = dics[i].keys(); enumeration.hasMoreElements();) { - String key = (String) enumeration.nextElement(); + for (@SuppressWarnings("unchecked") + Enumeration enumeration = dics[i].keys(); enumeration.hasMoreElements();) { + String key = enumeration.nextElement(); String value = (String) dics[i].get(key); sb.append(" (" + key + "," + value + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } @@ -679,7 +684,7 @@ public class EquinoxBundlesState implements BundlesState { if (id != DEFAULT_TIMESTAMP) { try { - Dictionary manifest = Utils.getOSGiManifest(bInfo.getLocation()); + Dictionary 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$ return; @@ -696,11 +701,11 @@ public class EquinoxBundlesState implements BundlesState { private BundleDescription getBundleByLocation(URI location) { if (location == null) return null; - return (BundleDescription) locationStateIndex.get(location); + return locationStateIndex.get(location); } private BundleDescription getBundleByNameVersion(String bundleSymbolicName, String bundleVersion) { - return (BundleDescription) nameVersionStateIndex.get(bundleSymbolicName + ";" + bundleVersion); //$NON-NLS-1$ + return nameVersionStateIndex.get(bundleSymbolicName + ";" + bundleVersion); //$NON-NLS-1$ } /** diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java index c23aa941d..9553849b1 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwAdminImpl.java @@ -102,8 +102,8 @@ public class EquinoxFwAdminImpl implements FrameworkAdmin { if (!"Eclipse".equals(fwVendor)) //$NON-NLS-1$ return false; //TODO decide if this version can be supported by this bundle. - Dictionary header = context.getBundle(0).getHeaders(); - String versionSt = (String) header.get(Constants.BUNDLE_VERSION); + Dictionary header = context.getBundle(0).getHeaders(); + String versionSt = header.get(Constants.BUNDLE_VERSION); Version version = new Version(versionSt); int value = version.compareTo(new Version(EquinoxConstants.FW_VERSION)); if (value > 0) { 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 3f7e4ffd8..a80c2754c 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 @@ -26,7 +26,7 @@ import org.osgi.framework.Constants; import org.osgi.service.log.LogService; public class EquinoxFwConfigFileParser { - private static final Set KNOWN_PROPERTIES = new HashSet(Arrays.asList(new String[] {EquinoxConstants.PROP_BUNDLES, EquinoxConstants.PROP_FW_EXTENSIONS, EquinoxConstants.PROP_INITIAL_STARTLEVEL, EquinoxConstants.PROP_BUNDLES_STARTLEVEL})); + private static final Set KNOWN_PROPERTIES = new HashSet(Arrays.asList(new String[] {EquinoxConstants.PROP_BUNDLES, EquinoxConstants.PROP_FW_EXTENSIONS, EquinoxConstants.PROP_INITIAL_STARTLEVEL, EquinoxConstants.PROP_BUNDLES_STARTLEVEL})); private static final String CONFIG_DIR = "@config.dir/"; //$NON-NLS-1$ private static final String KEY_ECLIPSE_PROV_DATA_AREA = "eclipse.p2.data.area"; //$NON-NLS-1$ private static final String KEY_ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR_CONFIGURL = "org.eclipse.equinox.simpleconfigurator.configUrl"; //$NON-NLS-1$ @@ -114,7 +114,7 @@ public class EquinoxFwConfigFileParser { if (value == null || value.length() == 0) return null; - List bundles = new ArrayList(); + List bundles = new ArrayList(); String[] bInfoStrings = Utils.getTokens(value, ","); //$NON-NLS-1$ for (int i = 0; i < bInfoStrings.length; i++) { String entry = bInfoStrings[i].trim(); @@ -152,7 +152,7 @@ public class EquinoxFwConfigFileParser { //Fallback case, we use the location as a string bundles.add(new BundleInfo(location, null, null, startLevel, markedAsStarted)); } - return (BundleInfo[]) bundles.toArray(new BundleInfo[bundles.size()]); + return bundles.toArray(new BundleInfo[bundles.size()]); } private void writeBundlesList(File fwJar, Properties props, BundleInfo[] bundles) { @@ -240,7 +240,7 @@ public class EquinoxFwConfigFileParser { readInitialStartLeve(configData, props); readDefaultStartLevel(configData, props); - for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) { + for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); if (KNOWN_PROPERTIES.contains(key)) continue; @@ -527,7 +527,7 @@ public class EquinoxFwConfigFileParser { Properties sharedConfigProperties = getSharedConfiguration(ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), configProps, launcherData), configProps.getProperty(EquinoxConstants.PROP_SHARED_CONFIGURATION_AREA)); if (sharedConfigProperties == null) return; - Enumeration keys = configProps.propertyNames(); + Enumeration keys = configProps.propertyNames(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); String sharedValue = sharedConfigProperties.getProperty(key); @@ -564,7 +564,7 @@ public class EquinoxFwConfigFileParser { if (bundles == null || sharedBundles == null || bundles.length != sharedBundles.length) return false; - List compareList = new ArrayList(Arrays.asList(bundles)); + List compareList = new ArrayList(Arrays.asList(bundles)); compareList.removeAll(Arrays.asList(sharedBundles)); return compareList.isEmpty(); } 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 57916d36f..f516d4da7 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 @@ -102,6 +102,7 @@ public class EquinoxManipulatorImpl implements Manipulator { BundleContext context = null; private Properties platformProperties = new Properties(); + @SuppressWarnings("rawtypes") ServiceTracker cmTracker; int trackingCount = -1; private final PlatformAdmin platformAdmin; @@ -113,6 +114,7 @@ public class EquinoxManipulatorImpl implements Manipulator { EquinoxFwAdminImpl fwAdmin = null; + @SuppressWarnings({"rawtypes", "unchecked"}) EquinoxManipulatorImpl(BundleContext context, EquinoxFwAdminImpl fwAdmin, PlatformAdmin admin, StartLevel slService, boolean runtime) { this.context = context; this.fwAdmin = fwAdmin; @@ -171,6 +173,7 @@ public class EquinoxManipulatorImpl implements Manipulator { * * @see Location */ + @SuppressWarnings({"rawtypes", "unchecked"}) private File getRunningConfigurationLocation() { ServiceTracker tracker = null; Filter filter = null; @@ -277,7 +280,7 @@ public class EquinoxManipulatorImpl implements Manipulator { } // 2. Create a Manipulator object fully initialized to the current running fw. - ServiceReference reference = context.getServiceReference(StartLevel.class.getName()); + ServiceReference reference = context.getServiceReference(StartLevel.class.getName()); StartLevel startLevel = (StartLevel) context.getService(reference); Bundle[] bundles = context.getBundles(); BundleInfo[] bInfos = new BundleInfo[bundles.length]; @@ -298,7 +301,7 @@ public class EquinoxManipulatorImpl implements Manipulator { // copy system properties to ConfigData Properties props = System.getProperties(); - for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) { + for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); String value = props.getProperty(key); if (toBeEliminated(key)) @@ -443,12 +446,13 @@ public class EquinoxManipulatorImpl implements Manipulator { * 4. set the object that corresponds to the chosen ConfiguratorBundle. * */ + @SuppressWarnings("unchecked") private ConfiguratorManipulator setConfiguratorManipulator() { if (context == null) { this.configuratorManipulator = this.fwAdmin.getConfiguratorManipulator(); return null; } - ServiceReference[] references = cmTracker.getServiceReferences(); + ServiceReference[] references = cmTracker.getServiceReferences(); if (references == null) return null; diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Log.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Log.java index e83b92058..ed23953fb 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Log.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/Log.java @@ -18,6 +18,7 @@ import org.osgi.util.tracker.ServiceTracker; /** * Utility class with static methods for logging to LogService, if available */ +@SuppressWarnings({"rawtypes", "unchecked"}) public class Log { static private ServiceTracker logTracker; static private boolean useLog = false; @@ -40,14 +41,14 @@ public class Log { public static void log(int level, Object obj, String method, String message, Throwable e) { LogService logService = null; - String msg = ""; + String msg = ""; //$NON-NLS-1$ if (method == null) { if (obj != null) - msg = "(" + obj.getClass().getName() + ")"; + msg = "(" + obj.getClass().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } else if (obj == null) - msg = "[" + method + "]" + message; + msg = "[" + method + "]" + message; //$NON-NLS-1$ //$NON-NLS-2$ else - msg = "[" + method + "](" + obj.getClass().getName() + ")"; + msg = "[" + method + "](" + obj.getClass().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ msg += message; if (logTracker != null) logService = (LogService) logTracker.getService(); @@ -57,17 +58,17 @@ public class Log { } else { String levelSt = null; if (level == LogService.LOG_DEBUG) - levelSt = "DEBUG"; + levelSt = "DEBUG"; //$NON-NLS-1$ else if (level == LogService.LOG_INFO) - levelSt = "INFO"; + levelSt = "INFO"; //$NON-NLS-1$ else if (level == LogService.LOG_WARNING) - levelSt = "WARNING"; + levelSt = "WARNING"; //$NON-NLS-1$ else if (level == LogService.LOG_ERROR) { - levelSt = "ERROR"; + levelSt = "ERROR"; //$NON-NLS-1$ useLog = true; } if (useLog) { - System.err.println("[" + levelSt + "]" + msg); + System.err.println("[" + levelSt + "]" + msg); //$NON-NLS-1$ //$NON-NLS-2$ if (e != null) e.printStackTrace(); } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java index 9626ad0d5..4080ffcb6 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java @@ -26,7 +26,7 @@ import org.osgi.service.log.LogService; public class ParserUtils { private static final String FILE_PROTOCOL = "file:"; //$NON-NLS-1$ - public static File getOSGiInstallArea(List programArgs, Properties properties, LauncherData launcherData) { + public static File getOSGiInstallArea(List programArgs, Properties properties, LauncherData launcherData) { if (launcherData == null) return null; @@ -66,7 +66,7 @@ public class ParserUtils { return null; } - public static URI getFrameworkJar(List lines, URI launcherFolder) { + public static URI getFrameworkJar(List lines, URI launcherFolder) { String fwk = ParserUtils.getValueForArgument(EquinoxConstants.OPTION_FW, lines); if (fwk == null) { //Search the file system using the default location @@ -84,7 +84,7 @@ public class ParserUtils { } //This method should only be used to determine the osgi install area when reading the eclipse.ini - public static File getOSGiInstallArea(List args, Properties properties, URI base) { + public static File getOSGiInstallArea(List args, Properties properties, URI base) { if (args == null) return null; String install = getValueForArgument(EquinoxConstants.OPTION_INSTALL, args); @@ -128,28 +128,28 @@ public class ParserUtils { return parentFolder.toFile(); } - public static boolean isArgumentSet(String arg, List args) { + public static boolean isArgumentSet(String arg, List args) { if (arg == null || args == null) return false; for (int i = 0; i < args.size(); i++) { if (args.get(i) == null) continue; - if (((String) args.get(i)).equalsIgnoreCase(arg)) { + if ((args.get(i)).equalsIgnoreCase(arg)) { return true; } } return false; } - public static String getValueForArgument(String arg, List args) { + public static String getValueForArgument(String arg, List args) { if (arg == null || args == null) return null; for (int i = 0; i < args.size(); i++) { if (args.get(i) == null) continue; - if (((String) args.get(i)).equalsIgnoreCase(arg)) { + if ((args.get(i)).equalsIgnoreCase(arg)) { if (i + 1 < args.size()) { - String value = (String) args.get(i + 1); + String value = args.get(i + 1); if (value != null && value.length() > 0 && value.charAt(0) != '-') return value; } @@ -158,17 +158,17 @@ public class ParserUtils { return null; } - public static boolean setValueForArgument(String arg, String value, List args) { + public static boolean setValueForArgument(String arg, String value, List args) { if (arg == null || args == null) return false; for (int i = 0; i < args.size(); i++) { if (args.get(i) == null) continue; - String currentArg = ((String) args.get(i)).trim(); + String currentArg = (args.get(i)).trim(); if (currentArg.equalsIgnoreCase(arg)) { if (i + 1 < args.size()) { - String nextArg = (String) args.get(i + 1); + String nextArg = args.get(i + 1); if (nextArg == null || nextArg.charAt(0) != '-') { args.set(i + 1, value); } else { @@ -186,16 +186,16 @@ public class ParserUtils { return true; } - public static boolean removeArgument(String arg, List args) { + public static boolean removeArgument(String arg, List args) { if (arg == null || args == null) return false; for (int i = 0; i < args.size(); i++) { if (args.get(i) == null) continue; - String currentArg = ((String) args.get(i)).trim(); + String currentArg = (args.get(i)).trim(); if (currentArg.equalsIgnoreCase(arg)) { args.set(i, null); - while (i + 1 < args.size() && args.get(i + 1) != null && ((String) args.get(i + 1)).charAt(0) != '-') { + while (i + 1 < args.size() && args.get(i + 1) != null && (args.get(i + 1)).charAt(0) != '-') { args.set(i + 1, null); i++; } 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 a74c4941d..7eed2d207 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 @@ -202,19 +202,19 @@ public class FileUtils { if (url.startsWith(FILE_PROTOCOL)) { return URIUtil.fromString(new File(url.substring(FILE_PROTOCOL.length())).isAbsolute() ? url : url.substring(FILE_PROTOCOL.length())); } - throw new URISyntaxException(url, "Not a file url"); + throw new URISyntaxException(url, "Not a file url"); //$NON-NLS-1$ } /** * Loads an ini file, returning a list of all non-blank lines in the file. */ - public static List loadFile(File file) throws IOException { + public static List loadFile(File file) throws IOException { BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); String line; - List list = new ArrayList(); + List list = new ArrayList(); while ((line = br.readLine()) != null) { //skip whitespace if (line.trim().length() > 0) -- cgit v1.2.3