-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSGi Declarative Services, Component Reference, Target Parse Error for LDAP AND-Filter #26
Comments
Unfortunately, I get then this error: It's only working for me, if I adjust the "&" with "& amp;" (without the white space) directly in the generated component.xml. cu |
It looks like many of the escaped string above got substituted for the real thing in the transition to GitHub. To be clear, when bnd sees an [ampersand] in the target property of a @reference annotation, it needs to replace with [ampersand]amp; The same goes for other XML entities, i.e. quot, apos, lt, gt. |
Ok, I have corrected my copy'n'paste because of the substituted characters. Summarizing: cu |
Sorry that sounds different from what I oriniginally understood. Are you saying that when the XML contains a properly escaped ampersand, the DS runtime throws an exception? That sounds like a runtime error, you may need to go back and report it against Equinox or Felix. Could you paste (a) the generated component.xml and (b) the stack trace of the runtime exception? |
(a) and (b) see above My Java Source contains a single ampersand char. Compiling is OK. The generated component.xml contains then a single(!) ampersand char (not escaped). If I do manually correct (in the generated component.xml) the single ampersand to [ampersand] a m p ; (without the white spaces, replace the square brackets with a single ampersand char) I get no runtime exception. |
Okay good. That's what I expected, but I got confused. So bnd just needs to perform the escaping correctly when generating component XMLs. In the meantime you can work around by putting the fully escaped [ampersand]amp; in your source. Unfortunately your code will then break as soon as the correct escaping is implemented! Bnd would generate: "[ampersand]amp;amp;". Perhaps the fix should include a check to make sure that the string is not already escaped in the source. |
As you mentioned above, bnd have to escape the XML entities before storing them into the generated component.xml (that's was I'm doing manually with the [ampersand]) //Sorry, I have written my post parallel to you answer |
The "source" is the generated component.xml ! (writing the fully escaped [ampersand]amp; in the java source I get the Now, you have the workaround confirmed and I'm waiting for the bnd bug fix. cu |
Sorry I'm confused again. When I said "source" I always meant Java source, not component.xml (that file is generated, so it cannot be "source"). Let's try to reconfirm this again. What happens when you put the fully escaped [ampersand]amp; in your JAVA source? A contributed patch would certainly be welcome. The bug is in bnd, not bndtools, that's why I directed you to this bug tracker. Bndtools is just UI on top of bnd. |
You cannot use & because the filter is verified :-( So I made a fix that is in the repo now, version 1.12.0 |
the & in the previous comment should read "& a m p ;", seems Github changes the entity also |
copy from [equinox-dev]
http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg06472.html
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:
copy'n'paste corrected for readability:
< 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
The text was updated successfully, but these errors were encountered: