Method ignores exceptional return value : FindBugs

倖福魔咒の 提交于 2019-12-12 01:33:19

问题


Why the heading error in the findbugs for the following code.

 boolean isCreated =  folder.mkdirs();

    if (!isCreated) {
        throw new IOException("Folder already exists..!!!");
    }

回答1:


According to Finds Bug Description.

Method ignores exceptional return value

Method returns a value that is not checked. The return value should be checked since it can indicate an unusual or unexpected function execution.




回答2:


Probably because you're not checking for the SecurityException that mkdirs can throw.



来源:https://stackoverflow.com/questions/23631922/method-ignores-exceptional-return-value-findbugs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!