[jira] [Comment Edited] (OFBIZ-12722) Fix Java 17 two warning issues

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


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

Jacques Le Roux edited comment on OFBIZ-12722 at 12/8/22 10:48 AM:
---

For 
{code}
AuthHelper.java:132: warning: [removal] AccessController in java.security has 
been deprecated and marked for removal
return AccessController.doPrivileged(
^
{code}
Since Java 17 will be supported for 3 years we could (temporary?)  add 
{code}@SuppressWarnings({ "removal", "deprecation" }){code} to 
{{AuthHelper::getContextClassLoader}}. We could handle that later when the 
removal will be inevitable.



was (Author: jacques.le.roux):
For 
{code}
AuthHelper.java:132: warning: [removal] AccessController in java.security has 
been deprecated and marked for removal
return AccessController.doPrivileged(
^
{code}
Since Java 17 will be supported for 3 years we could (temporary?)  add 
{{@SuppressWarnings({ "removal", "deprecation" })}} to 
{{AuthHelper::getContextClassLoader}}. We could handle that later when the 
removal will be inevitable.


> Fix Java 17 two warning issues
> --
>
> Key: OFBIZ-12722
> URL: https://issues.apache.org/jira/browse/OFBIZ-12722
> Project: OFBiz
>  Issue Type: Task
>  Components: base, testtools
>Affects Versions: Upcoming Branch
>Reporter: Jacques Le Roux
>Priority: Minor
>
> AuthHelper.java:132: warning: [removal] AccessController in java.security has 
> been deprecated and marked for removal
> return AccessController.doPrivileged(
>^
> GroovyScriptTestCase.java:29: warning: [deprecation] GroovyTestCase in 
> groovy.util has been deprecated
> public class GroovyScriptTestCase extends GroovyTestCase {



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


[jira] [Commented] (OFBIZ-12722) Fix Java 17 two warning issues

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


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

Jacques Le Roux commented on OFBIZ-12722:
-

For 
{code}
AuthHelper.java:132: warning: [removal] AccessController in java.security has 
been deprecated and marked for removal
return AccessController.doPrivileged(
^
{code}
Since Java 17 will be supported for 3 years we could (temporary?)  add 
{{@SuppressWarnings({ "removal", "deprecation" })}} to 
{{AuthHelper::getContextClassLoader}}. We could handle that later when the 
removal will be inevitable.


> Fix Java 17 two warning issues
> --
>
> Key: OFBIZ-12722
> URL: https://issues.apache.org/jira/browse/OFBIZ-12722
> Project: OFBiz
>  Issue Type: Task
>  Components: base, testtools
>Affects Versions: Upcoming Branch
>Reporter: Jacques Le Roux
>Priority: Minor
>
> AuthHelper.java:132: warning: [removal] AccessController in java.security has 
> been deprecated and marked for removal
> return AccessController.doPrivileged(
>^
> GroovyScriptTestCase.java:29: warning: [deprecation] GroovyTestCase in 
> groovy.util has been deprecated
> public class GroovyScriptTestCase extends GroovyTestCase {



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


[jira] [Created] (OFBIZ-12722) Fix Java 17 two warning issues

2022-12-08 Thread Jacques Le Roux (Jira)
Jacques Le Roux created OFBIZ-12722:
---

 Summary: Fix Java 17 two warning issues
 Key: OFBIZ-12722
 URL: https://issues.apache.org/jira/browse/OFBIZ-12722
 Project: OFBiz
  Issue Type: Task
  Components: testtools, base
Affects Versions: Upcoming Branch
Reporter: Jacques Le Roux


AuthHelper.java:132: warning: [removal] AccessController in java.security has 
been deprecated and marked for removal
return AccessController.doPrivileged(
   ^
GroovyScriptTestCase.java:29: warning: [deprecation] GroovyTestCase in 
groovy.util has been deprecated
public class GroovyScriptTestCase extends GroovyTestCase {



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


[jira] [Assigned] (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:all-tabpanel
 ]

Ioan Eugen Stan reassigned OFBIZ-12721:
---

Assignee: Ioan Eugen Stan

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