[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-12-05 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17793225#comment-17793225
 ] 

ASF subversion and git services commented on OFBIZ-12721:
-

Commit 5013c3df661470b4bf2c5e7d0e2f9e40da6c49c2 in ofbiz-framework's branch 
refs/heads/release22.01 from Eugen Stan
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=5013c3df66 ]

Fixed: Time zone display for JDK17+ (OFBIZ-12721) (#676)

Use ZoneId API to get time zone display name

Thanks Ioan Eugen

jleroux: I did not find any timeZone.getDisplayName in in Java and Groovy files 
so I guess it's OK to close.

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-12-05 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17793223#comment-17793223
 ] 

ASF subversion and git services commented on OFBIZ-12721:
-

Commit ca0433d0e40ed9ac1cb73ad53be4a555ca9a3542 in ofbiz-framework's branch 
refs/heads/trunk from Eugen Stan
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=ca0433d0e4 ]

Fixed: Time zone display for JDK17+ (OFBIZ-12721) (#676)

Use ZoneId API to get time zone display name

Thanks Ioan Eugen

jleroux: I did not find any timeZone.getDisplayName in in Java and Groovy files 
so I guess it's OK to close.

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-12-03 Thread Ioan Eugen Stan (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17792605#comment-17792605
 ] 

Ioan Eugen Stan commented on OFBIZ-12721:
-

Provided a PR [~jleroux] . I think we can close this one finally.

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-12-03 Thread Ioan Eugen Stan (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17792603#comment-17792603
 ] 

Ioan Eugen Stan commented on OFBIZ-12721:
-

Apparently this works:
${timeZone.toZoneId().getDisplayName(Static["java.time.format.TextStyle"].FULL, 
locale)}

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-12-03 Thread Ioan Eugen Stan (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17792602#comment-17792602
 ] 

Ioan Eugen Stan commented on OFBIZ-12721:
-

The issue here is with the call to `useDaylightTime` which calls an internal 
API: `sun.util.calendar.ZoneInfo` .

```

${timeZone.getDisplayName(timeZone.useDaylightTime(), 
Static["java.util.TimeZone"].LONG, locale)}

```

The call is used when getting the display name for the timezone.

We can get the display name for the timezone in other ways to avoid the call to 
useDaylightTime .

I used this code to convert to ZoneId which has an API for display name : 
[https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/ZoneId.html#getDisplayName(java.time.format.TextStyle,java.util.Locale)]
 .

```

${timeZone.toZoneId()}

```

However the API needs 
[https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/format/TextStyle.html]
 which I don't know how to use in FreeMarker :D .

Something like this ( I would setup a template helper method perhaps)

```

timeZone.toZoneId().getDisplayName(java.time.format.TextStyle.FULL, locale)

```

 

Running this code in jshell works
```

jshell> 
java.util.TimeZone.getDefault().toZoneId().getDisplayName(java.time.format.TextStyle.FULL,
 java.util.Locale.forLanguageTag("ro-RO"))
$2 ==> "Ora Europei de Est"

```

 

However, not going through the displayName is better IMO:

```

jshell> java.util.TimeZone.getDefault().toZoneId()
$1 ==> Europe/Bucharest

```

 

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-01-04 Thread Jacques Le Roux (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17654543#comment-17654543
 ] 

Jacques Le Roux commented on OFBIZ-12721:
-

Hi Daniel,

bq. If I've understood the situation correctly, OFBIZ-12733 shall be used to 
apply the workarounds necessary to get both the release 22 branch and trunk 
working with JDK 17 and Gradle 7.6. We can consider those workarounds as our 
'tactical' fixes needed to remove a blocker for release 22.
Yep. As I already suggested For 18.12, that is currently the stable demo, we 
will simply stop and comment it out in https://ofbiz.apache.org/ofbiz-demos.html

bq. Conversely, OFBIZ-12400 and its sub-tickets are for the 
'strategic/long-term' fixes to get OFBiz running with JDK 17 without the need 
for any workarounds.
Not all of them (eg OFBIZ-12729 is a pre-step and depends on OFBIZ-12733). It's 
more to easily focus on what need's to be done regarding JDK 17, at least for 
me :). Though I don't see why now, maybe we will need to create more sub or 
related tickets.

bq. As OFBIZ-12400 and its sub-tickets are resolved in trunk, we should see 
workaround from OFBIZ-12733 gradually removed from trunk.
Right, as we know it will certainly take some time.

Note: if you don't know already by hovering on Jira issues you can read their 
titles. Also if you use the simple syntax (OFBIZ-#) you can know if they are 
-closed- or not (then 

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-01-04 Thread Daniel Watford (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17654466#comment-17654466
 ] 

Daniel Watford commented on OFBIZ-12721:


Hi [~jleroux] 

If I've understood the situation correctly, OFBIZ-12733 shall be used to apply 
the workarounds necessary to get both the release 22 branch and trunk working 
with JDK 17 and Gradle 7.6. We can consider those workarounds as our 'tactical' 
fixes needed to remove a blocker for release 22.

Conversely, OFBIZ-12400 and its sub-tickets are for the 'strategic/long-term' 
fixes to get OFBiz running with JDK 17 without the need for any workarounds. As 
OFBIZ-12400 and its sub-tickets are resolved in trunk, we should see workaround 
from OFBIZ-12733 gradually removed from trunk.

Personally I'm not too worried about backporting the strategic fixes to the 
release 22 branch, particularly since there may be a large number of changes 
that need to be applied. Instead I would hope that we can conclude OFBIZ-12400 
in trunk before the release 23 branch is taken and therefore consider the 
eventual release 23 as our 'clean workaround-free' release.

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-01-03 Thread Jacques Le Roux (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17653878#comment-17653878
 ] 

Jacques Le Roux commented on OFBIZ-12721:
-

Hi Daniel, 

That makes sense indeed, and will certainly help to clarify the situation, not 
only for the RM. I have created OFBIZ-12733 for that.

I note that at some point we will need to backport the work done in the 
"strategic Jira" (ie here) from trunk to a specific released version. So if we 
want to release this specific version using the 22.01 branch, and not an 
upcoming branch, (I hope so) we might want to not close the current Jira using 
a "Upcoming Branch" fix-version until the backport is done in the 22.01 branch.

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-01-02 Thread Daniel Watford (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17653589#comment-17653589
 ] 

Daniel Watford commented on OFBIZ-12721:


Hi [~jleroux] , I'm happy to use whatever approach to Jira tickets you see as 
appropriate. I didn't notice that this was already a sub-task.

The reason I thought we might want to use two separate tickets was to have the 
workaround ticket set with a fix-version of release 22, whereas the strategic 
fix would have fix-version of trunk. Then when a release manager reviews the 
outstanding tickets for release 22, they would have quickly seen that this 
particular piece of work was complete.

If we keep the ticket open, then the release manager would need to read through 
the ticket details to determine whether the ticket was blocking the release or 
not.

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2023-01-01 Thread Jacques Le Roux (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17653442#comment-17653442
 ] 

Jacques Le Roux commented on OFBIZ-12721:
-

Hi Daniel, 

We can't create sub-tasks "into" a sub-task, as is this one. We could keep this 
one for the definitive solution and create a sub-task of OFBIZ-12400 to 
implement the workaround. I'm not sure we need that though, because I don't see 
what it would add. We can simply implement the workaround using this Jira but 
not close it until the definitive implementation is done. All is already 
described here, adding Jiras is not always a good solution. Sometimes it blurs 
things. What do you think?

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2022-12-31 Thread Daniel Watford (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17653340#comment-17653340
 ] 

Daniel Watford commented on OFBIZ-12721:


I experimented a little in UtilHttp, converting getTimeZone to return a 
java.time.ZoneId rather than a java.util.TimeZone and found there was a lot 
that needed updating - possibly too much to do quickly and confidently.

I would suggest creating two sub-jiras:
 * One sub-Jira to implement the temporary "--add-exports" solution
 ** Fixing this would remove a blocker for release 22.
 * A second sub-task to convert ofbiz to use java.time.ZoneId.
 ** This task can be worked on after release 22. 
 ** I would also recommend using the context key, zoneId, rather than timeZone 
when converting to help communicate the type of object in use.
 ** ZoneId objects expose a ZoneRules object which can be used to determine if 
daylight savings is in effect. This is what caused the original reported error. 

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2022-12-08 Thread Jacques Le Roux (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17644729#comment-17644729
 ] 

Jacques Le Roux commented on OFBIZ-12721:
-

Hi Eugen,
bq. Ok with that Jacques Le Roux ?
Sure most welcome :)
bq. Should we use that ?
I have no idea yet. If it fits in Freemarker it could not be enough. In screen 
context, we have this timeZone var, maybe used in other context than 
Freemarker. There are also a lot of use of TimeZone in Java and Groovy. 




> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2022-12-08 Thread Ioan Eugen Stan (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17644691#comment-17644691
 ] 

Ioan Eugen Stan commented on OFBIZ-12721:
-

Freemarker added a special variablefor time zone since 2.3.31

> Added new special variable, time_zone (referred like .time_zone, like all 
> special variables), to retrieve the current value of the time_zone setting as 
> a string.

 

Should we use that ?

[https://freemarker.apache.org/docs/versions_2_3_31.html] .

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-12721) Replace all occurrences of java.util.TimeZone by java.time.ZoneId

2022-12-08 Thread Ioan Eugen Stan (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17644690#comment-17644690
 ] 

Ioan Eugen Stan commented on OFBIZ-12721:
-

I can take a look at this and prepare a PR.

Ok with that [~jleroux] ?

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -
>
> Key: OFBIZ-12721
> URL: https://issues.apache.org/jira/browse/OFBIZ-12721
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: ALL COMPONENTS
>Affects Versions: Upcoming Branch
> Environment: Java 17
>Reporter: Jacques Le Roux
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker  
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=360,dstSa
> vings=360,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> 
> FTL stack trace ("~" means nesting-related):
> - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> 
> at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
> at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
> at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
> at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
> at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
> ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=10;maxdepth=20;maxrefs=1000;maxbytes=50','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)