fred4jupiter/fredbet

Issue after saving timezone to DB

tuudik opened this issue · 3 comments

Had older version with commit: 155d7c6
Update to new version with commit: d90e87b

cd /opt/fredbet/extra/docker-compose/postgresql
docker-compose up --force-recreate --build -d fredbet
docker  logs  -f postgresql_fredbet_1 
  ______            _ ____       _   
 |  ____|          | |  _ \     | |  
 | |__ _ __ ___  __| | |_) | ___| |_ 
 |  __| '__/ _ \/ _` |  _ < / _ \ __|
 | |  | | |  __/ (_| | |_) |  __/ |_ 
 |_|  |_|  \___|\__,_|____/ \___|\__|
                                     
2021-06-13 15:05:36,286 INFO  [de.fred4jupiter.fredbet.AppInitializer] - Active profiles: [postgres]
2021-06-13 15:05:36,332 INFO  [de.fred4jupiter.fredbet.Application] - Starting Application v2.6.4-SNAPSHOT using Java 15.0.2 on 8d6bdf0693de with PID 1 (/fredbet.jar started by root in /)
2021-06-13 15:05:36,338 INFO  [de.fred4jupiter.fredbet.Application] - The following profiles are active: postgres
2021-06-13 15:06:24,894 INFO  [de.fred4jupiter.fredbet.ImageGalleryConfig] - Storing images in database.
2021-06-13 15:06:27,616 INFO  [de.fred4jupiter.fredbet.DefaultLocaleInitializer] - Setting default locale to: en
2021-06-13 15:06:34,158 INFO  [de.fred4jupiter.fredbet.Application] - Started Application in 62.709 seconds (JVM running for 67.204)
2021-06-13 15:06:34,422 INFO  [de.fred4jupiter.fredbet.data.DatabasePopulator] - createDefaultUsers: creating default users ...
2021-06-13 15:06:34,972 ERROR [org.springframework.boot.SpringApplication] - Application run failed
java.lang.NullPointerException: Cannot invoke "String.length()" because "id" is null
	at java.base/java.util.TimeZone.parseCustomTimeZone(TimeZone.java:800)
	at java.base/java.util.TimeZone.getTimeZone(TimeZone.java:580)
	at java.base/java.util.TimeZone.getTimeZone(TimeZone.java:518)
	at de.fred4jupiter.fredbet.service.admin.TimeZoneService.setTimeZone(TimeZoneService.java:15)
	at de.fred4jupiter.fredbet.service.config.RuntimeSettingsService.checkIfTimezoneIsCorrect(RuntimeSettingsService.java:91)
	at de.fred4jupiter.fredbet.service.config.RuntimeSettingsService$$FastClassBySpringCGLIB$$6f81e638.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)
	at de.fred4jupiter.fredbet.service.config.RuntimeSettingsService$$EnhancerBySpringCGLIB$$8c3dea50.checkIfTimezoneIsCorrect(<generated>)
	at de.fred4jupiter.fredbet.data.PostApplicationStartedChecker.createDemoData(PostApplicationStartedChecker.java:44)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:344)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:229)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:166)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
	at org.springframework.boot.context.event.EventPublishingRunListener.running(EventPublishingRunListener.java:111)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$running$6(SpringApplicationRunListeners.java:79)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
	at org.springframework.boot.SpringApplicationRunListeners.running(SpringApplicationRunListeners.java:79)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:354)
	at de.fred4jupiter.fredbet.Application.main(Application.java:37)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)

I guess it because when upgrading, the code is looking for TZ from DB, but since it was not stored there before, it will start to fail.
As a workaround I modified the config_json manualy and added "timeZone":"Europe/Berlin"

Yes, I recognized it this morning and fixed it. Please check the latest Version ("latest" tag) if the error does occur anymore.

Issue resolved with version 2.6.4