diff --git a/biz.aQute.bndlib.tests/test/test/ProcessorTest.java b/biz.aQute.bndlib.tests/test/test/ProcessorTest.java index 0095b91ccc..88550374db 100644 --- a/biz.aQute.bndlib.tests/test/test/ProcessorTest.java +++ b/biz.aQute.bndlib.tests/test/test/ProcessorTest.java @@ -26,6 +26,7 @@ import aQute.bnd.osgi.resource.ResourceBuilder; import aQute.bnd.osgi.resource.ResourceUtils; import aQute.lib.collections.ExtList; +import aQute.lib.io.IO; import aQute.lib.strings.Strings; import aQute.service.reporter.Reporter.SetLocation; @@ -529,4 +530,16 @@ public void testMergAndSuffixes() throws IOException { } } + + @Test + public void testIncludeItself() throws IOException { + File foo = IO.getFile("generated/foo.bnd"); + IO.store("-include ./foo.bnd\nfoo=1\n", foo); + try (Processor p = new Processor()) { + p.setBase(foo.getParentFile()); + p.setProperties(foo); + assertTrue(p.check("Cyclic or multiple include of")); + } + } + } diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java index 44a3c47ba7..9c94895fd9 100644 --- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java +++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java @@ -868,6 +868,7 @@ public void doIncludeFile(File file, boolean overwrite, Properties target) throw public void doIncludeFile(File file, boolean overwrite, Properties target, String extensionName) throws Exception { if (!addIncludedIfAbsent(file)) { error("Cyclic or multiple include of %s", file); + return; } updateModified(file.lastModified(), file.toString()); Properties sub;