From 19d4ee169e505756ab0dfb6bd0b8f265f216a01a Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Tue, 11 Jun 2024 12:53:33 -0500 Subject: [PATCH] Do not include empty directories as packages --- .../java/org/apache/felix/atomos/impl/base/AtomosBase.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java b/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java index 231786b..864342d 100644 --- a/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java +++ b/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java @@ -1663,9 +1663,11 @@ void addPackages(Bundle b) try { content.getEntries().forEach((s) -> { - if (s.length() > 1 && s.endsWith("/") && s.indexOf('-') < 0) + int sLen = s.length(); + int lastSlash = s.lastIndexOf('/'); + if (sLen > 1 && s.indexOf('-') < 0 && lastSlash > 0 && lastSlash != sLen - 1) { - String pkg = s.substring(0, s.length() - 1).replace('/', '.'); + String pkg = s.substring(0, lastSlash).replace('/', '.'); packageToAtomosContent.put(pkg, (AtomosContentIndexed) atomosContent); }