@@ -177,24 +177,26 @@ public MultiDocumentEntity<DocumentCreateEntity<T>> deserialize(final Response r
177
177
final Collection <ErrorEntity > errors = new ArrayList <ErrorEntity >();
178
178
final Collection <Object > documentsAndErrors = new ArrayList <Object >();
179
179
final VPackSlice body = response .getBody ();
180
- for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
181
- final VPackSlice next = iterator .next ();
182
- if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
183
- final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
184
- errors .add (error );
185
- documentsAndErrors .add (error );
186
- } else {
187
- final DocumentCreateEntity <T > doc = util ().deserialize (next , DocumentCreateEntity .class );
188
- final VPackSlice newDoc = next .get (NEW );
189
- if (newDoc .isObject ()) {
190
- doc .setNew ((T ) util (Serializer .CUSTOM ).deserialize (newDoc , type ));
191
- }
192
- final VPackSlice oldDoc = next .get (OLD );
193
- if (oldDoc .isObject ()) {
194
- doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
180
+ if (body .isArray ()) {
181
+ for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
182
+ final VPackSlice next = iterator .next ();
183
+ if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
184
+ final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
185
+ errors .add (error );
186
+ documentsAndErrors .add (error );
187
+ } else {
188
+ final DocumentCreateEntity <T > doc = util ().deserialize (next , DocumentCreateEntity .class );
189
+ final VPackSlice newDoc = next .get (NEW );
190
+ if (newDoc .isObject ()) {
191
+ doc .setNew ((T ) util (Serializer .CUSTOM ).deserialize (newDoc , type ));
192
+ }
193
+ final VPackSlice oldDoc = next .get (OLD );
194
+ if (oldDoc .isObject ()) {
195
+ doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
196
+ }
197
+ docs .add (doc );
198
+ documentsAndErrors .add (doc );
195
199
}
196
- docs .add (doc );
197
- documentsAndErrors .add (doc );
198
200
}
199
201
}
200
202
multiDocument .setDocuments (docs );
@@ -355,24 +357,26 @@ public MultiDocumentEntity<DocumentUpdateEntity<T>> deserialize(final Response r
355
357
final Collection <ErrorEntity > errors = new ArrayList <ErrorEntity >();
356
358
final Collection <Object > documentsAndErrors = new ArrayList <Object >();
357
359
final VPackSlice body = response .getBody ();
358
- for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
359
- final VPackSlice next = iterator .next ();
360
- if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
361
- final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
362
- errors .add (error );
363
- documentsAndErrors .add (error );
364
- } else {
365
- final DocumentUpdateEntity <T > doc = util ().deserialize (next , DocumentUpdateEntity .class );
366
- final VPackSlice newDoc = next .get (NEW );
367
- if (newDoc .isObject ()) {
368
- doc .setNew ((T ) util (Serializer .CUSTOM ).deserialize (newDoc , type ));
369
- }
370
- final VPackSlice oldDoc = next .get (OLD );
371
- if (oldDoc .isObject ()) {
372
- doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
360
+ if (body .isArray ()) {
361
+ for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
362
+ final VPackSlice next = iterator .next ();
363
+ if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
364
+ final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
365
+ errors .add (error );
366
+ documentsAndErrors .add (error );
367
+ } else {
368
+ final DocumentUpdateEntity <T > doc = util ().deserialize (next , DocumentUpdateEntity .class );
369
+ final VPackSlice newDoc = next .get (NEW );
370
+ if (newDoc .isObject ()) {
371
+ doc .setNew ((T ) util (Serializer .CUSTOM ).deserialize (newDoc , type ));
372
+ }
373
+ final VPackSlice oldDoc = next .get (OLD );
374
+ if (oldDoc .isObject ()) {
375
+ doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
376
+ }
377
+ docs .add (doc );
378
+ documentsAndErrors .add (doc );
373
379
}
374
- docs .add (doc );
375
- documentsAndErrors .add (doc );
376
380
}
377
381
}
378
382
multiDocument .setDocuments (docs );
@@ -464,24 +468,26 @@ public MultiDocumentEntity<DocumentUpdateEntity<T>> deserialize(final Response r
464
468
final Collection <ErrorEntity > errors = new ArrayList <ErrorEntity >();
465
469
final Collection <Object > documentsAndErrors = new ArrayList <Object >();
466
470
final VPackSlice body = response .getBody ();
467
- for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
468
- final VPackSlice next = iterator .next ();
469
- if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
470
- final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
471
- errors .add (error );
472
- documentsAndErrors .add (error );
473
- } else {
474
- final DocumentUpdateEntity <T > doc = util ().deserialize (next , DocumentUpdateEntity .class );
475
- final VPackSlice newDoc = next .get (NEW );
476
- if (newDoc .isObject ()) {
477
- doc .setNew ((T ) util (Serializer .CUSTOM ).deserialize (newDoc , type ));
478
- }
479
- final VPackSlice oldDoc = next .get (OLD );
480
- if (oldDoc .isObject ()) {
481
- doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
471
+ if (body .isArray ()) {
472
+ for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
473
+ final VPackSlice next = iterator .next ();
474
+ if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
475
+ final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
476
+ errors .add (error );
477
+ documentsAndErrors .add (error );
478
+ } else {
479
+ final DocumentUpdateEntity <T > doc = util ().deserialize (next , DocumentUpdateEntity .class );
480
+ final VPackSlice newDoc = next .get (NEW );
481
+ if (newDoc .isObject ()) {
482
+ doc .setNew ((T ) util (Serializer .CUSTOM ).deserialize (newDoc , type ));
483
+ }
484
+ final VPackSlice oldDoc = next .get (OLD );
485
+ if (oldDoc .isObject ()) {
486
+ doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
487
+ }
488
+ docs .add (doc );
489
+ documentsAndErrors .add (doc );
482
490
}
483
- docs .add (doc );
484
- documentsAndErrors .add (doc );
485
491
}
486
492
}
487
493
multiDocument .setDocuments (docs );
@@ -542,20 +548,22 @@ public MultiDocumentEntity<DocumentDeleteEntity<T>> deserialize(final Response r
542
548
final Collection <ErrorEntity > errors = new ArrayList <ErrorEntity >();
543
549
final Collection <Object > documentsAndErrors = new ArrayList <Object >();
544
550
final VPackSlice body = response .getBody ();
545
- for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
546
- final VPackSlice next = iterator .next ();
547
- if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
548
- final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
549
- errors .add (error );
550
- documentsAndErrors .add (error );
551
- } else {
552
- final DocumentDeleteEntity <T > doc = util ().deserialize (next , DocumentDeleteEntity .class );
553
- final VPackSlice oldDoc = next .get (OLD );
554
- if (oldDoc .isObject ()) {
555
- doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
551
+ if (body .isArray ()) {
552
+ for (final Iterator <VPackSlice > iterator = body .arrayIterator (); iterator .hasNext ();) {
553
+ final VPackSlice next = iterator .next ();
554
+ if (next .get (ArangoResponseField .ERROR ).isTrue ()) {
555
+ final ErrorEntity error = (ErrorEntity ) util ().deserialize (next , ErrorEntity .class );
556
+ errors .add (error );
557
+ documentsAndErrors .add (error );
558
+ } else {
559
+ final DocumentDeleteEntity <T > doc = util ().deserialize (next , DocumentDeleteEntity .class );
560
+ final VPackSlice oldDoc = next .get (OLD );
561
+ if (oldDoc .isObject ()) {
562
+ doc .setOld ((T ) util (Serializer .CUSTOM ).deserialize (oldDoc , type ));
563
+ }
564
+ docs .add (doc );
565
+ documentsAndErrors .add (doc );
556
566
}
557
- docs .add (doc );
558
- documentsAndErrors .add (doc );
559
567
}
560
568
}
561
569
multiDocument .setDocuments (docs );
0 commit comments