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-04-29 09:38 | |||||||
Reporter | malsasua | View Status | public | |||||||||
Assigned To | sreehari | |||||||||||
Priority | high | Resolution | open | Fixed in Version | ||||||||
Status | scheduled | Fix in branch | Fixed in SCM revision | |||||||||
Projection | none | ETA | none | Target Version | ||||||||
OS | Any | Database | Any | Java version | ||||||||
OS Version | Database version | Ant version | ||||||||||
Product Version | SCM revision | |||||||||||
Review Assigned To | ||||||||||||
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 | |||||||||||
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. |
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 |
Copyright © 2000 - 2009 MantisBT Group |