Applied patch (FELIX-173) to properly deal with optional imports of locally
installed bundles.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@476515 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
index d0c39ac..509f560 100644
--- a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
+++ b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
@@ -245,36 +245,34 @@
for (int impIdx = 0; impIdx < imports.length; impIdx++)
{
+ RequirementImpl req = new RequirementImpl();
+ req.setMultiple("false");
+ req.setOptional(Boolean.toString(imports[impIdx].isOptional()));
+ req.setName("package");
+ req.addText("Import package " + imports[impIdx].toString());
+
String low = imports[impIdx].isLowInclusive()
- ? "(version>=" + imports[impIdx].getVersion() + ")"
- : "(!(version<=" + imports[impIdx].getVersion() + ")";
+ ? "(version>=" + imports[impIdx].getVersion() + ")"
+ : "(!(version<=" + imports[impIdx].getVersion() + ")";
if (imports[impIdx].getVersionHigh() != null)
{
String high = imports[impIdx].isHighInclusive()
? "(version<=" + imports[impIdx].getVersionHigh() + ")"
: "(!(version>=" + imports[impIdx].getVersionHigh() + ")";
- RequirementImpl req = new RequirementImpl();
- req.setMultiple("false");
- req.setName("package");
- req.addText("Import package " + imports[impIdx].toString());
req.setFilter("(&(package="
+ imports[impIdx].getName() + ")"
+ low + high + ")");
- addRequire(req);
}
else
{
- RequirementImpl req = new RequirementImpl();
- req.setMultiple("false");
- req.setName("package");
- req.addText("Import package " + imports[impIdx].toString());
req.setFilter(
"(&(package="
+ imports[impIdx].getName() + ")"
+ low + ")");
- addRequire(req);
}
+
+ addRequire(req);
}
}
}