Skip to content

Commit

Permalink
[JENKINS-16845] Hotfix to at least allow the job to be loaded.
Browse files Browse the repository at this point in the history
Root cause seems to be broken serial form of FingerprintAction, probably caused by lazy loading.(cherry picked from commit 353ebe6)

Conflicts:
	changelog.html
  • Loading branch information
jglick authored and vjuranek committed Apr 14, 2013
1 parent 1b10bcb commit 6d13d4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion core/src/main/java/hudson/tasks/Fingerprinter.java
Expand Up @@ -294,7 +294,7 @@ public boolean isApplicable(Class<? extends AbstractProject> jobType) {
*/
public static final class FingerprintAction implements RunAction {

private final AbstractBuild build;
private AbstractBuild build;

private static final Random rand = new Random();

Expand Down Expand Up @@ -343,6 +343,11 @@ public Map<String,String> getRecords() {
}

public void onLoad() {
if (build.getParent() == null) {
logger.warning("JENKINS-16845: broken FingerprintAction record");
build = null;
return;
}
// share data structure with nearby builds, but to keep lazy loading efficient,
// don't go back the history forever.
if (rand.nextInt(2)!=0) {
Expand Down Expand Up @@ -430,6 +435,11 @@ public Map<AbstractProject,Integer> getDependencies() {
public Map<AbstractProject,Integer> getDependencies(boolean includeMissing) {
Map<AbstractProject,Integer> r = new HashMap<AbstractProject,Integer>();

if (build == null) {
// Broken, do not do anything.
return r;
}

for (Fingerprint fp : getFingerprints().values()) {
BuildPtr bp = fp.getOriginal();
if(bp==null) continue; // outside Hudson
Expand Down
Expand Up @@ -30,7 +30,9 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<l:layout>
<st:include it="${it.build}" page="sidepanel.jelly" />
<j:if test="${it.build != null}">
<st:include it="${it.build}" page="sidepanel.jelly"/>
</j:if> <!-- else broken -->
<l:main-panel>
<h1>
<img src="${imagesURL}/48x48/fingerprint.png" alt="" height="48" width="48"/>
Expand Down

0 comments on commit 6d13d4c

Please sign in to comment.