use xml element to handle string escape when configure evaluator
----------------------------------------------------------------
Key: OOZIE-580
URL: https://issues.apache.org/jira/browse/OOZIE-580
Project: Oozie
Issue Type: Improvement
Reporter: Angelo K. Huang
Assignee: Angelo K. Huang
Instead of using string value to do escape, xml element is able to do it and
also avoid escaping legit character at XML element, such as <![CDATA[]]>.
public static void configureEvaluator(ELEvaluator evaluator, WorkflowJobBean
workflow, WorkflowActionBean action) {
evaluator.setVariable(WORKFLOW, workflow);
evaluator.setVariable(ACTION, action);
for (Map.Entry<String, String> entry :
workflow.getWorkflowInstance().getConf()) {
if (ParamChecker.isValidIdentifier(entry.getKey())) {
String value = entry.getValue().trim();
// escape the characters for xml
value = XmlUtils.escapeCharsForXML(value);
evaluator.setVariable(entry.getKey().trim(), value);
}
}
try {
evaluator.setVariable(ACTION_PROTO_CONF,
new XConfiguration(new
StringReader(workflow.getProtoActionConf())));
}
catch (IOException ex) {
throw new RuntimeException("It should not happen", ex);
}
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira