File tree Expand file tree Collapse file tree
src/main/java/com/auth0/net Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,9 +57,8 @@ protected T parseResponse(Response response) throws Auth0Exception {
5757 throw createResponseException (response );
5858 }
5959
60- String payload ;
61- try {
62- payload = response .body ().string ();
60+ try (ResponseBody body = response .body ()) {
61+ String payload = body .string ();
6362 return mapper .readValue (payload , tType );
6463 } catch (IOException e ) {
6564 throw new APIException ("Failed to parse json body" , response .code (), e );
@@ -98,8 +97,8 @@ protected RequestBody createBody() throws Auth0Exception {
9897
9998 protected Auth0Exception createResponseException (Response response ) {
10099 String payload = null ;
101- try {
102- payload = response . body () .string ();
100+ try ( ResponseBody body = response . body ()) {
101+ payload = body .string ();
103102 MapType mapType = mapper .getTypeFactory ().constructMapType (HashMap .class , String .class , Object .class );
104103 Map <String , Object > values = mapper .readValue (payload , mapType );
105104 return new APIException (values , response .code ());
You can’t perform that action at this time.
0 commit comments