7118749: NPE in CreateSymbols caused by bad diagnostic
authorkizune
Tue, 01 Oct 2013 17:03:31 +0400
changeset 20607 b094c3a8c917
parent 20606 a8910a0bdbe6
child 20608 5cc020154cff
7118749: NPE in CreateSymbols caused by bad diagnostic Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Sat Sep 28 13:46:14 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Tue Oct 01 17:03:31 2013 +0400
@@ -107,15 +107,21 @@
             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;
     }