Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0045359
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSmajorrandom2020-11-02 18:222020-11-19 08:06
ReporteraaroncaleroView Statuspublic 
Assigned Toprakashmurugesan88 
PriorityhighResolutionfixedFixed in VersionRR21Q1
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0045359: Static Dateformatter in JSONPropertyToEntity.java can cause random errors if accessed simultaneously

DescriptionJava 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 ReproduceIt 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 SolutionThe 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
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(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
---

- Issue History
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 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 Note Added: 0124499
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
Powered by Mantis Bugtracker