From def99d53d1193dd80906f9a2bfb96525bbff8711 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 11 Mar 2010 00:21:49 +0000 Subject: [PATCH] Merged revisions 28499 via svnmerge from https://svn.dev.java.net/svn/hudson/branches/rc ........ r28499 | kohsuke | 2010-03-10 11:57:23 -0800 (Wed, 10 Mar 2010) | 1 line Do the same protection to _calcRevisionsFromBuild to avoid HUDSON-5756 ........ git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@28507 71c3de6d-444a-0410-be80-ed276b4c234a --- .../java/hudson/model/AbstractProject.java | 4 +-- core/src/main/java/hudson/scm/SCM.java | 26 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index a1a2dd59d7..b616ab7129 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -1049,7 +1049,7 @@ public abstract class AbstractProject

,R extends A SCMRevisionState baseline = build.getAction(SCMRevisionState.class); if (baseline==null) { try { - baseline = safeCalcRevisionsFromBuild(build, launcher, listener); + baseline = getScm()._calcRevisionsFromBuild(build, launcher, listener); } catch (AbstractMethodError e) { baseline = SCMRevisionState.NONE; // pre-1.345 SCM implementations, which doesn't use the baseline in polling } @@ -1063,7 +1063,7 @@ public abstract class AbstractProject

,R extends A * For reasons I don't understand, if I inline this method, AbstractMethodError escapes try/catch block. */ private SCMRevisionState safeCalcRevisionsFromBuild(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { - return getScm().calcRevisionsFromBuild(build, launcher, listener); + return getScm()._calcRevisionsFromBuild(build, launcher, listener); } /** diff --git a/core/src/main/java/hudson/scm/SCM.java b/core/src/main/java/hudson/scm/SCM.java index e56934474f..48a1383bd1 100644 --- a/core/src/main/java/hudson/scm/SCM.java +++ b/core/src/main/java/hudson/scm/SCM.java @@ -293,6 +293,14 @@ public abstract class SCM implements Describable, ExtensionPoint { */ public abstract SCMRevisionState calcRevisionsFromBuild(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException; + /** + * A pointless function to work around what appears to be a HotSpot problem. See HUDSON-5756 and bug 6933067 + * on BugParade for more details. + */ + public SCMRevisionState _calcRevisionsFromBuild(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { + return calcRevisionsFromBuild(build, launcher, listener); + } + /** * Compares the current state of the remote repository against the given baseline {@link SCMRevisionState}. * @@ -335,6 +343,14 @@ public abstract class SCM implements Describable, ExtensionPoint { */ protected abstract PollingResult compareRemoteRevisionWith(AbstractProject project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException; + /** + * A pointless function to work around what appears to be a HotSpot problem. See HUDSON-5756 and bug 6933067 + * on BugParade for more details. + */ + private PollingResult _compareRemoteRevisionWith(AbstractProject project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline2) throws IOException, InterruptedException { + return compareRemoteRevisionWith(project, launcher, workspace, listener, baseline2); + } + /** * Convenience method for the caller to handle the backward compatibility between pre 1.345 SCMs. */ @@ -346,7 +362,7 @@ public abstract class SCM implements Describable, ExtensionPoint { if (baseline!=SCMRevisionState.NONE) { baseline2 = baseline; } else { - baseline2 = calcRevisionsFromBuild(project.getLastBuild(), launcher, listener); + baseline2 = _calcRevisionsFromBuild(project.getLastBuild(), launcher, listener); } return _compareRemoteRevisionWith(project, launcher, workspace, listener, baseline2); @@ -365,14 +381,6 @@ public abstract class SCM implements Describable, ExtensionPoint { return false; } - /** - * A pointless function to work around what appears to be a HotSpot problem. See HUDSON-5756 and bug 6933067 - * on BugParade for more details. - */ - private PollingResult _compareRemoteRevisionWith(AbstractProject project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline2) throws IOException, InterruptedException { - return compareRemoteRevisionWith(project, launcher, workspace, listener, baseline2); - } - /** * Obtains a fresh workspace of the module(s) into the specified directory * of the specified machine.