Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle invalid vendordep JSON files better #228

Open
rzblue opened this issue Nov 17, 2024 · 1 comment
Open

Handle invalid vendordep JSON files better #228

rzblue opened this issue Nov 17, 2024 · 1 comment

Comments

@rzblue
Copy link
Member

rzblue commented Nov 17, 2024

Missing/incorrect keys usually results in a difficult to debug NPE when the value is accessed.

@sciencewhiz
Copy link
Contributor

It looks like there's code to throw exceptions for many errors. Do you have examples of files that have NPEs?

if (dep.name == null) {
throw new VendorParsingException(VendorParsingError.MissingName);
}
String filename = dep.name;
if (dep.mavenUrls == null) {
throw new VendorParsingException(filename, VendorParsingError.NoMavenUrl);
}
// Enumerate all group ids
Set<String> groupIds = new HashSet<>();
if (dep.cppDependencies == null) {
throw new VendorParsingException(filename, VendorParsingError.MissingCppDeps);
}
for (CppArtifact cpp : dep.cppDependencies) {
groupIds.add(cpp.groupId);
}
if (dep.jniDependencies == null) {
throw new VendorParsingException(filename, VendorParsingError.MissingJniDeps);
}
for (JniArtifact jni : dep.jniDependencies) {
groupIds.add(jni.groupId);
}
if (dep.javaDependencies == null) {
throw new VendorParsingException(filename, VendorParsingError.MissingJavaDeps);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants