@@ -115,7 +115,7 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
115115 CheckUtil .condition (sites < 1 , "The POST action requires at least 1 site!" );
116116
117117 String url = BASE_URL + "count" ;
118- final long timeout = sites * 10 ;
118+ final long timeout = sites * 10L ;
119119
120120 OkHttpClient postClient = CLIENT .newBuilder ()
121121 .callTimeout (timeout , TimeUnit .SECONDS )
@@ -135,12 +135,26 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
135135 ResponseBody responseBody = response .body ();
136136 if (responseBody == null ){
137137 LOG .error ("Received empty Response from BotBlock API!" );
138+ LOG .error (
139+ "Response{protocol={}, code={}, message={}, headers={}}" ,
140+ response .protocol (),
141+ response .code (),
142+ response .message (),
143+ response .headers ().toString ()
144+ );
138145 return ;
139146 }
140147
141148 String bodyString = responseBody .string ();
142149 if (bodyString .isEmpty ()){
143150 LOG .error ("Received empty Response from BotBlock API!" );
151+ LOG .error (
152+ "Response{protocol={}, code={}, message={}, headers={}}" ,
153+ response .protocol (),
154+ response .code (),
155+ response .message (),
156+ response .headers ().toString ()
157+ );
144158 return ;
145159 }
146160
@@ -171,7 +185,7 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
171185 }
172186 }
173187
174- LOG .warn ("One or more post requests returned a non-successful response. JSON with failed sites below." );
188+ LOG .warn ("One or more POST requests returned a non-successful response. JSON with failed sites below." );
175189 LOG .warn (failures .toString ());
176190 }
177191 }
@@ -189,12 +203,30 @@ private JSONObject performGET(@Nonnull String url, String header) throws IOExcep
189203
190204 try (Response response = CLIENT .newCall (request ).execute ()){
191205 ResponseBody body = response .body ();
192- if (body == null )
193- throw new NullPointerException ("Received empty response body." );
206+ if (body == null ){
207+ LOG .error ("Received empty Response from BotBlock API!" );
208+ LOG .error (
209+ "Response{protocol={}, code={}, message={}, headers={}}" ,
210+ response .protocol (),
211+ response .code (),
212+ response .message (),
213+ response .headers ().toString ()
214+ );
215+ return null ;
216+ }
194217
195218 String bodyString = body .string ();
196- if (bodyString .isEmpty ())
197- throw new NullPointerException ("Received empty response body." );
219+ if (bodyString .isEmpty ()){
220+ LOG .error ("Received empty Response from BotBlock API!" );
221+ LOG .error (
222+ "Response{protocol={}, code={}, message={}, headers={}}" ,
223+ response .protocol (),
224+ response .code (),
225+ response .message (),
226+ response .headers ().toString ()
227+ );
228+ return null ;
229+ }
198230
199231 if (!response .isSuccessful ()){
200232 if (response .code () == 429 ){
0 commit comments