Skip to content

Commit

Permalink
[FIXED] fixed NPE in nversion
Browse files Browse the repository at this point in the history
  • Loading branch information
thevpc committed Jan 26, 2024
1 parent 742a52c commit 6770966
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public Set<VersionDescriptor> resolve(String filePath, NSession session) {
.setDescriptorStyle(NDescriptorStyle.MAVEN)
.parse(inputStream).get(session);

properties.put("groupId", d.getId().getGroupId());
properties.put("artifactId", d.getId().getArtifactId());
properties.put("version", d.getId().getVersion());
properties.put("name", d.getName());
putNonNull(properties,"groupId", d.getId().getGroupId());
putNonNull(properties,"artifactId", d.getId().getArtifactId());
putNonNull(properties,"version", d.getId().getVersion());
putNonNull(properties,"name", d.getName());
properties.setProperty("nuts.version-provider", "maven");
if (d.getProperties() != null) {
for (NDescriptorProperty e : d.getProperties()) {
properties.put("property." + e.getName(), e.getValue());
putNonNull(properties,"property." + e.getName(), e.getValue());
}
}
all.add(new VersionDescriptor(
Expand All @@ -65,11 +65,17 @@ public Set<VersionDescriptor> resolve(String filePath, NSession session) {
.build(),
properties));
} catch (Exception e) {
//e.printStackTrace();
// e.printStackTrace();
}
return all;
} else {
return null;
}
}
private void putNonNull(Properties p,String s,Object v){
if(s==null || v==null){
return;
}
p.put(s,v.toString());
}
}

0 comments on commit 6770966

Please sign in to comment.