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

Avoid NPE sending email on dev machines #448

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

labkey-jeckels
Copy link
Contributor

Rationale

Every morning I find a message like this in my dev server's logs:

ERROR ErrorLogger              2024-08-23T08:04:55,932 uartzScheduler_Worker-10 : Job (TestResultsGroup.TestResultsEmailTrigger threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-2.3.2.jar:?]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.2.jar:?]
Caused by: java.lang.NullPointerException: Cannot invoke "org.labkey.api.security.User.getEmail()" because "from" is null
	at org.labkey.testresults.SendTestResultsEmail.execute(SendTestResultsEmail.java:330) ~[testresults-24.9-SNAPSHOT.jar:?]
	at org.labkey.testresults.SendTestResultsEmail.execute(SendTestResultsEmail.java:347) ~[testresults-24.9-SNAPSHOT.jar:?]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.3.2.jar:?]
	... 1 more

It's because I don't have a user account that the code assumes will be available.

Changes

  • Simple null check to ensure the user exists before attempting to send email

Copy link
Collaborator

@vagisha vagisha left a comment

Choose a reason for hiding this comment

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

Thanks!

@labkey-jeckels labkey-jeckels merged commit 7af51ed into develop Aug 23, 2024
4 checks passed
@labkey-jeckels labkey-jeckels deleted the fb_nightlyEmailNullCheck branch August 23, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants