@@ -115,7 +115,7 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
115
115
CheckUtil .condition (sites < 1 , "The POST action requires at least 1 site!" );
116
116
117
117
String url = BASE_URL + "count" ;
118
- final long timeout = sites * 10 ;
118
+ final long timeout = sites * 10L ;
119
119
120
120
OkHttpClient postClient = CLIENT .newBuilder ()
121
121
.callTimeout (timeout , TimeUnit .SECONDS )
@@ -135,12 +135,26 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
135
135
ResponseBody responseBody = response .body ();
136
136
if (responseBody == null ){
137
137
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
+ );
138
145
return ;
139
146
}
140
147
141
148
String bodyString = responseBody .string ();
142
149
if (bodyString .isEmpty ()){
143
150
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
+ );
144
158
return ;
145
159
}
146
160
@@ -171,7 +185,7 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
171
185
}
172
186
}
173
187
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." );
175
189
LOG .warn (failures .toString ());
176
190
}
177
191
}
@@ -189,12 +203,30 @@ private JSONObject performGET(@Nonnull String url, String header) throws IOExcep
189
203
190
204
try (Response response = CLIENT .newCall (request ).execute ()){
191
205
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
+ }
194
217
195
218
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
+ }
198
230
199
231
if (!response .isSuccessful ()){
200
232
if (response .code () == 429 ){
0 commit comments