Giter Club home page Giter Club logo

Comments (11)

boeffi avatar boeffi commented on August 18, 2024

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

Unfortunately, I get then this error:
Description Resource Path Location Type
Service-ComponentInvalid Service-Component header: test.TestComponent {}, throws java.lang.IllegalArgumentException: Filter mismatch: expected ) at position 2 : (& amp;(test=A)(test2=B1)) bnd.bnd /test.a.service line 1 Bnd OSGi Problem Marker

It's only working for me, if I adjust the "&" with "& amp;" (without the white space) directly in the generated component.xml.

cu
Boeffi

from bnd.

njbartlett avatar njbartlett commented on August 18, 2024

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.

from bnd.

boeffi avatar boeffi commented on August 18, 2024

Ok, I have corrected my copy'n'paste because of the substituted characters.

Summarizing:
when I write the [ampersand] directly in the @reference ... target attribute, the syntax checking inside eclipse is ok and the generated component.xml contains the [ampersand]. At runtime I get the (parser) exception.

cu
Boeffi

from bnd.

njbartlett avatar njbartlett commented on August 18, 2024

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?

from bnd.

boeffi avatar boeffi commented on August 18, 2024

(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).
In this case I get a runtime exception.

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.

from bnd.

njbartlett avatar njbartlett commented on August 18, 2024

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.

from bnd.

boeffi avatar boeffi commented on August 18, 2024

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])
Am I right?

//Sorry, I have written my post parallel to you answer

from bnd.

boeffi avatar boeffi commented on August 18, 2024

In the meantime you can work around by putting the
fully escaped [ampersand]amp; in your source.

The "source" is the generated component.xml !

(writing the fully escaped [ampersand]amp; in the java source I get the
"...Filter mismatch: expected ) at position 2...")

Now, you have the workaround confirmed and I'm waiting for the bnd bug fix.
(May be I can help? Is the bug contained in bnd or the bndtools?)

cu
Boeffi

from bnd.

njbartlett avatar njbartlett commented on August 18, 2024

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.

from bnd.

pkriens avatar pkriens commented on August 18, 2024

You cannot use & because the filter is verified :-( So I made a fix that is in the repo now, version 1.12.0

from bnd.

pkriens avatar pkriens commented on August 18, 2024

the & in the previous comment should read "& a m p ;", seems Github changes the entity also

from bnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.