summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/VConsole.java18
-rw-r--r--client/src/com/vaadin/client/debug/internal/LogSection.java6
2 files changed, 20 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/VConsole.java b/client/src/com/vaadin/client/VConsole.java
index 37ed8e6370..32eb206a70 100644
--- a/client/src/com/vaadin/client/VConsole.java
+++ b/client/src/com/vaadin/client/VConsole.java
@@ -41,25 +41,35 @@ public class VConsole {
public static void log(String msg) {
if (LogConfiguration.loggingIsEnabled(Level.INFO)) {
- getLogger().log(Level.INFO, msg);
+ // Check for null, so no NullPointerException is generated when
+ // formatting (#12588)
+ getLogger().log(Level.INFO, msg == null ? "null" : msg);
}
}
public static void log(Throwable e) {
if (LogConfiguration.loggingIsEnabled(Level.INFO)) {
- getLogger().log(Level.INFO, e.getMessage(), e);
+ // Check for null, so no NullPointerException is generated when
+ // formatting (#12588)
+ getLogger().log(Level.INFO,
+ e.getMessage() == null ? "" : e.getMessage(), e);
}
}
public static void error(Throwable e) {
if (LogConfiguration.loggingIsEnabled(Level.SEVERE)) {
- getLogger().log(Level.SEVERE, e.getMessage(), e);
+ // Check for null, so no NullPointerException is generated when
+ // formatting (#12588)
+ getLogger().log(Level.SEVERE,
+ e.getMessage() == null ? "" : e.getMessage(), e);
}
}
public static void error(String msg) {
if (LogConfiguration.loggingIsEnabled(Level.SEVERE)) {
- getLogger().log(Level.SEVERE, msg);
+ // Check for null, so no NullPointerException is generated when
+ // formatting (#12588)
+ getLogger().log(Level.SEVERE, msg == null ? "null" : msg);
}
}
diff --git a/client/src/com/vaadin/client/debug/internal/LogSection.java b/client/src/com/vaadin/client/debug/internal/LogSection.java
index 1e7524b56d..f792ec95be 100644
--- a/client/src/com/vaadin/client/debug/internal/LogSection.java
+++ b/client/src/com/vaadin/client/debug/internal/LogSection.java
@@ -73,6 +73,12 @@ public class LogSection implements Section {
return;
}
+ // If no message is provided, record.getMessage will be null and so
+ // the formatter.format will fail with NullPointerException (#12588)
+ if (record.getMessage() == null) {
+ record.setMessage("");
+ }
+
Formatter formatter = getFormatter();
String msg = formatter.format(record);