Skip to content

Commit

Permalink
[FIXED JENKINS-9822] occasional NPE when running maven jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
kutzi committed Jul 16, 2011
1 parent ff3d287 commit 345b3bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -58,6 +58,9 @@
<li class=bug>
Fixed a race condition in the fingerprint computation
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-10346">issue 10346</a>)
<li class=bug>
Fixed an occasional NPE when running Maven jobs
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-9822">issue 9822</a>)
</ul>
</div><!--=TRUNK-END=-->

Expand Down
7 changes: 6 additions & 1 deletion maven-plugin/src/main/java/hudson/maven/MavenBuild.java
Expand Up @@ -540,7 +540,7 @@ public void end() {
}

/**
* Sends the accumuldated log in {@link SplittableBuildListener} to the log of this build.
* Sends the accumulated log in {@link SplittableBuildListener} to the log of this build.
*/
public void appendLastLog() {
try {
Expand Down Expand Up @@ -586,6 +586,11 @@ public void cleanUp(BuildListener listener) {
private void rememberModulesToBuildAgainNextTime() {
MavenModuleSetBuild moduleSetBuild = getModuleSetBuild();

if (moduleSetBuild == null) {
// ModuleSetBuild is gone, for whatever reason JENKINS-9822
return;
}

if(hasntStartedYet()) {
// record modules which have not been build though they should have - i.e. because they
// have SCM changes.
Expand Down

4 comments on commit 345b3bb

@mfriedenhagen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Kutzi,

isn't this just disguising the actual bug? We should at least log a warning that something weird is happening in line #591.

Regards
Mirko

@kutzi
Copy link
Member Author

@kutzi kutzi commented on 345b3bb Jul 26, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I don't know for sure if it's a bug then. The parent MavenModuleSetBuild might have been gone for any reason - might be there are non-bug related reasons, too ;-)
Anyway, there's no need to break this MavenBuild, if it can still finish without the existence of its parent build

@mfriedenhagen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@provegard
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with mfriedenhagen that this just hides the bug. If the business of remembering modules to build again next time isn't strictly necessary, then the fix seems fine, but logging might be a good idea...

Please sign in to comment.