Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0045359 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Retail Modules] Web POS | major | random | 2020-11-02 18:22 | 2020-11-19 08:06 | |||
Reporter | aaroncalero | View Status | public | |||||
Assigned To | prakashmurugesan88 | |||||||
Priority | high | Resolution | fixed | Fixed in Version | RR21Q1 | |||
Status | closed | Fix in branch | Fixed in SCM revision | |||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | approved | |||||||
Review Assigned To | ||||||||
OBNetwork customer | Gold | |||||||
Support ticket | ||||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0045359: Static Dateformatter in JSONPropertyToEntity.java can cause random errors if accessed simultaneously | |||||||
Description | Java DateFormatters are not thread-safe, so when a formatter is defined as static and accessed simultaneously, it can behave incorrectly. There is a static DateFormatter in JSONPropertyToEntity, which is in charge of parsing json objects to set properties to entities. If this class is invoked from two different threads, and two date properties are processed at the same time, one of them could fail. | |||||||
Steps To Reproduce | It is not possible to reproduce this manually, but we have seen the following error in a client environment: 2020-11-01 10:17:58,164 [http-11] ERROR org.openbravo.retail.posterminal.CustomerAddrLoader - Exception while updating BPartner Address java.lang.NumberFormatException: For input string: "2020-10-03T14:20:42+02:00" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_232] at java.lang.Long.parseLong(Long.java:589) ~[?:1.8.0_232] at java.lang.Long.valueOf(Long.java:803) ~[?:1.8.0_232] at org.openbravo.mobile.core.process.JSONPropertyToEntity.fillBobFromJSON(JSONPropertyToEntity.java:113) ~[classes/:?] at org.openbravo.mobile.core.process.JSONPropertyToEntity.fillBobFromJSON(JSONPropertyToEntity.java:37) ~[classes/:?] at org.openbravo.retail.posterminal.CustomerAddrLoader.editBPartnerAddr(CustomerAddrLoader.java:191) [classes/:?] | |||||||
Proposed Solution | The static modifier here[1] should be removed, and a new dateFormatter instance should be created each time it is needed. [1] https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/src/org/openbravo/mobile/core/process/JSONPropertyToEntity.java#L33 [^] Examples of other issues where the same fix was applied: 0040474, 0040934 | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
![]() |
|
![]() |
|
(0124499) hgbot (developer) 2020-11-19 06:53 |
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/104 [^] |
(0124500) hgbot (developer) 2020-11-19 08:06 |
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/104 [^] |
(0124501) hgbot (developer) 2020-11-19 08:06 |
Directly closing issue as related merge request is already approved. Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^] Changeset: f63be5ebbbe2b15057fe48ecf86818cc4c8c34dc Author: Prakash M <prakash@qualiantech.com> Date: 2020-11-19T11:15:53+05:30 URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/f63be5ebbbe2b15057fe48ecf86818cc4c8c34dc [^] Fixed BUG-45359: Fixes NumberFormatExceptions when JSONPropertyToEntity is called simultaneously * If JSONPropertyToEntity is called same time from multiple request, error occurs while parsing date due to static identifier for DateFormat. --- M src/org/openbravo/mobile/core/process/JSONPropertyToEntity.java --- |
![]() |
|||
Date Modified | Username | Field | Change |
2020-11-02 18:22 | aaroncalero | New Issue | |
2020-11-02 18:22 | aaroncalero | Assigned To | => Retail |
2020-11-02 18:22 | aaroncalero | OBNetwork customer | => Gold |
2020-11-02 18:22 | aaroncalero | Resolution time | => 1606086000 |
2020-11-02 18:22 | aaroncalero | Triggers an Emergency Pack | => No |
2020-11-19 06:10 | prakashmurugesan88 | Assigned To | Retail => prakashmurugesan88 |
2020-11-19 06:10 | prakashmurugesan88 | Status | new => scheduled |
2020-11-19 06:53 | hgbot | Merge Request Status | => open |
2020-11-19 06:53 | hgbot | Note Added: 0124499 | |
2020-11-19 08:06 | hgbot | Merge Request Status | open => approved |
2020-11-19 08:06 | hgbot | Resolution | open => fixed |
2020-11-19 08:06 | hgbot | Status | scheduled => closed |
2020-11-19 08:06 | hgbot | Note Added: 0124500 | |
2020-11-19 08:06 | hgbot | Fixed in Version | => RR21Q1 |
2020-11-19 08:06 | hgbot | Note Added: 0124501 |
Copyright © 2000 - 2009 MantisBT Group |