Skip to main content

[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
>
>


Back to the top