Skip to content
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

Rule export escapes special characters in rules unnecessarily #27

Closed
aldaris opened this issue Oct 2, 2019 · 1 comment
Closed

Rule export escapes special characters in rules unnecessarily #27

aldaris opened this issue Oct 2, 2019 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@aldaris
Copy link

aldaris commented Oct 2, 2019

Describe the bug
When trying to export the following rule:

//PrimaryPrefix/Name[@Image[ends-with(., 'Instant.now')]][pmd-java:typeIs('java.time.Instant')]|
//PrimaryPrefix/Name[@Image='now'][//ImportDeclaration[@Static=true()]/Name[@Image='java.time.Instant.now' or @Image='java.time.Instant']]

The export result pane displays the rule incorrectly escaped:

         <value>
<![CDATA[
//PrimaryPrefix/Name[@Image[ends-with(., &apos;Instant.now&apos;)]][pmd-java:typeIs(&apos;java.time.Instant&apos;)]|
//PrimaryPrefix/Name[@Image=&apos;now&apos;][//ImportDeclaration[@Static=true()]/Name[@Image=&apos;java.time.Instant.now&apos; or @Image=&apos;java.time.Instant&apos;]]
]]>
         </value>

Within a CDATA it should not be necessary to escape apostrophe as &apos;, and the same seemed to happen with double quotes as well.

To Reproduce
Steps to reproduce the behavior:

  1. Launch the designer from run.sh designer
  2. Specify rule as above
  3. Click on Export XPath to XML rule
  4. Look at Export result pane
  5. When you try to use the rule as is with pmd, the rule parser will blow up with an XPath parsing exception.

Expected behavior
The CDATA body is not escaped unnecessarily.

Screenshots
Let me know if you need one.

Desktop (please complete the following information):

  • OS: macOS Mojave 10.14.6
  • Java:
    openjdk version "11.0.3" 2019-04-16
    OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7)
    OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)
@aldaris aldaris added the bug Something isn't working label Oct 2, 2019
@oowekyala
Copy link
Member

@aldaris Thanks for the report, indeed this is a bug

@oowekyala oowekyala added this to the 6.19.0 milestone Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants