[ https://issues.apache.org/jira/browse/OOZIE-3375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16675605#comment-16675605 ]
Jacob Tolar commented on OOZIE-3375: ------------------------------------ I managed to work around this limitation for my use case. And I understand if my patch can't be accepted if some existing functionality will break. But generally I think it should be possible to add a parameter that is blank by default. This is currently impossible. For example, we have shared coordinators used by many users. If I just add a new property in {{workflow/configuration/property/value}} as you suggest, all users will need to become aware of the new property or they will no longer be able to submit the coordinator successfully. So I need to use the {{<parameters>}} block to to supply a default value for my new setting. But I can't make the default blank You can imagine that for many settings (e.g. {{prefix}} or {{postfix }}or something along those lines), a blank default parameter would be desirable. > 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)