aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2011-08-16 12:21:04 (EDT)
committerRobin Stocker2011-08-16 12:21:04 (EDT)
commitf69abbe1ee4fd9d82401eddc474b79bba7b62150 (patch)
tree64f6c57411652ea778030de616a42f2b6d915cd5
parent7fbeca4c218d7712abd6198ca9551f3c15904343 (diff)
downloadegit-f69abbe1ee4fd9d82401eddc474b79bba7b62150.zip
egit-f69abbe1ee4fd9d82401eddc474b79bba7b62150.tar.gz
egit-f69abbe1ee4fd9d82401eddc474b79bba7b62150.tar.bz2
[FindBugs] Fix warnings in GitProjectSetCapabilityrefs/changes/12/4012/1
Makes inner classes static, removes unused code and uses Map#entrySet() instead of keySet() followed by get(). Change-Id: I2ceac1ae704164d03c91d846bd01b07c147eac17 Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java34
1 files changed, 14 insertions, 20 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java
index ff573fd..6719fd0 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java
@@ -11,6 +11,7 @@ package org.eclipse.egit.core;
import java.io.File;
import java.io.IOException;
+import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -53,8 +54,10 @@ public final class GitProjectSetCapability extends ProjectSetCapability {
private static final String SEPARATOR = ","; //$NON-NLS-1$
private static final String VERSION = "1.0"; //$NON-NLS-1$
- private final class ProjectReferenceComparator implements
- Comparator<ProjectReference> {
+ private static final class ProjectReferenceComparator implements
+ Comparator<ProjectReference>, Serializable {
+ private static final long serialVersionUID = 1L;
+
public int compare(ProjectReference o1, ProjectReference o2) {
final boolean reposEqual = o1.repository.equals(o2.repository);
final boolean branchesEqual = o1.branch
@@ -65,16 +68,11 @@ public final class GitProjectSetCapability extends ProjectSetCapability {
}
}
- final class ProjectReference {
+ private static final class ProjectReference {
private static final String DEFAULT_BRANCH = Constants.MASTER;
/**
- * the version of the reference string
- */
- String version;
-
- /**
* a relative path (from the repository root) to a project
*/
String projectDir;
@@ -90,12 +88,6 @@ public final class GitProjectSetCapability extends ProjectSetCapability {
*/
String branch = DEFAULT_BRANCH;
- /**
- * use this name instead of using the remote name origin to keep track
- * of the upstream repository, see <code>--origin</code> option.
- */
- String origin = Constants.DEFAULT_REMOTE_NAME;
-
@SuppressWarnings("boxing")
ProjectReference(final String reference) throws URISyntaxException, IllegalArgumentException {
final String[] tokens = reference.split(Pattern.quote(SEPARATOR));
@@ -104,7 +96,6 @@ public final class GitProjectSetCapability extends ProjectSetCapability {
CoreText.GitProjectSetCapability_InvalidTokensCount, new Object[] {
4, tokens.length, tokens }));
- this.version = tokens[0];
this.repository = new URIish(tokens[1]);
if (!"".equals(tokens[2])) //$NON-NLS-1$
this.branch = tokens[2];
@@ -190,11 +181,14 @@ public final class GitProjectSetCapability extends ProjectSetCapability {
}
}
final ArrayList<IProject> importedProjects = new ArrayList<IProject>();
- for (final URIish gitUrl : repositories.keySet()) {
- Map<String, Set<ProjectReference>> branches = repositories
- .get(gitUrl);
- for (final String branch : branches.keySet()) {
- final Set<ProjectReference> projects = branches.get(branch);
+ for (final Map.Entry<URIish, Map<String, Set<ProjectReference>>> entry : repositories.entrySet()) {
+ final URIish gitUrl = entry.getKey();
+ final Map<String, Set<ProjectReference>> branches = entry.getValue();
+
+ for (final Map.Entry<String, Set<ProjectReference>> branchEntry : branches.entrySet()) {
+ final String branch = branchEntry.getKey();
+ final Set<ProjectReference> projects = branchEntry.getValue();
+
try {
final IPath workDir = getWorkingDir(gitUrl, branch,
branches.keySet());