Gel Script not working after Upgrade to v15.8.1

book

Article ID: 196722

calendar_today

Updated On:

Products

Clarity PPM SaaS Clarity PPM On Premise

Issue/Introduction

Some Gel Scripts working in 15.8.0 fail after upgrade to 15.8.1. 

STEPS TO REPRODUCE: 

1. Create a process
2. Create a process step which runs the following gel script (also attached as .txt here)
<gel:script 
                  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" 
                  xmlns="http://www.w3.org/2001/XMLSchema" 
                  xmlns:core="jelly:core" 
                  xmlns:sql="jelly:sql" 
                  xmlns:util="jelly:util" 
                  xmlns:xog="http://www.niku.com/xog" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                  <!--  Create the xog client  -->
    <core:new className="com.niku.xog.client.XOGClientInterface" var="XOGAdminClient"/>
                  
                  <!--  Get the Clarity Version for XML Header -->
    <core:invokeStatic className="com.niku.union.config.ConfigurationManager" method="getInstance" var="thisClarityConfig"/>
    <core:set value="${thisClarityConfig.getVersionProperty('version')}" var="ClarityVersion"/>
                  <gel:log>Clarity version: ${ClarityVersion}</gel:log>
                  
                  <!-- *** Project XML Creation *** -->
                                    <gel:parse var="xml">
                                    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
                                      <Header action="write" externalSource="NIKU" objectType="project" version="${ClarityVersion}"/>
                                                      <Projects>
                                      <!-- insert the project tag here -->
                                                      </Projects>
                                    </NikuDataBus>
                                    </gel:parse>  
                                                                        
                                    <!--Create XML for Project -->
                                    <gel:parse var="Project">
                                                      <Project name="Test" projectID="test123456">
                                                                        <Tasks>
                                                                                          <!-- insert the task tag here -->
                                                                        </Tasks>
                                                      </Project>
                                    </gel:parse>  
                                    
                                    <!-- Create XML for task -->
                                    <gel:parse var="Task">
                                                      <Task finish="2020-12-31T17:00:00" internalTaskID="5078120" milestone="false" name="Test" outlineLevel="1" start="2020-06-01T00:00:00" status="0" taskID="~rmw">
                                                                        <estimateRules />
                                                      </Task> 
                                    </gel:parse>                               
                                    
                                    <gel:set insert="true" select="$Project//Tasks" value="${Task}"/>
                                    <gel:set insert="true" select="$xml/NikuDataBus/Projects" value="${Project}"/>
                                    <gel:log>XML: <gel:expr select="$xml"/></gel:log>               
                  
                  <gel:log>Project/Task XML To be XOGGED:<gel:expr select="$xml"/> </gel:log>
<!--  Send the XOG request to Clarity -->
                  <core:invoke method="invoke" on="${XOGAdminClient}" var="xogResponse">
        <core:arg type="java.lang.String" value="xoguser"/>
        <core:arg type="org.w3c.dom.Document" value="${xml}"/>
    </core:invoke> 
<!-- Print the read response of XOG -->                                     
                  <gel:log>Response: <gel:expr select="$xogResponse"/> </gel:log>
</gel:script>

3. connect the step, validate, activate and run the process.


Expected results: Process with the gel script to run successfully as it was in PPM 15.8.0 and older releases.

Actual results: Process fails with gel tag exceptions captured in BPM errors and BG-ca.logs:--

BPM-0704: An error occurred while executing custom script: org.apache.commons.jelly.JellyTagException: null:32:68: <gel:set> Missing or invalid XML at com.niku.union.gel.tags.SetTag.doTag(SetTag.java:137) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:248) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:96) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:187) at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:248) at com.niku.union.gel.GELScript.run(GELScript.java:58) at com.niku.union.gel.GELController.invoke(GELController.java:74) at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:207) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: org.apache.commons.jelly.JellyTagException: null:-1:-1: <null> <gel:set> attribute 'select' $Project//Tasks does not refer to an existing node. at com.niku.union.gel.tags.SetTag.doTag(SetTag.java:73) ... 11 more Root cause org.apache.commons.jelly.JellyTagException: null:-1:-1: <null> <gel:set> attribute 'select' $Project//Tasks does not refer to an existing node. at com.niku.union.gel.tags.SetTag.doTag(SetTag.java:73) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:248) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:96) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:187) at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:248) at com.niku.union.gel.GELScript.run(GELScript.java:58) at com.niku.union.gel.GELController.invoke(GELController.java:74) at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:207) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)

Cause

This is due to DE56573 related to Gel tags with invalid namespaces

 

Environment

CLARITY 15.8.1

Resolution

DE56573, fixed in 15.9 and 15.8.1 patch 2.

Workaround:

Remove gel namespace from gel header. 

xmlns="http://www.w3.org/2001/XMLSchema" 

In prior Clarity releases even if there was such namespace references the same would not error out but in 15.8.1 this fails

Examples of valid namespace references in gel scripts..

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:core="jelly:core" 

xmlns:sql="jelly:sql" 

xmlns:util="jelly:util"

Note: 

With valid parse tag the system maps namespace to the valid library. The gel parse tag gel parse relaxes the incorrect namespace reference.

For example xmlns:xyz="jelly:com.niku.union.gel.GELTagLibrary"
....
....


<xyz:parse var="xml">
  <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="${ClarityVersion}"/>
   <Projects>