-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 5.6
-
Component/s: Core
-
Tags:
-
Impact type:Configuration Change
-
Upgrade notes:
The import of a Zip Tree XML Export containing a document with a null integer property sets value to 0.
Steps to reproduce:
- Define docType with schema that includes an integer property.
- Create doc of above type with integer property not populated.
- Zip Tree XML Export folder containing above doc to file export.zip
- Import above export.zip
- Edit imported doc
- Note that imported doc has integer property value set to 0 rather than unset.
The bug appears to be in how the decode(String str) method from org.nuxeo.ecm.core.schema.types.primitives.IntegerType handles the empty string. The method currently returns 0 for the empty string. In order to be consistent with the way the corresponding encode(Object obj) method handles null values, the decode(String str) method should return null for the empty string and not 0.