Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0040474 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Retail Modules] Sessions | major | random | 2019-03-28 11:05 | 2019-05-22 10:40 | |||
Reporter | aaroncalero | View Status | public | |||||
Assigned To | ranjith_qualiantech_com | |||||||
Priority | high | Resolution | fixed | Fixed in Version | RR19Q3 | |||
Status | closed | Fix in branch | Fixed in SCM revision | 7a3c2345e928 | ||||
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 | ||||||||
Review Assigned To | adrianromero | |||||||
OBNetwork customer | Gold | |||||||
Support ticket | 9186 | |||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0040474: [Sessions] Completing multiple cashups simultaneously can cause NumberFormatExceptions | |||||||
Description | With the Sessions module installed, completing multiple cashups at the same time (which can happen in a production environment when all terminales close the cashups at the same time) can lead to NumberFormatException thrown in the server, leaving some of the cashups in the Errors While Importing POS Data window, with the following error*: java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:601) at java.lang.Long.parseLong(Long.java:631) at java.text.DigitList.getLong(DigitList.java:195) at java.text.DecimalFormat.parse(DecimalFormat.java:2051) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1869) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1514) at java.text.DateFormat.parse(DateFormat.java:364) at org.openbravo.retail.sessions.CloseSessionHook.exec(CloseSessionHook.java:33) at org.openbravo.retail.posterminal.CashCloseProcessor.executeHooks(CashCloseProcessor.java:185) at org.openbravo.retail.posterminal.CashCloseProcessor.processCashClose(CashCloseProcessor.java:160) * The NumberFormatException can vary (or the parsed date can be simply wrong): java.lang.NumberFormatException: For input string: "" java.lang.NumberFormatException: multiple points java.lang.NumberFormatException: empty String | |||||||
Steps To Reproduce | it is really hard to reproduce the issue manually/with an automated test, but the problem can be simulated using the attached patch. The attached patch replicates the code found in the CloseSessionHook file[1], a static SimpleDateFormat and multiple accesses to its parse method. 1. Apply the patch, compile the application and start the server 2. Login in backend 3. Click on Help > About. 4. Verify in the server log that some exceptions are shown, and that the date has been parsed wrongly in some cases. [1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.sessions/file/tip/src/org/openbravo/retail/sessions/CloseSessionHook.java [^] | |||||||
Proposed Solution | In the CloseSessionHook.java file the static modifier of the date formatter should be removed. | |||||||
Tags | No tags attached. | |||||||
Attached Files | ![]() ![]() | |||||||
![]() |
||||||||
|
![]() |
|
(0110985) hgbot (developer) 2019-04-05 08:43 |
Repository: erp/pmods/org.openbravo.retail.sessions Changeset: 166fa5e25c4d01ffd06727d63c95da85748f022c Author: Ranjith S R <ranjith <at> qualiantech.com> Date: Fri Apr 05 12:12:45 2019 +0530 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.sessions/rev/166fa5e25c4d01ffd06727d63c95da85748f022c [^] Related to issue 40474 : Updated CloseSessionHook to parse Business Date * If CloseSessionHook is called same time from multiple request, error occurs while parsing business date due to static identifier for DateFormat. --- M src/org/openbravo/retail/sessions/CloseSessionHook.java --- |
(0111126) adrianromero (viewer) 2019-04-15 12:31 |
The change moves the SimpleDateFormat instance to the method body instead of having an static instance. This is OK as SimpleDateFormat is not thread safe as indicated in the issue report. But the change also captures the Exception when parsing and swallows it. The behaviour in case of exception must not be modified. The try - catch block around parse must be removed. |
(0111130) hgbot (developer) 2019-04-15 12:49 |
Repository: erp/pmods/org.openbravo.retail.sessions Changeset: 7a3c2345e928587fcc716b25c130fe8405416910 Author: Ranjith S R <ranjith <at> qualiantech.com> Date: Mon Apr 15 16:19:19 2019 +0530 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.sessions/rev/7a3c2345e928587fcc716b25c130fe8405416910 [^] Fixed issue 40474 : Updated CloseSessionHook to parse Business Date * try-catch was removed. So it will follow the normal flow when exception occurred --- M src/org/openbravo/retail/sessions/CloseSessionHook.java --- |
(0111133) adrianromero (viewer) 2019-04-15 13:15 |
Verified |
![]() |
|||
Date Modified | Username | Field | Change |
2019-03-28 11:05 | aaroncalero | New Issue | |
2019-03-28 11:05 | aaroncalero | Assigned To | => Retail |
2019-03-28 11:05 | aaroncalero | File Added: SimulateNumberFormatException.diff | |
2019-03-28 11:05 | aaroncalero | OBNetwork customer | => Gold |
2019-03-28 11:05 | aaroncalero | Resolution time | => 1554933600 |
2019-03-28 11:05 | aaroncalero | Triggers an Emergency Pack | => No |
2019-03-28 12:20 | ranjith_qualiantech_com | Assigned To | Retail => ranjith_qualiantech_com |
2019-03-29 11:17 | ranjith_qualiantech_com | Status | new => scheduled |
2019-03-29 11:24 | ranjith_qualiantech_com | File Added: issue 40474 source sessions.patch | |
2019-04-04 10:01 | ngarcia | Issue Monitored: ngarcia | |
2019-04-04 11:01 | ngarcia | Support ticket | => 9186 |
2019-04-05 08:43 | hgbot | Checkin | |
2019-04-05 08:43 | hgbot | Note Added: 0110985 | |
2019-04-07 08:30 | ranjith_qualiantech_com | Status | scheduled => resolved |
2019-04-07 08:30 | ranjith_qualiantech_com | Resolution | open => fixed |
2019-04-15 12:31 | adrianromero | Note Added: 0111126 | |
2019-04-15 12:31 | adrianromero | Status | resolved => new |
2019-04-15 12:31 | adrianromero | Resolution | fixed => open |
2019-04-15 12:47 | ranjith_qualiantech_com | Status | new => scheduled |
2019-04-15 12:49 | hgbot | Checkin | |
2019-04-15 12:49 | hgbot | Note Added: 0111130 | |
2019-04-15 12:49 | hgbot | Status | scheduled => resolved |
2019-04-15 12:49 | hgbot | Resolution | open => fixed |
2019-04-15 12:49 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.retail.sessions/rev/7a3c2345e928587fcc716b25c130fe8405416910 [^] |
2019-04-15 13:15 | adrianromero | Review Assigned To | => adrianromero |
2019-04-15 13:15 | adrianromero | Note Added: 0111133 | |
2019-04-15 13:15 | adrianromero | Status | resolved => closed |
2019-04-15 13:15 | adrianromero | Fixed in Version | => RR19Q3 |
2019-05-22 10:40 | ngarcia | Issue cloned | 0040934 |
2019-05-22 10:40 | ngarcia | Relationship added | related to 0040934 |
Copyright © 2000 - 2009 MantisBT Group |