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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033367
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajoralways2016-06-28 10:512016-08-11 18:40
ReportercaristuView Statuspublic 
Assigned Tocaristu 
PrioritynormalResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revision94d8c7dd940c
ProjectionnoneETAnoneTarget Version3.0PR16Q4
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033367: testChangedClasses method in SystemServiceTest does not calculate the past date correctly

DescriptionThe 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 [^]
Steps To Reproduce1) 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 [^]
Proposed SolutionApply one of the proposed solutions explained here: http://stackoverflow.com/a/6866756 [^]
TagsNo tags attached.
Attached Filesdiff file icon issue33367.diff [^] (764 bytes) 2016-06-28 10:54 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0088552)
hgbot (developer)
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 (manager)
2016-07-22 10:23

code reviewed
(0089019)
hudsonbot (developer)
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

- Issue History
Date Modified Username Field Change
2016-06-28 10:51 caristu New Issue
2016-06-28 10:51 caristu Assigned To => platform
2016-06-28 10:51 caristu Modules => Core
2016-06-28 10:51 caristu Triggers an Emergency Pack => No
2016-06-28 10:51 caristu Assigned To platform => caristu
2016-06-28 10:51 caristu Status new => scheduled
2016-06-28 10:52 caristu Target Version => 3.0PR16Q4
2016-06-28 10:54 caristu File Added: issue33367.diff
2016-07-18 13:27 hgbot Checkin
2016-07-18 13:27 hgbot Note Added: 0088552
2016-07-18 13:27 hgbot Status scheduled => resolved
2016-07-18 13:27 hgbot Resolution open => fixed
2016-07-18 13:27 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/94d8c7dd940c035bd529a20db04407a9a82b4b23 [^]
2016-07-18 13:28 caristu Review Assigned To => alostale
2016-07-18 13:28 caristu Issue Monitored: alostale
2016-07-22 10:23 alostale Note Added: 0088624
2016-07-22 10:23 alostale Status resolved => closed
2016-07-22 10:23 alostale Fixed in Version => 3.0PR16Q4
2016-08-11 18:40 hudsonbot Checkin
2016-08-11 18:40 hudsonbot Note Added: 0089019


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker