Skip to content

ODataModelV2: Calling a function that returns an array of Strings results in an error #4360

@chott92

Description

@chott92

What is the issue and how can we reproduce it?

When Using a sap.ui.model.odata.v2.ODataModel to call an OData Function on an OData V2 Service that returns an Array of Strings, the result will not be parsed correctly in the OData Model and result in a JavaScript Error on Client Side:

Uncaught TypeError: Cannot assign to read only property '0' of string 'Foo'
    at String.<anonymous> (ODataModel.js:1625:20)
    at fnEach (each.js?eval:67:21)
    at constructor._importData (ODataModel.js:1591:4)
    at String.<anonymous> (ODataModel.js:1540:17)
    at fnEach (each.js?eval:61:21)
    at constructor._importData (ODataModel.js:1538:4)
    at constructor._processSuccess (ODataModel.js:4544:11)
    at processResponse (ODataModel.js:3861:11)
    at handleSuccess (ODataModel.js:3915:7)
    at handleSuccess (ODataModel.js:3596:5)

(For reference to navigate the sourcecode: In this example, UI5 version 1.141.2 is used)

A Reproducing example (with instructions for setup) can be found here: https://github.com/chott92/openui5-sample

From what I did analyze on my own, it appears that with String Arrays, the Model takes one recursive step too far into the result parsing, resulting in calling a each() on the Strings themselves, which results in the error shown on the JavaScript Console.

Which OpenUI5 version is your project targeting?

1.96, 1.136 (reproduced on both)

Is the issue device- or browser-specific?

The Issue Seems not to be browser specific, since it appears to be located directly in the JavaScript Code of the ODataModel.

Confirmation

  • I have searched the existing issues and reviewed the relevant documentation as well as the API reference.
  • I am not disclosing any internal or sensitive information.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions