@@ -151,8 +151,9 @@ protected JSONObject getObject(String objectID, List<String> attributesToRetrie
151
151
StringBuilder params = new StringBuilder ();
152
152
params .append ("?attributes=" );
153
153
for (int i = 0 ; i < attributesToRetrieve .size (); ++i ) {
154
- if (i > 0 )
154
+ if (i > 0 ) {
155
155
params .append ("," );
156
+ }
156
157
params .append (URLEncoder .encode (attributesToRetrieve .get (i ), "UTF-8" ));
157
158
}
158
159
return client .getRequest ("/1/indexes/" + encodedIndexName + "/" + URLEncoder .encode (objectID , "UTF-8" ) + params .toString (), false );
@@ -267,8 +268,9 @@ protected JSONObject saveObjects(JSONArray inputArray) throws AlgoliaException {
267
268
* @throws AlgoliaException
268
269
*/
269
270
protected JSONObject deleteObject (String objectID ) throws AlgoliaException {
270
- if (objectID .length () == 0 )
271
+ if (objectID .length () == 0 ) {
271
272
throw new AlgoliaException ("Invalid objectID" );
273
+ }
272
274
try {
273
275
return client .deleteRequest ("/1/indexes/" + encodedIndexName + "/" + URLEncoder .encode (objectID , "UTF-8" ));
274
276
} catch (UnsupportedEncodingException e ) {
@@ -335,10 +337,11 @@ protected void deleteByQuery(Query query) throws AlgoliaException {
335
337
*/
336
338
protected JSONObject search (Query query ) throws AlgoliaException {
337
339
String paramsString = query .getQueryString ();
338
- if (paramsString .length () > 0 )
340
+ if (paramsString .length () > 0 ) {
339
341
return client .getRequest ("/1/indexes/" + encodedIndexName + "?" + paramsString , true );
340
- else
342
+ } else {
341
343
return client .getRequest ("/1/indexes/" + encodedIndexName , true );
344
+ }
342
345
}
343
346
344
347
/**
@@ -348,10 +351,11 @@ protected JSONObject search(Query query) throws AlgoliaException {
348
351
*/
349
352
protected byte [] searchRaw (Query query ) throws AlgoliaException {
350
353
String paramsString = query .getQueryString ();
351
- if (paramsString .length () > 0 )
354
+ if (paramsString .length () > 0 ) {
352
355
return client .getRequestRaw ("/1/indexes/" + encodedIndexName + "?" + paramsString , true );
353
- else
356
+ } else {
354
357
return client .getRequestRaw ("/1/indexes/" + encodedIndexName , true );
358
+ }
355
359
}
356
360
357
361
/**
@@ -366,8 +370,9 @@ protected void waitTask(String taskID, long timeToWait) throws AlgoliaException
366
370
try {
367
371
while (true ) {
368
372
JSONObject obj = client .getRequest ("/1/indexes/" + encodedIndexName + "/task/" + URLEncoder .encode (taskID , "UTF-8" ), false );
369
- if (obj .getString ("status" ).equals ("published" ))
373
+ if (obj .getString ("status" ).equals ("published" )) {
370
374
return ;
375
+ }
371
376
try {
372
377
Thread .sleep (timeToWait >= MAX_TIME_MS_TO_WAIT ? MAX_TIME_MS_TO_WAIT : timeToWait );
373
378
} catch (InterruptedException e ) {
0 commit comments