Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2016-03-10 07:22:43 -0500
committerThomas Watson2016-10-07 10:15:35 -0400
commitaef99de034bb7f4bd88b5a0066fcd39d70a24a54 (patch)
tree554103dbd7615b62b0143766ef0c5c9953b6285a
parent29060df46ea548a78ff37feaf49672f2b372fdf6 (diff)
downloadrt.equinox.bundles-aef99de034bb7f4bd88b5a0066fcd39d70a24a54.tar.gz
rt.equinox.bundles-aef99de034bb7f4bd88b5a0066fcd39d70a24a54.tar.xz
rt.equinox.bundles-aef99de034bb7f4bd88b5a0066fcd39d70a24a54.zip
Bug 489330 - Technical debt issues : iteration on keySet
Change-Id: I629151b5d8f0bce9ce85a6af548e84aa46e98b6e Signed-off-by: Mickael Istria <mistria@redhat.com> Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java4
-rw-r--r--bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.console.ssh/pom.xml2
-rwxr-xr-xbundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java5
-rw-r--r--bundles/org.eclipse.equinox.metatype/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.metatype/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderTracker.java7
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java13
-rw-r--r--bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java6
-rw-r--r--bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.security.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java27
-rw-r--r--bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.security/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java10
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java10
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java10
-rw-r--r--bundles/org.eclipse.equinox.weaving.caching/src/org/eclipse/equinox/weaving/internal/caching/CacheWriter.java27
18 files changed, 72 insertions, 63 deletions
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
index fb5cbde0..5b62860d 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
@@ -310,9 +310,7 @@ public class Activator implements BundleActivator {
private static void closeURLTrackerServices() {
synchronized (urlTrackers) {
if (!urlTrackers.isEmpty()) {
- for (Iterator<String> iter = urlTrackers.keySet().iterator(); iter.hasNext();) {
- String key = iter.next();
- ServiceTracker<Object, URLConverter> tracker = urlTrackers.get(key);
+ for (ServiceTracker<Object, URLConverter> tracker : urlTrackers.values()) {
tracker.close();
}
urlTrackers = new HashMap<>();
diff --git a/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF
index 7b63965d..c146bdc1 100644
--- a/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.console.ssh/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: org.eclipse.equinox.console.ssh
-Bundle-Version: 1.0.100.qualifier
+Bundle-Version: 1.0.200.qualifier
Bundle-Activator: org.eclipse.equinox.console.ssh.Activator
Bundle-Vendor: %bundleVendor
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.console.ssh/pom.xml b/bundles/org.eclipse.equinox.console.ssh/pom.xml
index e24aee53..5df0e827 100644
--- a/bundles/org.eclipse.equinox.console.ssh/pom.xml
+++ b/bundles/org.eclipse.equinox.console.ssh/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.console.ssh</artifactId>
- <version>1.0.100-SNAPSHOT</version>
+ <version>1.0.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java
index f1f4839e..8d03064c 100755
--- a/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java
+++ b/bundles/org.eclipse.equinox.console.ssh/src/org/eclipse/equinox/console/ssh/SshShell.java
@@ -129,8 +129,9 @@ public class SshShell implements Command {
public void removeSession(SshSession session) {
CommandProcessor processorToRemove = null;
- for (CommandProcessor processor : commandProcessorToConsoleThreadMap.keySet()) {
- if (session.equals(commandProcessorToConsoleThreadMap.get(processor))) {
+ for (java.util.Map.Entry<CommandProcessor, SshSession> entry : commandProcessorToConsoleThreadMap.entrySet()) {
+ CommandProcessor processor = entry.getKey();
+ if (session.equals(entry.getValue())) {
processorToRemove = processor;
break;
}
diff --git a/bundles/org.eclipse.equinox.metatype/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.metatype/META-INF/MANIFEST.MF
index 2b9530dd..cab53578 100644
--- a/bundles/org.eclipse.equinox.metatype/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.metatype/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
-Bundle-Version: 1.4.200.qualifier
+Bundle-Version: 1.4.300.qualifier
Bundle-SymbolicName: org.eclipse.equinox.metatype
Bundle-Activator: org.eclipse.equinox.metatype.impl.Activator
Import-Package: javax.xml.parsers,
diff --git a/bundles/org.eclipse.equinox.metatype/pom.xml b/bundles/org.eclipse.equinox.metatype/pom.xml
index 1db2d5f4..338711d4 100644
--- a/bundles/org.eclipse.equinox.metatype/pom.xml
+++ b/bundles/org.eclipse.equinox.metatype/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.metatype</artifactId>
- <version>1.4.200-SNAPSHOT</version>
+ <version>1.4.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderTracker.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderTracker.java
index e01df9d5..71fcb495 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderTracker.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderTracker.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.metatype.impl;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.equinox.metatype.*;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
@@ -98,11 +99,11 @@ public class MetaTypeProviderTracker implements EquinoxMetaTypeInformation {
Map<ServiceReference<Object>, Object> services = _tracker.getTracked();
if (services.isEmpty())
return new MetaTypeProviderWrapper[0];
- Set<ServiceReference<Object>> serviceReferences = services.keySet();
Set<MetaTypeProviderWrapper> result = new HashSet<MetaTypeProviderWrapper>();
- for (ServiceReference<Object> serviceReference : serviceReferences) {
+ for (Entry<ServiceReference<Object>, Object> entry : services.entrySet()) {
+ ServiceReference<Object> serviceReference = entry.getKey();
if (serviceReference.getBundle() == _bundle) {
- Object service = services.get(serviceReference);
+ Object service = entry.getValue();
// If the service is not a MetaTypeProvider, we're not interested in it.
if (service instanceof MetaTypeProvider) {
// Include the METATYPE_PID, if present, to return as part of getPids(). Also, include the
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
index 05442fb3..8e89785c 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/PreferencesService.java
@@ -15,6 +15,7 @@ package org.eclipse.core.internal.preferences;
import java.io.*;
import java.lang.ref.WeakReference;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.internal.runtime.RuntimeLog;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.preferences.*;
@@ -236,9 +237,9 @@ public class PreferencesService implements IPreferencesService {
private Properties convertFromLegacy(Properties properties) {
Properties result = new Properties();
String prefix = IPath.SEPARATOR + InstanceScope.SCOPE + IPath.SEPARATOR;
- for (Iterator<?> i = properties.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- String value = properties.getProperty(key);
+ for (Entry<?, ?> entry : properties.entrySet()) {
+ String key = (String) entry.getKey();
+ String value = (String) entry.getValue();
if (value != null) {
int index = key.indexOf(IPath.SEPARATOR);
if (index == -1) {
@@ -260,9 +261,9 @@ public class PreferencesService implements IPreferencesService {
*/
private IExportedPreferences convertFromProperties(Properties properties) {
IExportedPreferences result = ExportedPreferences.newRoot();
- for (Iterator<?> i = properties.keySet().iterator(); i.hasNext();) {
- String path = (String) i.next();
- String value = properties.getProperty(path);
+ for (Entry<?, ?> entry : properties.entrySet()) {
+ String path = (String) entry.getKey();
+ String value = (String) entry.getValue();
if (path.charAt(0) == EXPORT_ROOT_PREFIX) {
ExportedPreferences current = (ExportedPreferences) result.node(path.substring(1));
current.setExportRoot();
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java
index e1f73f9f..1b51fd0d 100644
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java
@@ -12,6 +12,7 @@
package org.eclipse.equinox.internal.region;
import java.util.*;
+import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.equinox.internal.region.hook.*;
import org.eclipse.equinox.region.*;
@@ -285,8 +286,9 @@ public final class StandardRegionDigraph implements BundleIdToRegionMapping, Reg
}
this.regions.remove(region.getName());
this.edges.remove(region);
- for (Region r : this.edges.keySet()) {
- Set<FilteredRegion> edgeSet = this.edges.get(r);
+ for (Entry<Region, Set<FilteredRegion>> entry : edges.entrySet()) {
+ Region r = entry.getKey();
+ Set<FilteredRegion> edgeSet = entry.getValue();
for (FilteredRegion edge : edgeSet) {
if (region.equals(edge.getRegion())) {
Set<FilteredRegion> mutableEdgeSet = new HashSet<FilteredRegion>(edgeSet);
diff --git a/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
index 1f266113..e1fc5c82 100644
--- a/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.security.ui;singleton:=true
-Bundle-Version: 1.1.300.qualifier
+Bundle-Version: 1.1.400.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Import-Package: javax.crypto.spec,
diff --git a/bundles/org.eclipse.equinox.security.ui/pom.xml b/bundles/org.eclipse.equinox.security.ui/pom.xml
index b0087807..f1633636 100644
--- a/bundles/org.eclipse.equinox.security.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.security.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security.ui</artifactId>
- <version>1.1.300-SNAPSHOT</version>
+ <version>1.1.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java
index 11fccb07..6a501825 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 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
@@ -14,6 +14,7 @@ import java.io.PrintWriter;
import java.security.Provider;
import java.security.Security;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.ui.about.ISystemSummarySection;
public class SecurityConfigurationSection implements ISystemSummarySection {
@@ -59,23 +60,23 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
Map attributes = service.getAttributes();
if ((null != attributes) && (0 < attributes.size())) {
writer.println(" Attributes:"); //$NON-NLS-1$
- Set keys = attributes.keySet();
- for (Iterator it = keys.iterator(); it.hasNext();) {
- String key = (String) it.next();
+ for (Iterator it = attributes.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ String key = (String) entry.getKey();
writer.print(" " + key + ": "); //$NON-NLS-1$//$NON-NLS-2$
- writer.println((String) attributes.get(key));
+ writer.println((String) entry.getValue());
}
}
}
private static ProviderService[] getServices(Provider provider) {
- Set providerKeys = provider.keySet();
Hashtable serviceList = new Hashtable();
Hashtable attributeMap = new Hashtable(); // "type" => "Hashtable of (attribute,value) pairs"
Hashtable aliasMap = new Hashtable(); // "type" => "Arraylist of aliases"
- for (Iterator it = providerKeys.iterator(); it.hasNext();) {
- String key = (String) it.next();
+ for (Iterator it = provider.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ String key = (String) entry.getKey();
// this is provider info, available off the Provider API
if (key.startsWith(PROVIDER)) {
@@ -85,7 +86,7 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
// this is an alias
if (key.startsWith(ALG_ALIAS)) {
String value = key.substring(key.indexOf(ALG_ALIAS) + ALG_ALIAS.length(), key.length());
- String type = (String) provider.get(key);
+ String type = (String) entry.getValue();
String algo = value.substring(0, value.indexOf('.'));
String alias = value.substring(value.indexOf('.') + 1, value.length());
ArrayList aliasList = (ArrayList) aliasMap.get(type + '.' + algo);
@@ -121,13 +122,13 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
}
ProviderService[] serviceArray = new ProviderService[serviceList.size()];
- Set serviceKeys = serviceList.keySet();
int serviceCount = 0;
- for (Iterator it = serviceKeys.iterator(); it.hasNext();) {
- String key = (String) it.next();
+ for (Iterator it = serviceList.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ String key = (String) entry.getKey();
String type = key.substring(0, key.indexOf('.'));
String algo = key.substring(key.indexOf('.') + 1, key.length());
- String className = (String) serviceList.get(key);
+ String className = (String) entry.getValue();
List aliases = (List) aliasMap.get(algo);
Map attributes = (Map) attributeMap.get(key);
diff --git a/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
index fd24d493..f924ca65 100644
--- a/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.security;singleton:=true
-Bundle-Version: 1.2.200.qualifier
+Bundle-Version: 1.2.300.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.equinox.internal.security.auth.AuthPlugin
diff --git a/bundles/org.eclipse.equinox.security/pom.xml b/bundles/org.eclipse.equinox.security/pom.xml
index 449e6f33..3cfba0be 100644
--- a/bundles/org.eclipse.equinox.security/pom.xml
+++ b/bundles/org.eclipse.equinox.security/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security</artifactId>
- <version>1.2.200-SNAPSHOT</version>
+ <version>1.2.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java
index 73822c8a..4ec318ce 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 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
@@ -12,6 +12,7 @@ package org.eclipse.equinox.internal.security.storage;
import java.io.IOException;
import java.util.*;
+import java.util.Map.Entry;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import org.eclipse.core.runtime.IPath;
@@ -190,10 +191,11 @@ public class SecurePreferences {
thisNodePath = parentsPath + PATH_SEPARATOR + name;
if (values != null) {
- for (Iterator i = values.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
+ for (Iterator it = values.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ String key = (String) entry.getKey();
PersistedPath extenalTag = new PersistedPath(thisNodePath, key);
- properties.setProperty(extenalTag.toString(), (String) values.get(key));
+ properties.setProperty(extenalTag.toString(), (String) entry.getValue());
}
}
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java
index 8f8d8cad..b47a27a5 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 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
@@ -14,6 +14,7 @@ import java.io.*;
import java.net.URL;
import java.security.SecureRandom;
import java.util.*;
+import java.util.Map.Entry;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.PBEKeySpec;
@@ -138,9 +139,10 @@ public class SecurePreferencesRoot extends SecurePreferences implements IStorage
properties.remove(KEY_FACTORY_KEY);
}
- for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
- Object externalKey = i.next();
- Object value = properties.get(externalKey);
+ for (Iterator it = properties.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ Object externalKey = entry.getKey();
+ Object value = entry.getValue();
if (!(externalKey instanceof String))
continue;
if (!(value instanceof String))
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
index 40a16f5b..75dc16c4 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 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
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.security.storage.friends;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.equinox.internal.security.auth.AuthPlugin;
import org.eclipse.equinox.internal.security.auth.nls.SecAuthMessages;
import org.eclipse.equinox.internal.security.storage.SecurePreferencesContainer;
@@ -124,10 +125,11 @@ public class ReEncrypter {
TmpElement element = (TmpElement) i.next();
ISecurePreferences node = root.node(element.getPath());
Map values = element.getValues();
- for (Iterator j = values.keySet().iterator(); j.hasNext();) {
- String key = (String) j.next();
+ for (Iterator it = values.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ String key = (String) entry.getKey();
try {
- node.put(key, (String) values.get(key), true);
+ node.put(key, (String) entry.getValue(), true);
} catch (StorageException e) {
// this value will not be re-coded
String msg = NLS.bind(SecAuthMessages.encryptingError, key, node.absolutePath());
diff --git a/bundles/org.eclipse.equinox.weaving.caching/src/org/eclipse/equinox/weaving/internal/caching/CacheWriter.java b/bundles/org.eclipse.equinox.weaving.caching/src/org/eclipse/equinox/weaving/internal/caching/CacheWriter.java
index eaf2cd7b..fdb752d2 100644
--- a/bundles/org.eclipse.equinox.weaving.caching/src/org/eclipse/equinox/weaving/internal/caching/CacheWriter.java
+++ b/bundles/org.eclipse.equinox.weaving.caching/src/org/eclipse/equinox/weaving/internal/caching/CacheWriter.java
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2009 Martin Lippert and others.
- * All rights reserved. This program and the accompanying materials
+ * 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:
* Martin Lippert - initial implementation
* Martin Lippert - caching of generated classes
@@ -18,14 +18,14 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.concurrent.BlockingQueue;
/**
* The CacheWriter is responsible to store cache items to disk. The cache items
* are read from the given queue.
- *
+ *
* @author Martin Lippert
*/
public class CacheWriter {
@@ -34,7 +34,7 @@ public class CacheWriter {
/**
* Create a new cache writer for the given queue of cache items
- *
+ *
* @param cacheQueue The blocking queue that delivers the cache items to
* store to this cache writer
*/
@@ -74,10 +74,10 @@ public class CacheWriter {
/**
* store the cache item to disk
- *
+ *
* This operation creates the appropriate directory for the cache item if it
* does not exist
- *
+ *
* @param item the cache item to store to disc
* @throws IOException if an error occurs while writing to the cache
*/
@@ -86,18 +86,17 @@ public class CacheWriter {
// write out generated classes first
final Map<String, byte[]> generatedClasses = item.getGeneratedClasses();
if (generatedClasses != null) {
- final Iterator<String> generatedClassNames = generatedClasses
- .keySet().iterator();
- while (generatedClassNames.hasNext()) {
- final String className = generatedClassNames.next();
- final byte[] classBytes = generatedClasses.get(className);
+ for (final Entry<String, byte[]> entry : generatedClasses
+ .entrySet()) {
+ final String className = entry.getKey();
+ final byte[] classBytes = entry.getValue();
storeSingleClass(className, classBytes, item.getDirectory());
}
}
// write out the woven class
- storeSingleClass(item.getName(), item.getCachedBytes(), item
- .getDirectory());
+ storeSingleClass(item.getName(), item.getCachedBytes(),
+ item.getDirectory());
}
private void storeSingleClass(final String className,

Back to the top