Skip to content
Permalink
Browse files

[FIXED JENKINS-19978] Prevent serialization errors if master and slav…

…e are using different VMs by adding serialVersionUIDs
  • Loading branch information...
kutzi committed Oct 19, 2013
1 parent d8862d4 commit 0352b3c4861eb97ee385678fbddc68a95fad87bd
@@ -1156,6 +1156,7 @@ private boolean isUpdateSnapshots(String goals) {
}

public static final class Result implements Serializable {
private static final long serialVersionUID = 1770277148826049154L;
public final List<PomInfo> infos;
public final Map<String,String> modelParents;
public Result(List<PomInfo> infos, Map<String,String> modelParents) {
@@ -58,21 +58,29 @@ public static PlexusModuleContributor of(List<FilePath> jars) {
files.add(jar.getRemote());
}

return new PlexusModuleContributor() {
@Override
public List<URL> getPlexusComponentJars() {
try {
List<URL> r = new ArrayList<URL>(files.size());
for (String file : files) {
r.add(new File(file).toURI().toURL());
}
return r;
} catch (MalformedURLException e) {
throw new IllegalStateException(e);
return new PlexusModuleContributorOfPaths(files);
}

private static class PlexusModuleContributorOfPaths extends PlexusModuleContributor {
private static final long serialVersionUID = 8528727996575052850L;

This comment has been minimized.

Copy link
@jglick

jglick Oct 21, 2013

Member

BTW you do not need to recreate generate SVUIDs like this unless you are maintaining wire compatibility between different versions of the code, which should never be an issue with Jenkins since it loads plugin classes from the master. So you can always use simply 1 (or whatever) as a value.

private List<String> files;

public PlexusModuleContributorOfPaths(List<String> files) {
this.files = files;
}

@Override
public List<URL> getPlexusComponentJars() {
try {
List<URL> r = new ArrayList<URL>(files.size());
for (String file : files) {
r.add(new File(file).toURI().toURL());
}
return r;
} catch (MalformedURLException e) {
throw new IllegalStateException(e);
}

private static final long serialVersionUID = 1L;
};
}

}
}
@@ -54,15 +54,24 @@ public static PlexusModuleContributor aggregate(AbstractBuild<?,?> context) thro
all.add(pmc);
}

return new PlexusModuleContributor() {
@Override
public List<URL> getPlexusComponentJars() {
List<URL> urls = new ArrayList<URL>();
for (PlexusModuleContributor pc : all) {
urls.addAll(pc.getPlexusComponentJars());
}
return urls;
return new AggregatedPlexusModuleContributor(all);
}

private static class AggregatedPlexusModuleContributor extends PlexusModuleContributor {
private static final long serialVersionUID = -96035620100000276L;
private List<PlexusModuleContributor> all;

public AggregatedPlexusModuleContributor(List<PlexusModuleContributor> all) {
this.all = all;
}

@Override
public List<URL> getPlexusComponentJars() {
List<URL> urls = new ArrayList<URL>();
for (PlexusModuleContributor pc : all) {
urls.addAll(pc.getPlexusComponentJars());
}
};
return urls;
}
}
}

0 comments on commit 0352b3c

Please sign in to comment.
You can’t perform that action at this time.