Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that server is not null before doing the check #342

Conversation

Projects
None yet
2 participants
@Jimilian
Copy link
Contributor

commented Jan 9, 2018

During Jenkins initialization it's possible to hit the case when GerritMissedEventsPlaybackEnabledChecker is already ready and scheduled, but GerritServer construction is not finished yet.

It leads to something really scare:

Jan 09, 2018 6:57:24 AM hudson.model.AsyncPeriodicWork$1 run
INFO: Started GerritMissedEventsPlaybackEnabledChecker
Jan 09, 2018 6:57:24 AM hudson.init.impl.InstallUncaughtExceptionHandler$DefaultUncaughtExceptionHandler uncaughtException
SEVERE: A thread (GerritMissedEventsPlaybackEnabledChecker thread/201) died unexpectedly due to an uncaught exception, this may leave your Jenkins in a bad way and is usually indicative of a bug in the code.
java.lang.NullPointerException at com.sonyericsson.hudson.plugins.gerrit.trigger.playback.GerritMissedEventsPlaybackEnabledChecker.execute(GerritMissedEventsPlaybackEnabledChecker.java:71)
                at hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:101)
                at java.lang.Thread.run(Thread.java:748)

p.s. Happy New Year @rsandell! And thank you for maintaining this plugin and your help with getting things done :)

Prevent NPE in GerritMissedEventsPlaybackEnabledChecker
During Jenkins initialization it's possible to hit the case when
GerritMissedEventsPlaybackEnabledChecker is already ready and scheduled,
but GerritServer construction is not finished yet, so, GerritServer
itself or missedEventsPlaybackManager are null.

@Jimilian Jimilian force-pushed the Jimilian:fix_npe_in_GerritMissedEventsPlaybackEnabledChecker branch from f5bb667 to 32c02a0 Jan 10, 2018

@Jimilian

This comment has been minimized.

Copy link
Contributor Author

commented Jan 22, 2018

@rsandell Hi, can you take a look in this PR, please? It looks safe enough :)

@rsandell rsandell merged commit 52ea505 into jenkinsci:master Jan 25, 2018

1 check passed

continuous-integration/jenkins/pr-merge This commit looks good
Details

@Jimilian Jimilian deleted the Jimilian:fix_npe_in_GerritMissedEventsPlaybackEnabledChecker branch Jan 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.