[ 
https://issues.apache.org/jira/browse/OOZIE-2400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15133209#comment-15133209
 ] 

Robert Kanter commented on OOZIE-2400:
--------------------------------------

I'm not sure I'd call this a bug and the namespace prefix-less XML a 
workaround.  That's the expected way of writing workflow XMLs.  Users usually 
complain about Oozie's XML being too verbose, not the other way around :)

I suppose that as long as the existing namespace prefix-less XML still works 
with the patch, we should fix this; as you both pointed out, this is also valid 
XML.

Feedback on the patch:
- In the test, we should use a try-finally to make sure the {{InputStream}} is 
always closed
- Missing newline at the end of the XML file
- I did a quick grep of "getTagName" and found that {{OozieCLI}} also has some 
of these, where it copied some code from {{XConfiguration}}.  We should fix 
this there as well.
- I also took a quick look at the [JavaDoc for 
{{getLocalName}}|https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/Node.html#getLocalName()].
  Looks like it has some conditions where it can return {{null}}.  Are we 100% 
sure that this case can't happen here?  We don't want an NPE.

> Workflow xml configuration parser cannot deal with namespace prefix
> -------------------------------------------------------------------
>
>                 Key: OOZIE-2400
>                 URL: https://issues.apache.org/jira/browse/OOZIE-2400
>             Project: Oozie
>          Issue Type: Bug
>          Components: core
>    Affects Versions: trunk, 4.1.0, 4.2.0, 4.3.0
>         Environment: Oracle Linux 6.6, Oozie 4.1.0, Cloudera CDH 5.4.2
>            Reporter: Roman Krüger
>              Labels: easyfix
>             Fix For: trunk, 4.1.0, 4.2.0, 4.3.0
>
>         Attachments: OOZIE-2400-1.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> When running a java action and a spark action via an oozie workflow xml, the 
> xml contains multiple namespaces (e.g. uri:oozie:workflow:0.5 and 
> uri:oozie:spark-action:0.1).
> Thus the elements need to be prefixed by the namespace prefix. But when 
> running this workflow, the configuration parser throws the exception "*JA009: 
> bad conf file: top-level element not <configuration>*".
> The bug is located in class org.apache.oozie.util.XConfiguration in methods 
> "parseDocument(Document doc)" and "processNodes(Element root)". The xml tags 
> here are retrieved via "getTagName()", (which gets the full tag name) and 
> compared against string constants like "configuration". So this fails in case 
> the tag contains a namespace prefix and it seems there is no workaround!
> Here is an easy fix for this. All calls of "getTagName()" in these 2 methods 
> can be replaced by "getLocalName()".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to