Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0042871Openbravo ERPA. Platformpublic2020-01-14 17:192020-01-17 09:48
alostale 
alostale 
normalminorhave not tried
closedfixed 
5
 
3.0PR20Q2 
caristu
Core
No
0042871: missing log for failing DAL property validations
When DAL fails to validate a property the failing property is logged but not the entity it belongs to.

When the validation that failed is the one checking the size of the value, the complete value is logged, causing a flood in the log.
ie. execute the following code:
    Alert a = OBProvider.getInstance().get(Alert.class);
    a.setDescription(org.apache.commons.lang.StringUtils.repeat("-", 2001));

The following error is displayed:
  org.openbravo.base.validation.ValidationException: description: Value (---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------) is too long, it has length 2001, the maximum allowed length is 2000

Change the log to:
1. Include entity name
2. First display error info, later context
3. Truncate context if it is too long

In this case the error should be something like

  org.openbravo.base.validation.ValidationException: ADAlert.description is too long, it has length 2001, the maximum allowed length is 2000: Value (------------------------------------------------...)
No tags attached.
blocks design defect 0036162 acknowledged Triage Platform Base clean up openbravo.log 
Issue History
2020-01-14 17:19alostaleNew Issue
2020-01-14 17:19alostaleAssigned To => platform
2020-01-14 17:19alostaleModules => Core
2020-01-14 17:19alostaleTriggers an Emergency Pack => No
2020-01-14 17:28alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20117#r20117
2020-01-14 17:28alostaleProposed Solution updated
2020-01-15 10:19alostaleNote Added: 0116887
2020-01-15 10:20alostaleRelationship addedblocks 0036162
2020-01-15 10:20alostaleAssigned Toplatform => alostale
2020-01-15 10:20alostaleReview Assigned To => caristu
2020-01-17 09:24hgbotCheckin
2020-01-17 09:24hgbotNote Added: 0116976
2020-01-17 09:24hgbotStatusnew => resolved
2020-01-17 09:24hgbotResolutionopen => fixed
2020-01-17 09:24hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/da317d9719017833c021481154b4c7fd130adf44 [^]
2020-01-17 09:48caristuNote Added: 0116979
2020-01-17 09:48caristuStatusresolved => closed
2020-01-17 09:48caristuFixed in Version => 3.0PR20Q2

Notes
(0116887)
alostale   
2020-01-15 10:19   
MR: https://gitlab.com/openbravo/product/openbravo/merge_requests/33 [^]
(0116976)
hgbot   
2020-01-17 09:24   
Repository: erp/devel/pi
Changeset: da317d9719017833c021481154b4c7fd130adf44
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Jan 15 09:14:17 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/da317d9719017833c021481154b4c7fd130adf44 [^]

fixed BUG-42871: missing log for failing DAL property validations

  This fix:
   - Shows in the log the entity name together with the property that
     didn't pass the validation
   - For String too long value validation:
      - It truncates the value shown in log after 100 chars
      - Relevant information (current and max sizes) is displayed before
        the actual value

---
M src/org/openbravo/base/validation/StringPropertyValidator.java
M src/org/openbravo/base/validation/ValidationException.java
---
(0116979)
caristu   
2020-01-17 09:48   
Reviewed + tested OK