Issue
- When trying to update the web content's custom field value of type Integer with API, an error
ClassCastExceptionoccurs.
Steps to reproduce:
- Create a custom field of integer in the web content article.
- Create a structure having 2 fields.
- Create web content using that structure.
- Call the following API to update the web content's custom field:
curl -X 'PUT' \
'http://localhost:8080/o/headless-delivery/v1.0/sites/<siteId>/structured-contents/by-external-reference-code/<externalReferenceCode>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-csrf-token: <token>' \
-d '{ "contentStructureId": <contentStructureId>, "customFields": [{ "customValue": { "data": 2 }, "dataType": "Integer", "name": "<customFieldName>" }], "title": "Title changes" }'
Pass the below in the request body:
{ "contentStructureId": 31543, "customFields": [ { "customValue": { "data": 2 }, "dataType": "Integer", "name": "Prio" } ], "title": "Clarity x Warby Parker1" }The following error appears in the console log:
ERROR [http-nio-8080-exec-6][ExceptionMapper:59] null java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long
Environment
- DXP Quarterly Release
Resolution
- The observed behavior is a known concern that has been addressed by LPD-54757.
- If a hotfix is required for this issue, please create a support ticket requesting a hotfix by attaching the patch details.
- Installing Fix Packs and Hotfixes on Liferay DXP will guide you to install this hotfix in the respective environment.