[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)


Re: [PR] Fixed: Time zone display for JDK17+ (OFBIZ-12721) [ofbiz-framework]

2023-12-03 Thread via GitHub


sonarcloud[bot] commented on PR #676:
URL: https://github.com/apache/ofbiz-framework/pull/676#issuecomment-1837696796

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_ofbiz-framework=676)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_ofbiz-framework=676=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_ofbiz-framework=676=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_ofbiz-framework=676=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework=676=false=CODE_SMELL)
   
   [![No Coverage 
information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png
 'No Coverage 
information')](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework=676)
 No Coverage information  
   [![No Duplication 
information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png
 'No Duplication 
information')](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework=676=duplicated_lines_density=list)
 No Duplication information
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] Fixed: Time zone display for JDK17+ (OFBIZ-12721) [ofbiz-framework]

2023-12-03 Thread via GitHub


ieugen opened a new pull request, #676:
URL: https://github.com/apache/ofbiz-framework/pull/676

   Fixed: Time zone display for JDK17+ (OFBIZ-12721)
   
   Use ZoneId API to get time zone display name 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[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-12400) Upgrade to gradle 7.6 - support JDK 11 -> 17

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


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

Ioan Eugen Stan commented on OFBIZ-12400:
-

Hi,

What is the holdup with this issue?

Java 21 is out so it's Java 17 is already old :) .

I might get some time to look at ofbiz and try to build some datasets for 
Romanian - so I can use it.

> Upgrade to gradle 7.6 - support JDK 11 -> 17
> 
>
> Key: OFBIZ-12400
> URL: https://issues.apache.org/jira/browse/OFBIZ-12400
> Project: OFBiz
>  Issue Type: Task
>Reporter: Ioan Eugen Stan
>Assignee: Ioan Eugen Stan
>Priority: Major
> Attachments: OFBIZ-12400-windows-binary.patch
>
>
> For working with Java 17, we need to upgrade to gradle 7.3 



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