question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerException on "new CalendarPanel()"

See original GitHub issue

Hi there,

observerd in version 11.0.0:

When instancing a CalendarPanel using the parameter-less constructor

CalendarPanel calendarPanel = new CalendarPanel();

I get a NullPointerException:

java.lang.NullPointerException: null
	at com.github.lgooddatepicker.components.CalendarPanel.<init>(CalendarPanel.java:253)
	at com.github.lgooddatepicker.components.CalendarPanel.<init>(CalendarPanel.java:211)
	...

It turns out that in the line in which the exception occurs…

displayedYearMonth = YearMonth.now(datePickerSettings.getClock());

…the datePickerSettings parameter is null (obviously, when looking at the calling site in line 211).

It’s only in line 294 of the constructor that the setSettings(datePickerSettings) function gets called, which ensures that a default settings object is created in case the passed datePickerSettings are null.

I currently don’t have the possibility to fork the project and to work on this issue myself, but perhaps a simple solution would be to move the setSettings(datePickerSettings) call right to the start of the constructor and to replace displayedYearMonth = YearMonth.now(datePickerSettings.getClock()); with displayedYearMonth = YearMonth.now(settings.getClock());?

Cheers – Torsten

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
BlakeTNCcommented, Aug 20, 2020

@WiseEagleOwl, FYI, v11.0.2 demo is running successfully on double click under Mac OS Catalina, JDK 1.8. and Win 10 JDK 1.8. -Blake

0reactions
WiseEagleOwlcommented, Aug 21, 2020

@tcrass Thank you for confirming that v11.0.2 works for you. Would you mind sharing which operating system (Windows, Mac, Linux, …) and Java version (8, 11, 14, …) your date picker application is running under? This information helps me keep track which combinations have already been tested and knowing the most popular setups of our user base would also be helpful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Null pointer exception when accessing Google Calendar
I am writing a android app that need to insert event to Google Calendar. I run my app in my two android phone...
Read more >
NULL POINTER EXCEPTION IN SAMPLE JAVA EVENT ... - IBM
Problem summary. The NullPointerException occurs while processing the 2nd event when using WDIQueue2Session source and the sample WDI email notification.
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >
Null Pointer exception during mapping of complex objects #375
Here is a simple application which tries to convert objects with a nesting level more than one: public class TestApp { public static...
Read more >
System.NullPointerException Error for new method to be ...
It was PASS when I Ran the test class in Sandbox. However , when I'm trying to deploy in Prod through Change Set,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found