zoukankan      html  css  js  c++  java
  • Siebel Presumed Child Property Set

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

    function CheckAndImport()
    {. . .  . .
    bsAdapter.InvokeMethod("Query",vInputs,vOutputs);
    var vInMsg = vOutputs.GetChild(0);
    vInputs.Reset();
    vOutputs.Reset();
    vInputs.AddChild(vInMsg);    
    vInputs.SetProperty("MapName","Midea Price List Item Import");
    bsTransfer.InvokeMethod("Execute",vInputs,vOutputs);
    var vOutMsg = vOutputs.GetChild(0);
    . . . . . }

    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

    function CheckAndImport()
    {. . .  . .
    bsAdapter.InvokeMethod("Query",vInputs,vOutputs);
    if(vOutputs.GetChildCount()>0)
    {
    var vInMsg = vOutputs.GetChild(0);
    vInputs.Reset();
    vOutputs.Reset();
    vInputs.AddChild(vInMsg);    
    vInputs.SetProperty("MapName","Midea Price List Item Import");
    bsTransfer.InvokeMethod("Execute",vInputs,vOutputs);
    var vOutMsg = vOutputs.GetChild(0);
    }
    . . . . . }
  • 相关阅读:
    008Spring & JPA & Hibernate & MySQL
    007Spring Security
    006Spring面向切面
    005运行时值注入
    004bean作用域
    003自动装配歧义性解决
    002Conditional条件化创建bean
    001profile条件化创建bean
    007API网关服务Zuul
    Sqlserver2008R2 如何使用bak备份文件还原数据库以及对应的失败解决方案
  • 原文地址:https://www.cnblogs.com/Flamo/p/3977622.html
Copyright © 2011-2022 走看看