[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] OSGi Declarative Services, Component Reference, Target Parse Error for LDAP AND-Filter

Hello Boeffi,

Thank you for your kind words about bndtools :-)

The ampersand does need to be escaped as & in the generated
component XML, to comply with normal XML rules. This sounds like a bug
in bnd's annotation processor, it should be escaping the string that
you provide via the annotation.

Please could you raise a bug against bnd via its issue tracker on
GitHub: http://github.com/bnd/bnd/issues

Until the problem is fixed, it should be possible workaround it by
simply writing & directly in the annotation property.

Regards,
Neil

On Sun, Oct 24, 2010 at 7:32 PM, cu@xxxxxxxxxx <cu@xxxxxxxxxx> wrote:
> Hello from Germany,
>
> this is my first post to this list. I hope you can help me or we can help us
> together.
>
> I get an IOException if I define a LDAP AND-Filter-Expression for selection
> an appropriate target service (details see below):
> ...target='(&(test=A)(test2=B1))'
>
> The problem is the boolean ldap-and-operator, the ampersand.
>
> After adjusting the "&" to "&amp;" the parse error is gone as expected.
> I'm not sure, but can this be the intention? Must the filter definition
> (with the original LDAP syntax) adjusted to make it compatible to the xml
> universum?
>
> The component.xml was generated from my sources by the great Bndtools from
> Neil Bartlett (a small advert ;-)
> :
> @Reference(name="testRef",optional=true,dynamic=true,target="(&(test=A)(test2=B1))")
> private void bind(ITest test, Map<String, ?> configuration) {...}
>
> I'm pleased to read your suggestions?
>
> cu
> Boeffi
>
> using the jars from helios 3.6.1
> - org.eclipse.osgi_3.6.1.R36x_v20100806.jar
> - org.eclipse.equinox.ds_1.2.1.R36x_v20100803.jar
> - org.eclipse.equinox.util_1.0.200.v20100503.jar
> - org.eclipse.osgi.services_3.2.100.v20100503.jar
>
> <?xml version='1.0' encoding='utf-8'?>
> <component name='test.TestComponent'
> xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' immediate='true'
> activate='activate' deactivate='deactivate'>
> Â <implementation class='test.TestComponent'/>
> Â <reference name='testRef' interface='test.ITest' cardinality='0..1'
> bind='bind' unbind='unbind' policy='dynamic'
> target='(&(test=A)(test2=B1))'/>
> Â <reference name='testRef2' interface='test.ITest' cardinality='0..1'
> bind='bind2' unbind='unbind2' policy='dynamic' target='(test2=B2)'/>
> </component>
>
>
> osgi> !SESSION 2010-10-24 19:36:01.914
> -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.6.0_21
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
>
> !ENTRY test.a.service 4 0 2010-10-24 19:36:01.916
> !MESSAGE [SCR] Error occurred while opening component definition file
> bundleentry://4.fwk724000057/OSGI-INF/test.TestComponent.xml
> !STACK 0
> java.io.IOException: [Line: 4, Pos: 169]Â ';' expected.
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.err(XMLParserImpl.java:1062)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.err(XMLParserImpl.java:1048)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parse_EntityRef(XMLParserImpl.java:978)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parse_attr_value(XMLParserImpl.java:303)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parse_attr(XMLParserImpl.java:357)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parse_attr_list(XMLParserImpl.java:389)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parse_tag_normal(XMLParserImpl.java:520)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parse_tag(XMLParserImpl.java:814)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parse_tag_normal(XMLParserImpl.java:545)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.impl.XMLParserImpl.parseXML(XMLParserImpl.java:1100)
> ÂÂÂ at
> org.eclipse.equinox.internal.util.xml.XMLParser.parseXML(XMLParser.java:95)
> ÂÂÂ at
> org.eclipse.equinox.internal.ds.model.DeclarationParser.parse(DeclarationParser.java:107)
> ÂÂÂ at
> org.eclipse.equinox.internal.ds.ComponentStorage.parseXMLDeclaration(ComponentStorage.java:87)
> ÂÂÂ at
> org.eclipse.equinox.internal.ds.storage.file.FileStorage.loadComponentDefinitions(FileStorage.java:92)
> ÂÂÂ at
> org.eclipse.equinox.internal.ds.SCRManager.startedBundle(SCRManager.java:586)
> ÂÂÂ at
> org.eclipse.equinox.internal.ds.SCRManager.bundleChanged(SCRManager.java:234)
> ÂÂÂ at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:919)
> ÂÂÂ at
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
> ÂÂÂ at
> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
> ÂÂÂ at
> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1349)
> ÂÂÂ at
> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1300)
> ÂÂÂ at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:380)
> ÂÂÂ at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
> ÂÂÂ at
> bndtools.launcher.BundleInstaller.performStarts(BundleInstaller.java:351)
> ÂÂÂ at
> bndtools.launcher.BundleInstaller.performAllChanges(BundleInstaller.java:244)
> ÂÂÂ at
> bndtools.launcher.BundleInstaller.synchronizeBundles(BundleInstaller.java:134)
> ÂÂÂ at bndtools.launcher.BundleInstaller.run(BundleInstaller.java:85)
> ÂÂÂ at java.lang.Thread.run(Thread.java:619)
>
>
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/equinox-dev
>
>