facebook / facebook/infer

How to tell infer to not to report the specific error in specific location

Open
#929 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

I use facebook infer to detect error in my Android project. It find some error but is not error.

try {
...
AppInfo app = JsonUtil.parseObject(resFileContent , AppInfo.class);
app.setAppPackagePath(simpleInfoFile.getParent());
return app;
} catch (Exception e) {
e.printStackTrace();
return null;
}
infer report the error

132: error: NULL_DEREFERENCE
object app last assigned on line 130 could be null and is dereferenced at line 132
130. AppInfo app = JsonUtil.parseObject(resFileContent , AppInfo.class);
131.
132. > app.setAppPackagePath(simpleInfoFile.getParent());
133. return app;
134. } catch (Exception e) {
135.

The NullPointerException will be caught by try...catch... so it is not an error. How to tell infer not to report the error or ignore check in this line?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.