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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0036762
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajorsometimes2017-09-01 12:102017-09-21 16:49
ReporterJONHMView Statuspublic 
Assigned Tocaristu 
PriorityhighResolutionfixedFixed in Version3.0PR17Q4
StatusclosedFix in branchFixed in SCM revision1db6083af55b
ProjectionnoneETAnoneTarget Version
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

0036762: Window personalization list can not be loaded properly due to an error during its sorting

DescriptionWindow personalization list can not be loaded properly due to an error during its sorting.

The list of personalizations for a tab is sorted[1] before returning it to the client.

Since Java 7 Collections.sort uses TimSort. Using a non-transitive comparator for sorting in Java >= 7 will throw the following exception: java.lang.IllegalArgumentException: Comparison method violates its general contract!

And the PersonalizationComparator is not transitive when checking the priority by client.

[1] https://code.openbravo.com/erp/devel/pi/file/4fa54a2fb83d/modules/org.openbravo.client.application/src/org/openbravo/client/application/personalization/PersonalizationHandler.java#l270 [^]
[2] https://code.openbravo.com/erp/devel/pi/file/4fa54a2fb83d/modules/org.openbravo.client.application/src/org/openbravo/client/application/personalization/PersonalizationHandler.java#l601 [^]
Steps To ReproduceOption A:

** Ask the environment to Support department **

1) Open 'Window Personalization' window and set active every views for user 'Diego' and window 'Product' (there will be 21)
2) Open 'Product' window and click the 'Save View' button on the toolbar. The following error is fired in the log (see attached the full log):

Caused by: org.openbravo.base.exception.OBException: Exception when getting personalization settings for window ADWindow(140) (name: Product)
    at org.openbravo.client.application.personalization.PersonalizationHandler.getPersonalizationsForWindow(PersonalizationHandler.java:254)
    at org.openbravo.client.application.personalization.PersonalizationHandler.getPersonalizationForWindow(PersonalizationHandler.java:98)
    ... 57 more
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
    at java.util.TimSort.mergeHi(TimSort.java:895)
    at java.util.TimSort.mergeAt(TimSort.java:512)
    at java.util.TimSort.mergeCollapse(TimSort.java:437)
    at java.util.TimSort.sort(TimSort.java:241)
    at java.util.Arrays.sort(Arrays.java:1512)
    at java.util.ArrayList.sort(ArrayList.java:1454)
    at java.util.Collections.sort(Collections.java:175)
    at org.openbravo.client.application.personalization.PersonalizationHandler.sortPersonalizations(PersonalizationHandler.java:270)
    at org.openbravo.client.application.personalization.PersonalizationHandler.getPersonalizationsForWindow(PersonalizationHandler.java:251)
    ... 58 more


Option B:

1) Attached is patch with a test case that checks if the PersonalizationHandler is transitive. Apply it.
2) Run test.
Proposed SolutionChange the PersonalizationHandler in order to fulfill the Comparable[1] contract.

[1] http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Comparable.html [^]
TagsNo tags attached.
Attached Files? file icon personalizationView.mp4 [^] (4,128,920 bytes) 2017-09-01 12:10
txt file icon stackTrace.txt [^] (6,777 bytes) 2017-09-05 18:29 [Show Content]
diff file icon testIssue36762.diff [^] (4,118 bytes) 2017-09-06 09:14 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0098854)
hgbot (developer)
2017-09-05 18:38

Repository: erp/devel/pi
Changeset: 269bf16d019e6366d087cec1995af2c8d870d41f
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Sep 05 18:37:33 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/269bf16d019e6366d087cec1995af2c8d870d41f [^]

related to issue 36762: minor code clean-up
  - Use org.slf4j.Logger to log
  - Added an error log message
  - Remove unneeded comments
  - Use diamond operator
  - Updated copyright year

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/personalization/PersonalizationHandler.java
---
(0098857)
hgbot (developer)
2017-09-06 08:59

Repository: erp/devel/pi
Changeset: 1db6083af55beef5807175ef1ec7147a1410168e
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Sep 06 08:58:05 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/1db6083af55beef5807175ef1ec7147a1410168e [^]

fixes bug 36762: The comparator to sort window personalizations wasn't complete

  Since Java 7 Collections.sort uses TimSort. Using a non-transitive comparator for sorting in Java >= 7 can throw the following exception: "java.lang.IllegalArgumentException: Comparison method violates its general contract!" depending on the comparisons performed by the comparator.

  The PersonalizationComparator violated the Comparable contract when checking the priority by client between two window personalizations to calculate their position. Now this problem has been solved.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/personalization/PersonalizationHandler.java
---
(0098905)
alostale (developer)
2017-09-08 12:18

reviewed + tested
(0099361)
hudsonbot (developer)
2017-09-21 16:49

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/9750b78d3e5c [^]
Maturity status: Test
(0099363)
hudsonbot (developer)
2017-09-21 16:49

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/9750b78d3e5c [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2017-09-01 12:10 JONHM New Issue
2017-09-01 12:10 JONHM Assigned To => platform
2017-09-01 12:10 JONHM Modules => Core
2017-09-01 12:10 JONHM Triggers an Emergency Pack => No
2017-09-01 12:10 JONHM File Added: personalizationView.mp4
2017-09-05 18:29 caristu Summary 'Save button' on the toolbar is not shown when containing many views having its personalization too complex => Window personalization list can not be loaded properly due to an error during its sorting
2017-09-05 18:29 caristu Description Updated View Revisions
2017-09-05 18:29 caristu Steps to Reproduce Updated View Revisions
2017-09-05 18:29 caristu Proposed Solution updated
2017-09-05 18:29 caristu File Added: stackTrace.txt
2017-09-05 18:30 caristu File Added: testIssue36762.diff
2017-09-05 18:31 caristu Steps to Reproduce Updated View Revisions
2017-09-05 18:38 hgbot Checkin
2017-09-05 18:38 hgbot Note Added: 0098854
2017-09-05 18:39 caristu Assigned To platform => caristu
2017-09-05 18:56 caristu Status new => acknowledged
2017-09-05 18:57 caristu Status acknowledged => scheduled
2017-09-06 08:59 hgbot Checkin
2017-09-06 08:59 hgbot Note Added: 0098857
2017-09-06 08:59 hgbot Status scheduled => resolved
2017-09-06 08:59 hgbot Resolution open => fixed
2017-09-06 08:59 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/1db6083af55beef5807175ef1ec7147a1410168e [^]
2017-09-06 09:06 caristu Review Assigned To => alostale
2017-09-06 09:14 caristu File Deleted: testIssue36762.diff
2017-09-06 09:14 caristu File Added: testIssue36762.diff
2017-09-08 12:18 alostale Note Added: 0098905
2017-09-08 12:18 alostale Status resolved => closed
2017-09-08 12:18 alostale Fixed in Version => 3.0PR17Q4
2017-09-21 16:49 hudsonbot Checkin
2017-09-21 16:49 hudsonbot Note Added: 0099361
2017-09-21 16:49 hudsonbot Checkin
2017-09-21 16:49 hudsonbot Note Added: 0099363


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker