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

NullReferenceException: GetLocaleCalendar() #358

Closed
aliquid opened this issue May 18, 2020 · 4 comments
Closed

NullReferenceException: GetLocaleCalendar() #358

aliquid opened this issue May 18, 2020 · 4 comments
Labels
Milestone

Comments

@aliquid
Copy link

aliquid commented May 18, 2020

Regression from 2.4.1 to 2.5.1
Windows Server 2016 Core, 64-bit
.NET Framework 4.7.2

We do not call LocaleUtil.SetUserTimeZone(), never have. Not working with time zones, only converting dates to strings.

Fix maybe this?

private static ThreadLocal<TimeZone> userTimeZone
        = new ThreadLocal<TimeZone>(() => TimeZone.CurrentTimeZone);
System.NullReferenceException: Object reference not set to an instance of an object.
   at NPOI.Util.LocaleUtil.GetLocaleCalendar()
   at NPOI.SS.UserModel.DateUtil.GetJavaCalendar(Double date, Boolean use1904windowing, TimeZone timeZone, Boolean roundSeconds)
   at NPOI.XSSF.UserModel.XSSFCell.get_DateCellValue()
   at NPOI.SS.UserModel.DataFormatter.GetFormattedDateString(ICell cell)
   at NPOI.SS.UserModel.DataFormatter.FormatCellValue(ICell cell, IFormulaEvaluator evaluator)

nja pushed a commit to nja/npoi that referenced this issue May 19, 2020
@tonyqus tonyqus added this to the NPOI 2.5.2 milestone Jun 25, 2020
@tonyqus tonyqus added the bug label Jun 25, 2020
@tonyqus
Copy link
Member

tonyqus commented Aug 18, 2020

hmm.... your concern makes sense. Maybe I should remove the SetUserTimeZone in 2.5.2

@vitalygoji
Copy link

I get excellent results when I process file with your awesome software.
Issue is when I try to read file second time, I get exception when I reading DateTime field (see below) .

Is there a workaround? I really need to fix it, its a production time and serious show stopper for whole our team.
Please help!

@tonyqus
Copy link
Member

tonyqus commented Dec 11, 2020

Which version of NPOI are you using? I suppose this issue should be resolved in NPOI 2.5.2

@shaiyu
Copy link

shaiyu commented Aug 5, 2021

+1
2.5.1 -> 2.5.2

shaiyu pushed a commit to shaiyu/NPOIHelper that referenced this issue Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants