-1

When I build my project, So I got this checkstyle warning : WhitespaceAround: WhitespaceAround: '{' is not preceded with whitespace. Can you please help me to remove this warning.

public List<ObjectSyncStatus> createEntities(Long connectorId, EntityRequest entityRequest) {
    if (connectorId == null && entityRequest == null){
        return Collections.emptyList();
    }
    String entitiesUrl = connectorEndpoint + CONNECTOR_PATH + connectorId + "/entities";
    HttpMethod method = HttpMethod.POST;

    HttpEntity<EntityRequest> httpEntity = new HttpEntity<>(entityRequest);
    ResponseEntity<List> responseEntity = restTemplate.exchange(entitiesUrl, method, httpEntity, List.class);
    log.info(OPERATION_SUCCESSFUL, responseEntity);

    return mapper.mapAsList(responseEntity.getBody(), ObjectSyncStatus.class);
}

I got the warning in If condition.

Suraj Karosia
  • 19
  • 1
  • 3

1 Answers1

3

The Checkstyle configuration that you are using expects the { to have a space before it. Your code looks like this at the moment:

if (connectorId == null && entityRequest == null){
    return Collections.emptyList();
}

Checkstyle wants it to look like this:

if (connectorId == null && entityRequest == null) {
    return Collections.emptyList();
}
Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242