可能なヌルポインタ参照エラーの可能性ヌルポインタ参照を示していますSonarQubeは、このコードで
if(!Util.isNull(dir)){
if (dir.isDirectory()){
if(!Util.isNull(dir.list()))
if((!Util.isNull(dir.list().length))) // issue reported here
if(dir.list().length == 0) // another issue reported here
if (dir.delete())
LOGGER.info("deleted:");
}
}
は、どのように私はこれらの問題を解決することができますか?
[SONARでnullポインタの逆参照が可能](https://stackoverflow.com/questions/37295215/possible-null-pointer-dereference-in-sonar) – gile
Sonarは他のファイルのUtil.isNullを知っています私のアプリケーション – vk1
'dir'が' File'であると仮定すると、 'dir.list()。length'は決してヌルではなく、' int'です。同様に、 'dir.isDirectory()'の場合、 'dir.list()'はnullではありません。 –