From b91c1ac887a59d473f0fcf82e087c8fe8f17a9b0 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Thu, 24 Aug 2023 08:51:56 +0200 Subject: [PATCH] Handle missing default VMInstall when querying JVM system-packages Fixes https://github.com/eclipse-pde/eclipse.pde/issues/721 --- .../src/org/eclipse/pde/internal/build/site/PDEState.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java b/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java index 27937c1bf56..2402837f5fd 100644 --- a/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java +++ b/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java @@ -532,14 +532,18 @@ public static String querySystemPackages(IExecutionEnvironment environment, Prop if (javaPackages == null) { String profileSystemPackages = preJava9ProfileProperties.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES, ""); //$NON-NLS-1$ if (profileSystemPackages.isBlank()) { - return null; + return List.of(); } javaPackages = COMMA.splitAsStream(profileSystemPackages).filter(p -> p.startsWith("java.")).toList(); //$NON-NLS-1$ } IVMInstall targetVM = JavaRuntime.getDefaultVMInstall(); // Set by the Target-Definition if specified there + if (targetVM == null) { + LOGGER.warn("No default JRE installation selected available"); //$NON-NLS-1$ + return List.of(); + } Collection targetVMSystemPackages = querySystemPackages(targetVM, null); if (targetVMSystemPackages == null) { - return null; + return List.of(); } Stream targetVMNonJavaPackages = targetVMSystemPackages.stream().filter(p -> !p.startsWith("java.")); //$NON-NLS-1$