Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2021-04-07 09:39:20 -0400
committerJonah Graham2021-04-08 10:56:14 -0400
commit2073d47084524f5d5f2c9a6cdb586f17c0348121 (patch)
treeb8f117229ccb77550265dd92378564d85778187f /build/org.eclipse.cdt.managedbuilder.core
parent22ed0e0ae6eada04cf0ee1cc00cce41e523ae015 (diff)
downloadorg.eclipse.cdt-2073d47084524f5d5f2c9a6cdb586f17c0348121.tar.gz
org.eclipse.cdt-2073d47084524f5d5f2c9a6cdb586f17c0348121.tar.xz
org.eclipse.cdt-2073d47084524f5d5f2c9a6cdb586f17c0348121.zip
Bug 572648: Handle cases of empty (EOF) JSON files
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/Messages.java2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/messages.properties3
3 files changed, 10 insertions, 1 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java
index 23a6c3fed8e..ac98bfb18d4 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java
@@ -326,6 +326,12 @@ public class CompilationDatabaseParser extends LanguageSettingsSerializableProvi
Messages.CompilationDatabaseParser_ErrorProcessingCompilationDatabase, e));
}
+ if (compileCommands == null) {
+ throw new CoreException(new Status(Status.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
+ Messages.CompilationDatabaseParser_ErrorProcessingCompilationDatabase,
+ new NullPointerException(Messages.CompilationDatabaseParser_StillNull)));
+ }
+
AbstractBuildCommandParser outputParser;
try {
outputParser = getBuildCommandParser(cfgDescription, getBuildParserId());
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/Messages.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/Messages.java
index 1a15eaff8f6..9eb07ef9370 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/Messages.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/Messages.java
@@ -27,6 +27,8 @@ public class Messages extends NLS {
public static String CompilationDatabaseParser_ProgressParsingBuildCommands;
public static String CompilationDatabaseParser_ProgressParsingJSONFile;
+ public static String CompilationDatabaseParser_StillNull;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/messages.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/messages.properties
index f5b2a80d63b..bf4d06bd974 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/messages.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/messages.properties
@@ -18,4 +18,5 @@ CompilationDatabaseParser_Job=Discover Compilation Database language settings
CompilationDatabaseParser_ProgressApplyingEntries=Applying language setting entries
CompilationDatabaseParser_ProgressExcludingFiles=Excluding files not in compilation database. Checking %d/%d (Estimate)
CompilationDatabaseParser_ProgressParsingBuildCommands=Parsing build commands (%d/%d)
-CompilationDatabaseParser_ProgressParsingJSONFile=Parsing JSON file \ No newline at end of file
+CompilationDatabaseParser_ProgressParsingJSONFile=Parsing JSON file
+CompilationDatabaseParser_StillNull=Compilation database (usually compile_commands.json) appears to be empty

Back to the top