From 00cdf0aa5069e50126eb5a5da1b90bb267bf0a8c Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Mon, 19 Feb 2018 14:59:53 -0800 Subject: [PATCH] Avoid NPE in autoconfig report parsing --- .../commons/boot/app/cli/LiveConditionalParser.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LiveConditionalParser.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LiveConditionalParser.java index c0ab45c45..bc79cde3a 100644 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LiveConditionalParser.java +++ b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LiveConditionalParser.java @@ -44,12 +44,12 @@ public class LiveConditionalParser { public Optional> parse() { try { List allConditionals = new ArrayList<>(); - JSONObject autoConfigReport = new JSONObject(autoConfigRecord); - if (autoConfigReport.has("contexts")) { - //more recently the report is nested inside the 'application' context. - autoConfigReport = autoConfigReport.getJSONObject("contexts").getJSONObject("application"); - } if (StringUtil.hasText(autoConfigRecord)) { + JSONObject autoConfigReport = new JSONObject(autoConfigRecord); + if (autoConfigReport.has("contexts")) { + //more recently the report is nested inside the 'application' context. + autoConfigReport = autoConfigReport.getJSONObject("contexts").getJSONObject("application"); + } for (LiveConditional c : getConditionalsFromPositiveMatches(autoConfigReport)) { allConditionals.add(c); }