Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

ManageClient and AdminManager don't support UTF8 JSON strings #272

@derms

Description

@derms

Having non-ascii characters in element range indexes is support by MarkLogic and the REST api, but when using ml-app-deployer and ml-gradle, it fails. The solution is to specify the utf8 charset as part of the content type declaration (as per below)

Details of Error

Consider the config -

{
"range-element-index": [
    {
      "collation": "http://marklogic.com/collation/",
      "invalid-values": "reject",
      "localname": "ÉÉÉ",
      "namespace-uri": "",
      "range-value-positions": false,
      "scalar-type": "string"
    }
]}

When this is included in a database.json file, the payload fails with the following error -

:mlDeployApp
Logging HTTP response body to assist with debugging: {"errorResponse":{"statusCode":"400", "status":"Bad Request", "messageCode":"MANAGE-INVALIDPAYLOAD", "message":"MANAGE-INVALIDPAYLOA
D: (err:FOER0000) Payload has errors in structure, content-type or values. Unable to read request body (check content-type)."}}
:mlDeployApp FAILED

When the rest API is called directly, it works fine -

curl -X PUT --anyauth  -u admin:admin -H "Content-type: application/json" -d '{
"range-element-index": [
    {
      "collation": "http://marklogic.com/collation/",
      "invalid-values": "reject",
      "localname": "ÉÉÉ",
      "namespace-uri": "",
      "range-value-positions": false,
      "scalar-type": "string"
    }
]}' http://localhost:8002/manage/v2/databases/Documents/properties

Solution

Change
headers.setContentType(MediaType.APPLICATION_JSON);
to
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);

in the AdminManager and ManageClient classes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions