Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033367Openbravo ERPA. Platformpublic2016-06-28 10:512016-08-11 18:40
caristu 
caristu 
normalmajoralways
closedfixed 
5
 
3.0PR16Q43.0PR16Q4 
alostale
Core
No
0033367: testChangedClasses method in SystemServiceTest does not calculate the past date correctly
The SystemServiceTest in testChangedClasses is not calculating the 600 days in the past date correctly. It uses the following:

final Date past = new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * 600));

If the number of days is over 24, the resulting value is larger than Integer.MAX_VALUE and the value overflows. So, the resulting past date is a future date.

More info: http://stackoverflow.com/a/6866756 [^]
1) Debug the SystemServiceTest, placing a breakpoint in the following line[1]
2) Notice that the date calculated is NOT 600 days in the past

[1] https://code.openbravo.com/erp/devel/pi/file/cc5f703395d6/src-test/src/org/openbravo/test/system/SystemServiceTest.java#l87 [^]
Apply one of the proposed solutions explained here: http://stackoverflow.com/a/6866756 [^]
No tags attached.
diff issue33367.diff (764) 2016-06-28 10:54
https://issues.openbravo.com/file_download.php?file_id=9589&type=bug
Issue History
2016-06-28 10:51caristuNew Issue
2016-06-28 10:51caristuAssigned To => platform
2016-06-28 10:51caristuModules => Core
2016-06-28 10:51caristuTriggers an Emergency Pack => No
2016-06-28 10:51caristuAssigned Toplatform => caristu
2016-06-28 10:51caristuStatusnew => scheduled
2016-06-28 10:52caristuTarget Version => 3.0PR16Q4
2016-06-28 10:54caristuFile Added: issue33367.diff
2016-07-18 13:27hgbotCheckin
2016-07-18 13:27hgbotNote Added: 0088552
2016-07-18 13:27hgbotStatusscheduled => resolved
2016-07-18 13:27hgbotResolutionopen => fixed
2016-07-18 13:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/94d8c7dd940c035bd529a20db04407a9a82b4b23 [^]
2016-07-18 13:28caristuReview Assigned To => alostale
2016-07-18 13:28caristuIssue Monitored: alostale
2016-07-22 10:23alostaleNote Added: 0088624
2016-07-22 10:23alostaleStatusresolved => closed
2016-07-22 10:23alostaleFixed in Version => 3.0PR16Q4
2016-08-11 18:40hudsonbotCheckin
2016-08-11 18:40hudsonbotNote Added: 0089019

Notes
(0088552)
hgbot   
2016-07-18 13:27   
Repository: erp/devel/pi
Changeset: 94d8c7dd940c035bd529a20db04407a9a82b4b23
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon Jul 18 13:26:10 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/94d8c7dd940c035bd529a20db04407a9a82b4b23 [^]

fixes issue 33367: testChangedClasses doesn't calculate the past date correctly
600 days in milliseconds overflows Integer.MAX_VALUE, so the resulting past Date using that value was not correct. Now the value is turned into long before substracting it to the current time.

---
M src-test/src/org/openbravo/test/system/SystemServiceTest.java
---
(0088624)
alostale   
2016-07-22 10:23   
code reviewed
(0089019)
hudsonbot   
2016-08-11 18:40   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/edaa05b1fb18 [^]
Maturity status: Test