Siebel Presumed Child Property Set

男娘i 2021-12-24 01:17 220阅读 0赞

Scripts presume the existence of a child property set. For example see the following code snippet

  1. function CheckAndImport()
  2. {. . . . .
  3. bsAdapter.InvokeMethod("Query",vInputs,vOutputs);
  4. var vInMsg = vOutputs.GetChild(0);
  5. vInputs.Reset();
  6. vOutputs.Reset();
  7. vInputs.AddChild(vInMsg);
  8. vInputs.SetProperty("MapName","Midea Price List Item Import");
  9. bsTransfer.InvokeMethod("Execute",vInputs,vOutputs);
  10. var vOutMsg = vOutputs.GetChild(0);
  11. . . . . . }

This could lead to unhandled errors and corrupt data, since when an operation is performed on a nonexistent child, an error is thrown.

Recommendation

Ensure that the presence of the child property set is always checked by ensuring the GetChildCount() method of the parent returns a positive number.

An example used in the scenario is based on the preceding code: BY DW

  1. function CheckAndImport()
  2. {. . . . .
  3. bsAdapter.InvokeMethod("Query",vInputs,vOutputs);
  4. if(vOutputs.GetChildCount()>0)
  5. {
  6. var vInMsg = vOutputs.GetChild(0);
  7. vInputs.Reset();
  8. vOutputs.Reset();
  9. vInputs.AddChild(vInMsg);
  10. vInputs.SetProperty("MapName","Midea Price List Item Import");
  11. bsTransfer.InvokeMethod("Execute",vInputs,vOutputs);
  12. var vOutMsg = vOutputs.GetChild(0);
  13. }
  14. . . . . . }

转载于:https://www.cnblogs.com/Flamo/p/3977622.html

发表评论

表情:
评论列表 (有 0 条评论,220人围观)

还没有评论,来说两句吧...

相关阅读