Review Board 1.7.22


OOZIE-580 use xml element to handle string escape when configure evaluator

Review Request #2427 - Created Oct. 18, 2011 and submitted

Angelo K. Huang
trunk
OOZIE-580
Reviewers
oozie
oozie
try {
        String valueElem = "<value>"+value+"</value>";
        XmlUtils.parseXml(valueElem);
}
catch (JDOMException ex) {
        // It should not happen, so escape the characters for xml
        value = XmlUtils.escapeCharsForXML(value);
}

With above check, for element CDATA can be avoided for escaping, EX:

For these two elements, first one has to convert because of '&', however second one can be avoided.
 
    <property>
      <name>test.ampsign</name>
      <value>http://app1.soln-stage.nova.cp.vip.ne1.yahoo.com/nova-webservices?urlSigner=signUrl&namespace=nova.proxy</value>
    </property>
    <property>
      <name>test.cdata</name>
      <value><![CDATA[?redirect=http%3A%2F%2Fapp1.soln-stage.nova.cp.vip.ne1.yahoo.com%3A4080%2Fnova-webservices%2Fv1%2FurlSigner%2FsignUrl&amp;namespace=nova.proxy&amp;keyDBHash=Vsy6n_C7K6NG0z4R2eBlKg--]]></value>
    </property>


*** & has to convert to &amp; ***
*** <![CDATA[]] does not need to convert. ***

    <property>
      <name>test.ampsign</name>
      <value>http://app1.soln-stage.nova.cp.vip.ne1.yahoo.com/nova-webservices?urlSigner=signUrl&amp;namespace=nova.proxy</value>
    </property>
    <property>
      <name>test.cdata</name>
      <value><![CDATA[?redirect=http%3A%2F%2Fapp1.soln-stage.nova.cp.vip.ne1.yahoo.com%3A4080%2Fnova-webservices%2Fv1%2FurlSigner%2FsignUrl&namespace=nova.proxy&keyDBHash=Vsy6n_C7K6NG0z4R2eBlKg--]]></value>
    </property>






 
Review request changed
Updated (Oct. 25, 2011, 1:43 a.m.)
Ship it!
Posted (Oct. 25, 2011, 7:02 a.m.)
Minor comment, otherwise its good to go.
Is this a typo?
  1. it is not. it is valid syntax of javadoc.