Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035982Retail ModulesStoreServerpublic2017-05-12 09:522017-05-15 16:21
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
RR17Q3 
mtaal
No
0035982: getMobileServersForOrganization and getNodeIdsForOrganization methods should return copies, not original sets
The MobileServerProvider has two methods that return the list of mobile servers / mobile server keys that have access to a given organization, called getMobileServersForOrganization and getNodeIdsForOrganization respectively.

These methods returns a set given an organization ID. The problem is that if the invokers then modify the set, then the original structure maintained in MobileServerProvider will be modified too.

Those methods should return copies of the original sets, to prevent having those sets modified.
It has been very difficult to reproduce, and only managed to do it in an environment of the BUT's development team when they were testing the Copy Store functionality.

In any case, the change makes a lot of sense, and should be done even if it cannot be reproduced deterministically.

Return a copy of the sets instead of the original ones.

I tested the performance impact of making a copy of a set instead of returning the original one. With a set composed of 300 objects:
- Copying it once took 1ms
- Copying it 100 times took 2 ms
- Copying it 1000 times took 12 ms.
No tags attached.
depends on backport 0035996RR17Q2.1 closed mtaal getMobileServersForOrganization and getNodeIdsForOrganization methods should return copies, not original sets 
Issue History
2017-05-12 09:52AugustoMauchNew Issue
2017-05-12 09:52AugustoMauchAssigned To => AugustoMauch
2017-05-12 09:52AugustoMauchTriggers an Emergency Pack => No
2017-05-12 09:59hgbotCheckin
2017-05-12 09:59hgbotNote Added: 0096545
2017-05-12 09:59hgbotStatusnew => resolved
2017-05-12 09:59hgbotResolutionopen => fixed
2017-05-12 09:59hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/cddd90ada4be19ddf51beb99edc23ac99fd585a5 [^]
2017-05-12 09:59AugustoMauchReview Assigned To => mtaal
2017-05-15 16:17mtaalNote Added: 0096603
2017-05-15 16:17mtaalStatusresolved => closed
2017-05-15 16:17mtaalFixed in Version => RR17Q3
2017-05-15 16:20mtaalNote Added: 0096604
2017-05-15 16:20mtaalStatusclosed => new
2017-05-15 16:20mtaalResolutionfixed => open
2017-05-15 16:20mtaalFixed in VersionRR17Q3 =>
2017-05-15 16:20mtaalStatusnew => scheduled
2017-05-15 16:20mtaalStatusscheduled => resolved
2017-05-15 16:20mtaalResolutionopen => fixed
2017-05-15 16:21mtaalNote Added: 0096605
2017-05-15 16:21mtaalStatusresolved => closed
2017-05-15 16:21mtaalFixed in Version => RR17Q3

Notes
(0096545)
hgbot   
2017-05-12 09:59   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: cddd90ada4be19ddf51beb99edc23ac99fd585a5
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Fri May 12 09:55:29 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/cddd90ada4be19ddf51beb99edc23ac99fd585a5 [^]

Fixes issue 35982: Methods return copies of sets, instead of original sets

The problem was that the MobileServerProvider getMobileServersForOrganization and getNodeIdsForOrganization methods were returning the original sets they maintained to keep track of what servers had access to each organization. If the invoker of those sets then modify them, then the original sets would be modified too.

Those methods must return copies of the sets, and not the original ones.

---
M src/org/openbravo/replication/symmetricds/util/MobileServerProvider.java
---
(0096603)
mtaal   
2017-05-15 16:17   
Reviewed
(0096604)
mtaal   
2017-05-15 16:20   
creating new to create backport issue
(0096605)
mtaal   
2017-05-15 16:21   
back to closed