Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
(Java) V4 4.8.0
-
None
-
None
-
Not Applicable
Description
While parsing batch changeset response, any of the changeset may fail (can have response code > 300). As per spec, a batch request and response must be structurally identical with an exception.
- When a request within a change set fails, the change set response is not represented using the multipart/mixed media type. Instead, a single response, using the application/http media type, is returned that applies to all requests in the change set and MUST be a valid OData error response.
There is an issue in an iterator of the class ODataChangesetResponseItem.java where hasNext() returns true but when next() is called "IllegalStateException : Expected item not found" exception is thrown.
When the condition as mentioned in point 1 occurs, the iterators' hasNext() gives us true indicating there is a next element whereas fetching the element using next() gives an exception. This will happen when there are multiple changeset parts but the remote service gives failure response for only one changeset part. I have attached a sample request and response too.
On the other hand even if we set continueOnError to false, when the service gives all the failure response, ODataChangesetResponseItem's iterator will parse only the first response. Ideally there seems to be a flaw in the iterator design. I have a unit test attached reproducing the scenario where the backend service is https://services.odata.org/TripPinRESTierService.