Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following example produces an exception when accessing stage.XMLProperties.Usage.Session.SchemaReconciliation.FailOnTypeMismatch

Code Block
languagegroovy
def sFOTM = " " +  stage.XMLProperties.Usage.Session.SchemaReconciliation.FailOnTypeMismatch.toString() + " ";
if (sFOTM.substring(1,2) == "0") { // schema recon off
  return true
}

...

The example given above would therefore be better implemented using the following expressions:

Code Block
languagegroovy
def sFOTM = stage?.XMLProperties.Usage.Session.SchemaReconciliation.FailOnTypeMismatch[0]
if (sFOTM == "0") {
   == sFOTMreturn true
}

The example above also appends a space at the start and end of the string, and uses a .toString() and sFOTM.substring(1,2) to strip off the square brackets ([]) which are present when an XML Property is an array.

Given that, we’d suggest:

Code Block
def sFOTM = stage?.XMLProperties.Usage.Session.SchemaReconciliation.FailOnTypeMismatch
if (sFOTM == "0") {
   return true
}