Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
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
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')
-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
-rw-r--r--build/org.eclipse.cdt.meson.core/META-INF/MANIFEST.MF2
-rw-r--r--build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java5
-rw-r--r--build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/Messages.java2
-rw-r--r--build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/messages.properties3
7 files changed, 19 insertions, 4 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
diff --git a/build/org.eclipse.cdt.meson.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.meson.core/META-INF/MANIFEST.MF
index 6ad3f668a1e..136c12f7843 100644
--- a/build/org.eclipse.cdt.meson.core/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.meson.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.cdt.meson.core;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
Bundle-Activator: org.eclipse.cdt.meson.core.Activator
Bundle-Vendor: %provider
Require-Bundle: org.eclipse.core.runtime,
diff --git a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java
index 25d064b9659..dc33eb56228 100644
--- a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java
+++ b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java
@@ -336,6 +336,11 @@ public class MesonBuildConfiguration extends CBuildConfiguration {
try (FileReader reader = new FileReader(commandsFile.toFile())) {
Gson gson = new Gson();
CompileCommand[] commands = gson.fromJson(reader, CompileCommand[].class);
+ if (commands == null) {
+ throw new CoreException(Activator.errorStatus(
+ String.format(Messages.MesonBuildConfiguration_ProcCompCmds, project.getName()),
+ new NullPointerException(Messages.MesonBuildConfiguration_StillNull)));
+ }
Map<String, CompileCommand> dedupedCmds = new HashMap<>();
for (CompileCommand command : commands) {
dedupedCmds.put(command.getFile(), command);
diff --git a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/Messages.java b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/Messages.java
index 33ba2f73fd1..7103bfcc2dc 100644
--- a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/Messages.java
+++ b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/Messages.java
@@ -32,6 +32,8 @@ public class Messages extends NLS {
public static String MesonBuildConfiguration_ProcCompCmds;
public static String MesonBuildConfiguration_ProcCompJson;
+ public static String MesonBuildConfiguration_StillNull;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/messages.properties b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/messages.properties
index 2ed915078df..8aaef0b02bb 100644
--- a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/messages.properties
+++ b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/messages.properties
@@ -24,5 +24,4 @@ MesonBuildConfiguration_RunningMesonFailure=Failure running meson: %s
MesonBuildConfiguration_RunningNinjaFailure=Failure running ninja: %s
MesonBuildConfiguration_NoNinjaFileToClean=No ninja.build file so clean has nothing to do
MesonBuildConfiguration_NoNinjaFile=Meson did not create a ninja.build file so build cannot complete
-
-
+MesonBuildConfiguration_StillNull=Compilation database (usually compile_commands.json) appears to be empty

Back to the top