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

Editing Task Properties Adds Invalid @_xmlns Attribute to XML in the VSCode Extension #512

Open
SaliyaBandara opened this issue Nov 12, 2024 · 0 comments
Labels

Comments

@SaliyaBandara
Copy link

Description

When editing a task in the WSO2 Micro Integrator VSCode extension, modifying the trigger settings (such as setting a trigger count) introduces a syntax error. Specifically, an invalid _xmlns attribute appears in the message property XML, breaking the configuration and resulting in malformed XML.

Steps to Reproduce

  1. Open the WSO2 Micro Integrator VSCode extension and create a new project
  2. Create a sequence with the following XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <sequence name="InjectXMLSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
        <log category="INFO" level="custom">
            <property name="City" expression="//city"/>
        </log>
        <drop/>
    </sequence> 
  3. Create a task with the following XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="InjectXMLTask" xmlns="http://ws.apache.org/ns/synapse">
        <trigger interval="5"/>
        <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="format" value="soap12"/>
        <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
            <request xmlns="">
                <location>
                    <city>London</city>
                    <country>UK</country>
                </location>
            </request>
        </property>
        <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="injectTo" value="sequence"/>
        <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="sequenceName" value="InjectXMLSequence"/>
    </task>
  4. In the VSCode extension, open the task and use the GUI Edit button.
  5. Untick the Trigger Indefinitely option.
  6. Insert a valid number (e.g: 2) into the Count textbox and click Update.

Expected Result

The task XML should update without syntax errors.

Actual Result

The updated task XML contains a syntax error, as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="InjectXMLTask" xmlns="http://ws.apache.org/ns/synapse">
    <trigger count="2" interval="5"/>
    <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="format" value="soap12"/>
    <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
        <request @_xmlns="">
            <location>
                <city>London</city>
                <country>UK</country>
            </location>
        </request>
    </property>
    <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="injectTo" value="sequence"/>
    <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="sequenceName" value="InjectXMLSequence"/>
</task>

The message property contains an invalid @_xmlns attribute, making the XML malformed.

Version

v1.1.4

Environment Details (with versions)

OS: Windows 11 Pro 23H2

JDK

openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)

Maven

mvn -v
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: C:\Java\apache-maven-3.9.9
Java version: 17.0.2, vendor: Oracle Corporation, runtime: C:\Java\jdk-17.0.2
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant