mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
make the extractor not crash on invalid "package.json" files
This commit is contained in:
@@ -9,6 +9,7 @@ import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import com.semmle.js.extractor.ExtractorConfig.Platform;
|
||||
import com.semmle.js.extractor.ExtractorConfig.SourceType;
|
||||
@@ -128,7 +129,7 @@ public class ScriptExtractor implements IExtractor {
|
||||
String result = new Gson().fromJson(reader, PackageJSON.class).type;
|
||||
packageTypeCache.put(folder, Optional.ofNullable(result));
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user