avoid NullPointerException for warning diagnostic

This commit is contained in:
markfisher
2017-05-23 08:07:54 -04:00
parent 998ea3ad35
commit 78a37ef8ad

View File

@@ -77,9 +77,13 @@ public class RuntimeJavaCompiler {
String sourceCode =null;
try {
sourceCode = (String)diagnostic.getSource().getCharContent(true);
} catch (IOException ioe) {
}
catch (IOException ioe) {
// Unexpected, but leave sourceCode null to indicate it was not retrievable
}
catch (NullPointerException npe) {
// TODO: should we skip warning diagnostics in the loop altogether?
}
int startPosition = (int)diagnostic.getPosition();
if (startPosition == Diagnostic.NOPOS) {
startPosition = (int)diagnostic.getStartPosition();