diff --git a/solstice/CHANGELOG.md b/solstice/CHANGELOG.md index 8e22115d..809dcb5d 100644 --- a/solstice/CHANGELOG.md +++ b/solstice/CHANGELOG.md @@ -4,6 +4,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format. ## [Unreleased] ### Fixed +- Fix NoSuchElementException if package is not exported - Update selfie snapshot to fix P2Test ## [1.8.1] - 2025-01-14 diff --git a/solstice/src/main/java/dev/equo/solstice/Solstice.java b/solstice/src/main/java/dev/equo/solstice/Solstice.java index 71591143..73ec32be 100644 --- a/solstice/src/main/java/dev/equo/solstice/Solstice.java +++ b/solstice/src/main/java/dev/equo/solstice/Solstice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 EquoTech, Inc. and others. + * Copyright (c) 2023-2026 EquoTech, Inc. and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -293,11 +293,13 @@ private boolean pkgExportIsNotDuplicate( if (thisManifest.totalPkgImports().contains(pkg)) { return true; } - var element = - thisManifest.pkgExportsRaw().stream() - .filter(e -> e.getValue().equals(pkg)) - .findFirst() - .get(); + var elementOpt = + thisManifest.pkgExportsRaw().stream().filter(e -> e.getValue().equals(pkg)).findFirst(); + if (elementOpt.isEmpty()) { + return false; + } + var element = elementOpt.get(); + String mandatory = element.getDirective("mandatory"); if (mandatory != null) { if ("split".equals(element.getAttribute(mandatory))) {