Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0036834 | Openbravo ERP | A. Platform | public | 2017-09-12 09:03 | 2018-08-08 13:06 |
|
Reporter | alostale | |
Assigned To | caristu | |
Priority | normal | Severity | major | Reproducibility | have not tried |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 3.0PR17Q4 | |
Merge Request Status | |
Review Assigned To | alostale |
OBNetwork customer | |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0036834: jre8: js defaults containing Dates fail |
Description | When there is a default JavaScript value evaluated in server and it use JavaScript Date objects it fails when running in Java 8. |
Steps To Reproduce | 1. Open new Purchase Order Report
-> ERROR:
- Starting Date field is not defaulted (it should be default to today)
- See openbravo.log:
ERROR org.openbravo.client.application.process.DefaultsProcessActionHandler - Error trying getting defaults and Filter Expressions for process: Cannot cast jdk.nashorn.internal.objects.NativeDate to java.util.Date
java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.objects.NativeDate to java.util.Date
at java.lang.invoke.MethodHandleImpl.newClassCastException(MethodHandleImpl.java:361)
at java.lang.invoke.MethodHandleImpl.castReference(MethodHandleImpl.java:356)
at jdk.nashorn.internal.scripts.Script$1$\^eval\_.:program(<eval>:1)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at org.openbravo.client.application.ParameterUtils.getJSExpressionResult(ParameterUtils.java:281)
at org.openbravo.client.application.ParameterUtils.getParameterDefaultValue(ParameterUtils.java:220) |
Proposed Solution | In Java 8 JavaScript engine was changed from Rhino to Nashorn. JavaScript Dates evaluated in server, returned a java.util.Date in Rhino, but with Nashorn they are evaluated to jdk.nashorn.internal.objects.NativeDate. It will be necessary to implement proper casting (through reflection?) to support both Java 7 and 8. |
Additional Information | |
Tags | No tags attached. |
Relationships | related to | feature request | 0033035 | | closed | airaceburu | New filters in Purchase Order Report | related to | feature request | 0031708 | | closed | alostale | support for JDK 8 | depends on | backport | 0036842 | 3.0PR17Q3 | closed | caristu | jre8: js defaults containing Dates fail | depends on | backport | 0036843 | 3.0PR17Q2.4 | closed | caristu | jre8: js defaults containing Dates fail | has duplicate | defect | 0037131 | | closed | platform | Error trying getting defaults and Filter Expressions for process: cast jdk.nashorn.internal.objects.NativeDate to java.util.Date | related to | defect | 0036882 | | closed | caristu | There exists some old callouts in core still not refactored to SimpleCallout | related to | feature request | 0038675 | | closed | alostale | Raise minimum stack Java version to Java 8 |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2017-09-12 09:03 | alostale | New Issue | |
2017-09-12 09:03 | alostale | Assigned To | => platform |
2017-09-12 09:03 | alostale | Modules | => Core |
2017-09-12 09:03 | alostale | Triggers an Emergency Pack | => No |
2017-09-12 09:04 | alostale | Relationship added | related to 0033035 |
2017-09-12 09:04 | alostale | Relationship added | related to 0031708 |
2017-09-12 09:04 | alostale | Status | new => scheduled |
2017-09-12 09:04 | alostale | Assigned To | platform => caristu |
2017-09-13 08:13 | alostale | Status | scheduled => feedback |
2017-09-13 08:13 | alostale | Status | feedback => new |
2017-09-13 08:14 | alostale | Status | new => scheduled |
2017-09-13 10:01 | hgbot | Checkin | |
2017-09-13 10:01 | hgbot | Note Added: 0099005 | |
2017-09-13 10:04 | hgbot | Checkin | |
2017-09-13 10:04 | hgbot | Note Added: 0099006 | |
2017-09-13 10:21 | hgbot | Checkin | |
2017-09-13 10:21 | hgbot | Note Added: 0099007 | |
2017-09-13 10:21 | hgbot | Status | scheduled => resolved |
2017-09-13 10:21 | hgbot | Resolution | open => fixed |
2017-09-13 10:21 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/5b7d3e960bd161c5c6219f69aac12c8bad3e4211 [^] |
2017-09-13 10:21 | caristu | Review Assigned To | => alostale |
2017-09-13 10:38 | hgbot | Checkin | |
2017-09-13 10:38 | hgbot | Note Added: 0099009 | |
2017-09-14 13:38 | alostale | Note Added: 0099041 | |
2017-09-14 13:38 | alostale | Status | resolved => closed |
2017-09-14 13:38 | alostale | Fixed in Version | => 3.0PR17Q4 |
2017-09-14 13:43 | hgbot | Checkin | |
2017-09-14 13:43 | hgbot | Note Added: 0099043 | |
2017-09-20 16:15 | caristu | Relationship added | duplicate of 0036882 |
2017-09-20 16:15 | caristu | Relationship deleted | 0036882 |
2017-09-20 16:15 | caristu | Relationship added | related to 0036882 |
2017-09-21 16:50 | hudsonbot | Checkin | |
2017-09-21 16:50 | hudsonbot | Note Added: 0099385 | |
2017-09-21 16:50 | hudsonbot | Checkin | |
2017-09-21 16:50 | hudsonbot | Note Added: 0099386 | |
2017-09-21 16:50 | hudsonbot | Checkin | |
2017-09-21 16:50 | hudsonbot | Note Added: 0099387 | |
2017-09-21 16:50 | hudsonbot | Checkin | |
2017-09-21 16:50 | hudsonbot | Note Added: 0099388 | |
2017-09-21 16:50 | hudsonbot | Checkin | |
2017-09-21 16:50 | hudsonbot | Note Added: 0099393 | |
2017-10-20 11:18 | caristu | Relationship added | has duplicate 0037131 |
2018-06-19 13:21 | caristu | Relationship added | related to 0038675 |
2018-07-20 12:26 | hgbot | Checkin | |
2018-07-20 12:26 | hgbot | Note Added: 0105833 | |
2018-07-20 12:26 | hgbot | Checkin | |
2018-07-20 12:26 | hgbot | Note Added: 0105834 | |
2018-08-08 13:06 | hudsonbot | Checkin | |
2018-08-08 13:06 | hudsonbot | Note Added: 0106216 | |
2018-08-08 13:06 | hudsonbot | Checkin | |
2018-08-08 13:06 | hudsonbot | Note Added: 0106217 | |
Notes |
|
(0099005)
|
hgbot
|
2017-09-13 10:01
|
|
Repository: erp/devel/pi
Changeset: c919c3df85385e28e75a9ada49fe51980d4106ce
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Sep 13 09:59:56 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c919c3df85385e28e75a9ada49fe51980d4106ce [^]
related to issue 36834: Added test case for OBBindings
---
M src-test/src/org/openbravo/test/AllAntTaskTests.java
M src-test/src/org/openbravo/test/AllTests.java
M src-test/src/org/openbravo/test/AntTaskTests.java
A src-test/src/org/openbravo/test/expression/OBBindingsTest.java
---
|
|
|
(0099006)
|
hgbot
|
2017-09-13 10:04
|
|
|
|
(0099007)
|
hgbot
|
2017-09-13 10:21
|
|
Repository: erp/devel/pi
Changeset: 5b7d3e960bd161c5c6219f69aac12c8bad3e4211
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Sep 13 10:17:23 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5b7d3e960bd161c5c6219f69aac12c8bad3e4211 [^]
fixes issue 36834: js defaults containing Dates fail in JRE8
In Java 8 JavaScript engine was changed from Rhino to Nashorn. JavaScript Dates evaluated in server, returned a java.util.Date in Rhino, but with Nashorn they are evaluated to jdk.nashorn.internal.objects.NativeDate.
This change caused a ClassCastException in JRE8 when invoking the methods of OBBindings which receive a java.util.Date as an argument. To fix the problem those methods have been overloaded by receiving an Object as argument. Therefore these methods will be invoked when working with JRE8, and we use reflection to retrieve the time information avoiding using classes which are not supported in JRE7.
---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java
---
|
|
|
(0099009)
|
hgbot
|
2017-09-13 10:38
|
|
Repository: erp/devel/pi
Changeset: 941a129396ad3229b028c9f35dd150cb2e3e0739
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Sep 13 10:38:03 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/941a129396ad3229b028c9f35dd150cb2e3e0739 [^]
related to issue 36834: Use correct test name in test suites
---
M src-test/src/org/openbravo/test/AllAntTaskTests.java
M src-test/src/org/openbravo/test/AllTests.java
M src-test/src/org/openbravo/test/AntTaskTests.java
---
|
|
|
|
reviewed
tested with java 7 and 8 in both cases working correctly |
|
|
(0099043)
|
hgbot
|
2017-09-14 13:43
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(0105833)
|
hgbot
|
2018-07-20 12:26
|
|
Repository: erp/devel/pi
Changeset: c925911a5c0b828919db48dec7ba1b423be3179d
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Jul 11 09:03:01 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c925911a5c0b828919db48dec7ba1b423be3179d [^]
[jdk8] related to bug 36834: removed support for rhino JS engine
There were some reflective code intented to support JS engines present in different
JDK versions: Rhino in JDK <= 7 and Nashorn startinf from JDK 8.
Notes:
* Date JavaScript objects have been kept as Object rather than NativeDate
(ie. formatDate(Object d)) because Nashorn NativeDate.getDate, API accepts
Object because it checks whether it is in the JavaScript prototype hierarchy
of JS Date.
* We are relying on jdk.nashorn.internal package which can be somehow problematic,
but as even NativeDate is in that package and we were in practice through
reflection assuming the object was of that type, there should not be a real
difference.
* In JDK 11, Nashorn is deprecated for removal (JEP 335) with no alternative
so far. Once actual removal occurs in some future JDK, this code will stop
working.
---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java
---
|
|
|
(0105834)
|
hgbot
|
2018-07-20 12:26
|
|
Repository: erp/devel/pi
Changeset: 24c23f55ecef74986c8cc5a46d42230dfd5e14b0
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Jul 16 13:07:51 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/24c23f55ecef74986c8cc5a46d42230dfd5e14b0 [^]
[jdk8] related to bug 36834: backed out changeset c925911a5c0b
Even in JDK8, Nashorn's jdk.nashorn.internal.objects.NativeDate is publicly
accessible, in JDK9+ it is in a closed module so not longer accessible API.
We need to continue using reflection to make it work.
---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java
---
|
|
|
|
|
|
|
|