Can facebook infer ignore error in line?

392 Views Asked by At

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?

0

There are 0 best solutions below