Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0055215 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [POS2] POS | major | sometimes | 2024-04-17 11:08 | 2024-05-10 08:53 | |||
Reporter | malsasua | View Status | public | |||||
Assigned To | sreehari | |||||||
Priority | high | Resolution | unable to reproduce | Fixed in Version | ||||
Status | closed | Fix in branch | Fixed in SCM revision | |||||
Projection | none | ETA | none | Target Version | 24Q2 | |||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Review Assigned To | marvintm | |||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0055215: Keymap goes to EWI if the product doesn't exist in obpos2_keymap_product and the JSON doesn't include the product property | |||||||
Description | The error shown is: org.openbravo.base.exception.OBException: org.openbravo.pos2.OBPOS2KeymapProduct product is a mandatory field to create a new org.openbravo.pos2.OBPOS2KeymapProduct from Web Pos at org.openbravo.pos2.KeymapLoader.checkMandatoryFields(KeymapLoader.java:340) at org.openbravo.pos2.KeymapLoader.createEntity(KeymapLoader.java:253) at org.openbravo.pos2.KeymapLoader.processEntity(KeymapLoader.java:293) at org.openbravo.pos2.KeymapLoader.processEntity(KeymapLoader.java:329) at org.openbravo.pos2.KeymapLoader.saveRecord(KeymapLoader.java:111) at org.openbravo.mobile.core.process.DataSynchronizationProcess.saveRecord(DataSynchronizationProcess.java:214) | |||||||
Steps To Reproduce | No reproduced Analyzing Terminal Log (attached),they launched Clicked on 'Save' - (obpos2KeymapEditorSaveButton) 5 times and it failed the two last ones (20:02:44 and 20:03:38) | |||||||
Tags | No tags attached. | |||||||
Attached Files | TerminalLogCDSKeymap.csv [^] (430,441 bytes) 2024-04-17 11:08 keymapLogs-Patch.diff [^] (2,589 bytes) 2024-05-09 13:54 [Show Content] | |||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | |
Notes | |
(0163316) malsasua (developer) 2024-04-17 11:09 edited on: 2024-04-17 11:10 |
The error shown is raised in the following code (modules/org.openbravo.pos2/src/org/openbravo/pos2/KeymapLoader.java): private void checkMandatoryFields(String fields[], JSONObject json, String objectIdentifier) throws JSONException { for (String field : fields) { if (!json.has(field) || "null".equals(json.getString(field))) { String errorMessage = objectIdentifier + " " + field + " is a mandatory field to create a new " + objectIdentifier + " from Web Pos"; log.error(errorMessage); throw new OBException(errorMessage); } } } It is launched in the createEntity function that is only launched from the processEntity function when the obpos2_keymap_product doesn't exist. private void processEntity(Class<? extends BaseOBObject> type, JSONArray jsonEntities, String[] mandatoryFields, Map<String, String> uniqueProperties) throws JSONException { JSONArray filteredEntities = filterNotDeletedObjects(jsonEntities); deleteObjectsIfRequired(type, jsonEntities); for (int i = 0; i < filteredEntities.length(); i++) { JSONObject jsonEntityObject = filteredEntities.getJSONObject(i); BaseOBObject entityInstance = getEntityInstance(type, jsonEntityObject.optString("id", null)); if (entityInstance == null) { BaseOBObject equivalentInstance = getEquivalentInstance(type, jsonEntityObject, uniqueProperties); if (equivalentInstance == null) { createEntity(type, jsonEntityObject, mandatoryFields); } else { updateEntity(type, equivalentInstance, jsonEntityObject); } } else { updateEntity(type, entityInstance, jsonEntityObject); } } } This is why all the Keymaps are not failing. In this case, when the entity doesn't exist, it looks for the following mandatory fields: if (json.has("keymapProducts")) { processEntity(OBPOS2KeymapProduct.class, json.getJSONArray("keymapProducts"), KEYMAP_PRODUCT_MANDATORY_FIELDS); } public static final String[] KEYMAP_PRODUCT_MANDATORY_FIELDS = { "id", "organization", "name", "status", "product" }; It is looking for the product property and it doesn't exist. We checked if any of the records in keymapProducts property didn't exist in the backoffice and we found one: { "id": "...", "image": null, "organization": "0", "priority": 0, "useProductImg": true, "keymapCategoryId": "...", "productId": "...", "name": "...", "status": "A", "startingDate": null, "endingDate": null, "isButtonMandatory": false, "active": true } Although we added the "product" property to that section, it failed with a NPE in the following piece of code (modules/org.openbravo.pos2/src/org/openbravo/pos2/event/OBPOS2KeymapCategoryIsExtensibleEventHandler.java): OBPOS2KeymapProduct keymapProduct = (OBPOS2KeymapProduct) event.getTargetInstance(); OBPOS2KeymapCategory keymapCategory = keymapProduct.getOBPOS2KeymapCategory(); Boolean canCreateProduct = keymapCategory.isStoresAllowedToAddNewProducts(); It is because the keymapCategory is null. |
(0164412) sreehari (developer) 2024-05-09 13:53 |
The issue is unable to reproduce, as per my analysis there are several calls to processEntity method which handles the createEntity methods based on certain cases. we have mandatory defined for each of the keymap subrecords as follows: { "keymapCategoryProductPositions": [ "id", "organization", "productID", "layoutPositionColumn", "layoutPositionRow", "layoutColumnSpan", "layoutRowSpan", "screenResolutionID" ], "keymapCategoryProductAppearances": [ "id", "organization", "productID" ], "keymapCategoryPositions": [ "id", "organization", "categoryID", "positionX", "positionY", "layoutRowSpan", "layoutColumnSpan", "screenResolutionID" ], "keymapCategoryAppearances": [ "id", "organization", "categoryID" ], "keymapCategoryLayouts": [ "id", "organization", "keymapVersionID", "screenResolutionID", "cATLayoutCols", "cATLayoutRows" ], "keymapProductLayouts": [ "id", "organization", "categoryID", "prodLayoutRows", "prodLayoutCols", "screenResolutionID" ], "keymapCategories": [ "id", "organization", "name", "status", "searchKey" ], "keymapProducts": [ "id", "organization", "name", "status", "product" ], "keymapCategoryProductCategories": [ "id", "organization", "categoryID", "productCategory" ] } So attaching a patch which logs the all the details of the keymap when createEntity method is invoked, also everytime a save is triggered the keymapdata from frontend is logged. |
(0164422) marvintm (manager) 2024-05-10 08:53 |
We haven't been able to reproduce the problem. We have attached a diff with additional log, this can be deployed on the customer environment, and if the problem happens again the issue can be reopened with the additional information. |
Issue History | |||
Date Modified | Username | Field | Change |
2024-04-17 11:08 | malsasua | New Issue | |
2024-04-17 11:08 | malsasua | Assigned To | => Retail |
2024-04-17 11:08 | malsasua | File Added: TerminalLogCDSKeymap.csv | |
2024-04-17 11:08 | malsasua | Triggers an Emergency Pack | => No |
2024-04-17 11:09 | malsasua | Note Added: 0163316 | |
2024-04-17 11:09 | ngarcia | Issue Monitored: ngarcia | |
2024-04-17 11:10 | ngarcia | Note Edited: 0163316 | View Revisions |
2024-04-23 09:18 | guilleaer | Status | new => acknowledged |
2024-04-29 09:38 | sreehari | Assigned To | Retail => sreehari |
2024-04-29 09:38 | sreehari | Status | acknowledged => scheduled |
2024-05-07 16:17 | lorenzofidalgo | Target Version | => 24Q2 |
2024-05-09 13:53 | sreehari | Note Added: 0164412 | |
2024-05-09 13:54 | sreehari | File Added: keymapLogs-Patch.diff | |
2024-05-10 08:53 | marvintm | Review Assigned To | => marvintm |
2024-05-10 08:53 | marvintm | Note Added: 0164422 | |
2024-05-10 08:53 | marvintm | Status | scheduled => closed |
2024-05-10 08:53 | marvintm | Resolution | open => unable to reproduce |
Copyright © 2000 - 2009 MantisBT Group |