Openbravo Issue Tracking System - Openbravo ERP | ||||||||||||
View Issue Details | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
0020129 | Openbravo ERP | A. Platform | public | 2012-03-27 17:44 | 2012-05-25 12:10 | |||||||
Reporter | mirurita | |||||||||||
Assigned To | AugustoMauch | |||||||||||
Priority | normal | Severity | major | Reproducibility | always | |||||||
Status | closed | Resolution | fixed | |||||||||
Platform | OS | 5 | OS Version | |||||||||
Product Version | pi | |||||||||||
Target Version | Fixed in Version | 3.0MP12 | ||||||||||
Merge Request Status | ||||||||||||
Review Assigned To | ||||||||||||
OBNetwork customer | ||||||||||||
Web browser | ||||||||||||
Modules | Core | |||||||||||
Support ticket | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0020129: OBContext class getters returning a reference to the class instance attributes (not a new instance of the attribute) | |||||||||||
Description | OrganizationStructureProvider OBContext class stores for all accessible clients the corresponding OrganizationStructureProvider. Using the public API if you get the OrganizationStructureProvider of your client and then you query (i.e.) for the children organization the object you get is a reference of the attribute of OrganizationStructureProvider (not a new instance). Set<String> orgIds = OBContext.getOBContext().getOrganizationStructureProvider() .getChildOrg(legalEntity.getId()); // When you add a new element to the list you are modifying the "global" list orgIds.add(legalEntity.getId()); In OBContext class there are more examples: private String[] readableOrganizations; public String[] getReadableOrganizations() private String[] readableClients; public String[] getReadableClients() ... Review all the attributes of OBContext class. | |||||||||||
Steps To Reproduce | 1) Check the value of the following attribute of OrganizationStructureProvider class: private Map<String, Set<String>> childByOrganizationID = new HashMap<String, Set<String>>(); 2) Execute this code Set<String> orgIds = OBContext.getOBContext().getOrganizationStructureProvider() .getChildOrg(legalEntity.getId()); orgIds.add("MY CODE"); 3) Check again the value of: private Map<String, Set<String>> childByOrganizationID = new HashMap<String, Set<String>>(); Realize that "MY CODE" is a new element of the Map. | |||||||||||
Proposed Solution | Return a new instance of the attribute, for example: // BEFORE public Set<String> getNaturalTree(String orgId) { initialize(); Set<String> result = naturalTreesByOrgID.get(orgId); if (result == null) { result = new HashSet<String>(); result.add(orgId); } return result; } // AFTER public Set<String> getNaturalTree(String orgId) { initialize(); Set<String> result; if (naturalTreesByOrgID.get(orgId) == null) { result = new HashSet<String>(); result.add(orgId); } else { result = new HashSet<String>(naturalTreesByOrgID.get(orgId)); } return result; } | |||||||||||
Additional Information | ||||||||||||
Tags | No tags attached. | |||||||||||
Relationships |
| |||||||||||
Attached Files | 20129.diff (1,772) 2012-03-28 07:23 https://issues.openbravo.com/file_download.php?file_id=5099&type=bug issue20129.diff (11,044) 2012-04-24 17:53 https://issues.openbravo.com/file_download.php?file_id=5167&type=bug | |||||||||||
Issue History | ||||||||||||
Date Modified | Username | Field | Change | |||||||||
2012-03-27 17:44 | mirurita | New Issue | ||||||||||
2012-03-27 17:44 | mirurita | Assigned To | => alostale | |||||||||
2012-03-27 17:44 | mirurita | Modules | => Core | |||||||||
2012-03-28 07:23 | iperdomo | File Added: 20129.diff | ||||||||||
2012-03-28 07:40 | iperdomo | Target Version | => 3.0MP8.2 | |||||||||
2012-03-28 10:39 | alostale | Target Version | 3.0MP8.2 => 3.0MP11 | |||||||||
2012-04-18 11:29 | alostale | Assigned To | alostale => AugustoMauch | |||||||||
2012-04-24 09:37 | AugustoMauch | Target Version | 3.0MP11 => | |||||||||
2012-04-24 17:53 | AugustoMauch | File Added: issue20129.diff | ||||||||||
2012-05-03 11:45 | hgbot | Checkin | ||||||||||
2012-05-03 11:45 | hgbot | Note Added: 0048313 | ||||||||||
2012-05-03 11:45 | hgbot | Status | new => resolved | |||||||||
2012-05-03 11:45 | hgbot | Resolution | open => fixed | |||||||||
2012-05-03 11:45 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/0a67797edc7089222d09584f5254666e98b2a28f [^] | |||||||||
2012-05-03 11:49 | AugustoMauch | Note Added: 0048314 | ||||||||||
2012-05-03 12:15 | AugustoMauch | Note Added: 0048316 | ||||||||||
2012-05-03 17:10 | hgbot | Checkin | ||||||||||
2012-05-03 17:10 | hgbot | Note Added: 0048354 | ||||||||||
2012-05-04 17:57 | alostale | Relationship added | blocks 0020424 | |||||||||
2012-05-07 11:18 | hgbot | Checkin | ||||||||||
2012-05-07 11:18 | hgbot | Note Added: 0048404 | ||||||||||
2012-05-16 08:41 | alostale | Note Added: 0048673 | ||||||||||
2012-05-16 08:41 | alostale | Status | resolved => closed | |||||||||
2012-05-16 08:41 | alostale | Fixed in Version | => 3.0MP12 | |||||||||
2012-05-25 12:09 | hudsonbot | Checkin | ||||||||||
2012-05-25 12:09 | hudsonbot | Note Added: 0048998 | ||||||||||
2012-05-25 12:09 | hudsonbot | Checkin | ||||||||||
2012-05-25 12:09 | hudsonbot | Note Added: 0049017 | ||||||||||
2012-05-25 12:10 | hudsonbot | Checkin | ||||||||||
2012-05-25 12:10 | hudsonbot | Note Added: 0049034 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|