I'm having difficulty with Findbugs complaining about springs HttpEntity.getBody().
Below you'll see I call response.getBody().length, which I understand could cause a NPE. However when I wrap it in if (response.getBody() != null), it still complains. It only does this in Spring 2.0 (not 1.5) which appears to be related to the @Nullable annotation added to the method.
Can I get an explanation why even when I wrap it in a null check, it still complains when I get the length of it?
Bug type NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
ResponseEntity<SomeClass[]> response = restTemplate.exchange(someUrl, HttpMethod.GET, httpEntity,
SomeClass[].class);
for (int i = 0; response.getBody().length > i; i++) {
doSomething()
}