提交 591bad91 编写于 作者: K kizune

7118749: NPE in CreateSymbols caused by bad diagnostic

Reviewed-by: jjg
上级 75528338
......@@ -107,15 +107,21 @@ public class CreateSymbols extends AbstractProcessor {
if (renv.processingOver())
createSymbols();
} catch (IOException e) {
CharSequence msg = e.getLocalizedMessage();
if (msg == null)
msg = e.toString();
processingEnv.getMessager()
.printMessage(Diagnostic.Kind.ERROR, e.getLocalizedMessage());
.printMessage(Diagnostic.Kind.ERROR, msg);
} catch (Throwable t) {
t.printStackTrace();
Throwable cause = t.getCause();
if (cause == null)
cause = t;
CharSequence msg = cause.getLocalizedMessage();
if (msg == null)
msg = cause.toString();
processingEnv.getMessager()
.printMessage(Diagnostic.Kind.ERROR, cause.getLocalizedMessage());
.printMessage(Diagnostic.Kind.ERROR, msg);
}
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册