aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
index a2628b6c1..f07647127 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
@@ -225,9 +225,10 @@ public class GitProjectData {
}
}
- final Reference r = repositoryCache.get(gitDir);
- Repository d = r != null ? (Repository) r.get() : null;
- if (d == null) {
+ final Repository d;
+ if (repositoryCache.containsKey(gitDir)) {
+ d = (Repository) repositoryCache.get(gitDir).get();
+ } else {
d = new Repository(gitDir);
repositoryCache.put(gitDir, new WeakReference<Repository>(d));
}
@@ -376,9 +377,8 @@ public class GitProjectData {
final FileOutputStream o = new FileOutputStream(tmp);
try {
final Properties p = new Properties();
- final Iterator i = mappings.iterator();
- while (i.hasNext()) {
- ((RepositoryMapping) i.next()).store(p);
+ for (final RepositoryMapping repoMapping : mappings) {
+ repoMapping.store(p);
}
p.store(o, "GitProjectData"); //$NON-NLS-1$
ok = true;
@@ -417,9 +417,8 @@ public class GitProjectData {
p.load(o);
mappings.clear();
- final Iterator keyItr = p.keySet().iterator();
- while (keyItr.hasNext()) {
- final String key = keyItr.next().toString();
+ for (final Object keyObj : p.keySet()) {
+ final String key = keyObj.toString();
if (RepositoryMapping.isInitialKey(key)) {
mappings.add(new RepositoryMapping(p, key));
}
@@ -434,9 +433,8 @@ public class GitProjectData {
private void remapAll() {
protectedResources.clear();
- final Iterator i = mappings.iterator();
- while (i.hasNext()) {
- map((RepositoryMapping) i.next());
+ for (final RepositoryMapping repoMapping : mappings) {
+ map(repoMapping);
}
}