@@ -721,8 +721,8 @@ public void bulkPut(Context context) throws NoSuchWorkspaceException {
721721 }""" ;
722722
723723 // Get body
724- try (final var bodyParser = Json .createParser (new StringReader (context .body ()))){
725- toUpload = bodyParser . getArray ().getValuesAs (obj -> BulkPutItem .fromJson (obj .asJsonObject ()));
724+ try (final var bodyReader = Json .createReader (new StringReader (context .body ()))){
725+ toUpload = bodyReader . readArray ().getValuesAs (obj -> BulkPutItem .fromJson (obj .asJsonObject ()));
726726 } catch (JsonException je ) {
727727 context .status (400 ).json (new FormattedError (
728728 je ,
@@ -859,8 +859,8 @@ public void bulkPost(Context context) throws NoSuchWorkspaceException {
859859 context .status (400 ).json (new FormattedError ("Body must be type " +ContentType .JSON ));
860860 }
861861
862- try (final var bodyParser = Json .createParser (new StringReader (context .body ()))){
863- final var body = bodyParser . getObject ();
862+ try (final var bodyReader = Json .createReader (new StringReader (context .body ()))){
863+ final var body = bodyReader . readObject ();
864864 items = body .getJsonArray ("paths" ).getValuesAs (JsonString ::getString );
865865
866866 if (body .containsKey ("moveTo" ) && body .containsKey ("copyTo" )) {
@@ -1059,8 +1059,8 @@ public void bulkDelete(Context context) throws NoSuchWorkspaceException {
10591059 if (!ContentType .JSON .equals (context .contentType ())) {
10601060 context .status (400 ).json (new FormattedError ("Body must be type " +ContentType .JSON ));
10611061 }
1062- try (final var bodyParser = Json .createParser (new StringReader (context .body ()))){
1063- toDelete = bodyParser . getArray ().getValuesAs (JsonString ::getString );
1062+ try (final var bodyReader = Json .createReader (new StringReader (context .body ()))){
1063+ toDelete = bodyReader . readArray ().getValuesAs (JsonString ::getString );
10641064 } catch (JsonException je ) {
10651065 context .status (400 ).json (new FormattedError (je , "Invalid body format. Expected body format is an array of paths." ));
10661066 return ;
0 commit comments