I've made a small amount of headway on this issue. It seems that there
are two schemas used for creating OBRs (described here
<http://felix.apache.org/site/apache-felix-osgi-bundle-repository.html#ApacheFelixOSGiBundleRepository-OBRRepositoryFile>).
The repository file I created using the repoindex tool (a.k.a bindex,
here <https://github.com/osgi/bindex>), seems to have the form defined
by the OSGi spec and not the Felix OBR form. In looking at the source
code where the exception occurs (I have a copy of the source but I was
unable to find a link to it now; it seems surprisingly difficult to
find) it seems that the repository parser is looking for a tag called
"require" and not "requirement" which is what my repository XML file
has. So my question is "how do I get the bundlerepository code to parse
my OSGi repository file?" Or, I could also solve this problem by
creating a repository file in the OBR format but I'm not sure how to do
that.
I should also probably state my main goal: I'm trying to update a remote
OBR XML file with the data for a new bundle resource. I know the Maven
Bundle Plugin does this but I'm actually trying to write a similar
plugin for Leiningen - Clojure's build tool.
Any help with this would be greatly appreciated.
Tim
On 09/24/2014 10:10 PM, Tim McIver wrote:
> Hello,
>
> I'm getting an NPE when trying to write an OBR to file; I'm not sure
> what I'm doing wrong. Here's the stack trace I see:
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.apache.felix.bundlerepository.impl.DataModelHelperImpl.toXml(DataModelHelperImpl.java:380)
> at
> org.apache.felix.bundlerepository.impl.DataModelHelperImpl.toXml(DataModelHelperImpl.java:336)
> at
> org.apache.felix.bundlerepository.impl.DataModelHelperImpl.toXml(DataModelHelperImpl.java:299)
> at
> org.apache.felix.bundlerepository.impl.DataModelHelperImpl.writeRepository(DataModelHelperImpl.java:186)
> at com.timmciver.App.main(App.java:19)
>
> And here's the test class I created that gives this exception:
>
> // start
> package com.timmciver;
>
> import org.apache.felix.bundlerepository.DataModelHelper;
> import org.apache.felix.bundlerepository.Repository;
> import org.apache.felix.bundlerepository.impl.DataModelHelperImpl;
>
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.OutputStreamWriter;
> import java.io.Writer;
>
> public class App {
> public static void main(String[] args) throws Exception {
> File repoFile = new File(args[0]);
> DataModelHelper dmh = new DataModelHelperImpl();
> Repository repo = dmh.repository(repoFile.toURI().toURL());
> File outFile = File.createTempFile("obr-test-", ".xml");
> try (Writer writer = new OutputStreamWriter(new
> FileOutputStream(outFile))) {
> dmh.writeRepository(repo, writer);
> }
> }
> }
> //end
>
> I've also created a github repo if anyone wants to run it themselves:
> https://github.com/tmciver/obr-test.
>
> Thanks,
> [email protected]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>