private ODataResponse nextExpected() { // consume item for condition above (used like a counter ...) expectedItemsIterator.next(); final Map<String, Collection<String>> nextItemHeaders = ODataBatchUtilities.nextItemHeaders(batchLineIterator, boundary); if (nextItemHeaders.isEmpty()) { throw new IllegalStateException("Expected item not found"); } final Map.Entry<Integer, String> responseLine = ODataBatchUtilities.readResponseLine(batchLineIterator); LOG.debug("Retrieved item response {}", responseLine); final Map<String, Collection<String>> headers = ODataBatchUtilities.readHeaders(batchLineIterator); LOG.debug("Retrieved item headers {}", headers); Collection<String> contentId = nextItemHeaders.get(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME); if (contentId == null || contentId.isEmpty()) { contentId = headers.get(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME); if (contentId == null || contentId.isEmpty()) { throw new IllegalStateException("Content-ID is missing"); } } current = getResponse(contentId.iterator().next()); if (current == null) { throw new IllegalStateException("Unexpected '" + contentId + "' item found"); } current.initFromBatch(responseLine, headers, batchLineIterator, boundary); if (current.getStatusCode() >= 400 && !continueOnError) { // found error .... breaking = true; } return current; }
private ODataResponse nextExpected() { // consume item for condition above (used like a counter ...) expectedItemsIterator.next(); final Map<String, Collection<String>> nextItemHeaders = ODataBatchUtilities.nextItemHeaders(batchLineIterator, boundary); if (nextItemHeaders.isEmpty()) { throw new IllegalStateException("Expected item not found"); } final Map.Entry<Integer, String> responseLine = ODataBatchUtilities.readResponseLine(batchLineIterator); LOG.debug("Retrieved item response {}", responseLine); final Map<String, Collection<String>> headers = ODataBatchUtilities.readHeaders(batchLineIterator); LOG.debug("Retrieved item headers {}", headers); Collection<String> contentId = nextItemHeaders.get(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME); if (contentId == null || contentId.isEmpty()) { contentId = headers.get(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME); if (contentId == null || contentId.isEmpty()) { throw new IllegalStateException("Content-ID is missing"); } } current = getResponse(contentId.iterator().next()); if (current == null) { throw new IllegalStateException("Unexpected '" + contentId + "' item found"); } current.initFromBatch(responseLine, headers, batchLineIterator, boundary); if (current.getStatusCode() >= 400 && !continueOnError) { // found error .... breaking = true; } return current; }
throw new NoSuchElementException("No item found"); current = expectedItemsIterator.next().initFromBatch(responseLine, headers, batchLineIterator, boundary);
throw new NoSuchElementException("No item found"); current = expectedItemsIterator.next().initFromBatch(responseLine, headers, batchLineIterator, boundary);