[
https://issues.apache.org/jira/browse/OOZIE-3375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16668087#comment-16668087
]
Jacob Tolar edited comment on OOZIE-3375 at 10/30/18 4:10 AM:
--------------------------------------------------------------
{code:java}
bin/test-patch --patch=OOZIE-3375-001.patch{code}
passed for me (maybe I didn't quite invoke it correctly?), but
{code:java}
mvn install -Dtest=TestSubmitXCommand{code}
fails. I'll look at the failed tests.
Edit:
The four test cases are all expecting a 'null' instead of an empty string.
* TestSubmitXCommand.testProtoConfStorage (line 322)
This test fails a "how many items are in the configuration" test, because
there's a blank item in the configuration now that would have been dropped
before:
{code:xml}
<property><name>oozie.wf.application.lib</name><value/><source>programatically</source></property>{code}
* TestConfigurationService.testOozieConfig (line 233)
{code}
// The cookie.domain config is in oozie-default.xml mostly for
documentation purposes, but it needs to have an empty string
// value by default, which Configuration parses as null
assertNull(cl.getConf().get(AuthFilter.OOZIE_PREFIX +
AuthFilter.COOKIE_DOMAIN));
{code}
Expected null, got empty string
* TestSLAAlertXCommand.testCoordSLAAlertCommands (line 214)
Expected null, got empty string
* TestSLAAlertXCommand.testBundleSLAAlertCommands (line 107)
Expected null, got empty string
was (Author: jtolar):
{code:java}
bin/test-patch --patch=OOZIE-3375-001.patch{code}
passed for me (maybe I didn't quite invoke it correctly?), but
{code:java}
mvn install -Dtest=TestSubmitXCommand{code}
fails. I'll look at the failed tests.
> 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
> 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)