[ 
https://issues.apache.org/jira/browse/OOZIE-3375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andras Piros reassigned OOZIE-3375:
-----------------------------------

    Assignee: Jacob Tolar

> Can't use empty <parameters> in coordinator
> -------------------------------------------
>
>                 Key: OOZIE-3375
>                 URL: https://issues.apache.org/jira/browse/OOZIE-3375
>             Project: Oozie
>          Issue Type: Bug
>            Reporter: Jacob Tolar
>            Assignee: Jacob Tolar
>            Priority: Major
>         Attachments: OOZIE-3375-001.patch
>
>
> If I set a property to empty string in the {{<parameters>}} block of my 
> coordinator and later use it in the {{<action>}} block Oozie throws an error.
> That is, this code fails:
> {code:java}
> <coordinator-app name="param-test" frequency="5" start="2018-10-01T00:00Z" 
> end="2018-10-01T00:04Z" timezone="UTC" xmlns="uri:oozie:coordinator:0.5">
>     <parameters>
>         <property>
>             <name>test_param</name>
>             <value></value>
>         </property>
>     </parameters>
>     <controls>
>         <timeout>5</timeout>
>         <concurrency>1</concurrency>
>     </controls>
>     <action>
>         <workflow>
>             <app-path>/workflow.xml</app-path>
>             <configuration>
>                 <property>
>                     <name>renamed_param</name>
>                     <value>${test_param}</value>
>                 </property>
>             </configuration>
>         </workflow>
>     </action>
> </coordinator-app>
> {code}
> The error is like this:
> {code:java}
> org.apache.oozie.command.CommandException: E1021: Coord Action Input Check 
> Error: E1004: Expression language evaluation error, Unable to evaluate 
> :${test_param}:
> ...
> Caused by: javax.servlet.jsp.el.ELException: variable [test_param] cannot be 
> resolved
> {code}
> What happens: The coordinator submits successfully. When the first action 
> materializes in 
> [CoordMaterializeTransitionXCommand|https://github.com/apache/oozie/blob/65936460e263f9076bb552190be85396c2cc6d33/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java#L373-L379],
>  the coordinator conf is parsed into an Oozie {{XConfiguration}} object.
> In 
> [XConfiguration.processNodes|https://github.com/apache/oozie/blob/65936460e263f9076bb552190be85396c2cc6d33/core/src/main/java/org/apache/oozie/util/XConfiguration.java#L313-L354],
>  present-but-empty values are not added to the configuration. Specifically, 
> this condition:
> {code:java}
>                     if ("value".equals(field.getLocalName()) && 
> field.hasChildNodes()) {
>                         value = ((Text) field.getFirstChild()).getData();
>                     }
> {code}
> fails – {{field.hasChildNodes()}} returns {{false}} if the input is 
> {{<value></value>}} or {{<value />}}. This prevents the configuration setting 
> from being added to the {{XConfiguration}}.
> I suggest a fix like this:
> {code:java}
>                     if ("value".equals(field.getLocalName())) {
>                         if (field.hasChildNodes()) {
>                             value = ((Text) field.getFirstChild()).getData();
>                         }
>                         if (value == null) {
>                             value = "";
>                         }
>                     }
>  {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to