facebook / facebook/infer

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

Ouverte
#929 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
question
Langage dominant
OCaml
Étoiles
15.7k
Forks
2.1k
Merge moyen
19 h 36 min
PR mergées (30 j)
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?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.