Skip to content

Commit c26ab9e

Browse files
committed
fixed NPE if packages tag in graalpy-maven-plugin empty
1 parent 4e6c0ae commit c26ab9e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

graalpython/graalpy-maven-plugin/src/main/java/org/graalvm/python/maven/plugin/ManageResourcesMojo.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ public void execute() throws MojoExecutionException {
142142
manageNativeImageConfig();
143143
}
144144

145+
private void trim(List<String> l) {
146+
Iterator<String> it = l.iterator();
147+
while(it.hasNext()) {
148+
String p = it.next();
149+
if(p == null || p.trim().isEmpty()) {
150+
it.remove();
151+
}
152+
}
153+
}
154+
145155
private void manageNativeImageConfig() throws MojoExecutionException {
146156
Path metaInf = getMetaInfDirectory(project);
147157
Path resourceConfig = metaInf.resolve("resource-config.json");
@@ -264,6 +274,9 @@ private void manageVenv() throws MojoExecutionException {
264274

265275
var venvDirectory = getVenvDirectory(project);
266276

277+
if(packages != null) {
278+
trim(packages);
279+
}
267280
if (packages == null || packages.isEmpty()) {
268281
getLog().info(String.format("No venv packages declared, deleting %s", venvDirectory));
269282
delete(venvDirectory);

0 commit comments

Comments
 (0)