IBM Support

PM46251: Invalid javascript generation

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The javascript generation for a for statement can generate
    invalid and
    dead code. For example, the following method:
    
    
    
    function businessObject_Ctrtpfx()
    
     for (j int from 1 to
    
    screen.ContractDetailList.functions.getListManagerThis().
    
    getBusinessObjectList().getSize())
    
         bo2 CefetraSBusinessObject =
    
    screen.ContractDetailList.functions.getListManagerThis().
    
    getBusinessObjectList()[j]
    
    as CefetraSBusinessObject;
    
         bo2.setValue('VCtr_tp_fx', ('' +
    screen.FieldCtrtpfx.getValue()));
     end
    
     return;
    
    end
    
    
    
    Generates the following javascript:
    
    
    
    'businessObject_Ctrtpfx': function() {
    
     var ezert$$19 = null;
    
     ezert$$19 =
    
    egl.checkNull(egl.checkNull(egl.checkNull(this.screen).
    
    ContractDetailList).functions).getListManagerThis();
    
     var ezert$$20 = null;
    
     ezert$$20 = egl.checkNull(ezert$$19).getBusinessObjectList();
    
     var ezert$$21 = 0;
    
     ezert$$21 = ezert$$20.getSize();
    
     {
    
      var j = 0;
    
      j = 1;
    
      for ( ; (j ?=
    
    egl.checkNull(egl.checkNull(egl.checkNull(egl.checkNull(this.scr
    een).
    
    ContractDetailList).functions).getListManagerThis()).
    
    getBusinessObjectList().getSize());
    
    j = (j + 1) )
    
      {
    
       var bo2 = null;
    
       var ezert$$22 = null;
    
       ezert$$22 =
    
    egl.checkNull(egl.checkNull(egl.checkNull(this.screen).
    
    ContractDetailList).functions).getListManagerThis();
    
       var ezert$$23 = null;
    
       ezert$$23 = egl.checkNull(ezert$$22).getBusinessObjectList();
    
       bo2 = ezert$$23[ezert$$23.checkIndex((j)-1)];
    
       var ezert$$24 = null;
    
       ezert$$24 =
    egl.checkNull(this.screen).FieldCtrtpfx.getValue();
    
       egl.checkNull(bo2).setValue('VCtr_tp_fx', {eze$$value : ('' +
    
    egl.convertAnyToString(egl.boxAny(ezert$$24),false)),
    eze$$signature :
    'S;'} );
    
      }
    
     }
    
     return;
    
    }
    
    
    
    The code is assigning the end loop condition (ezert$$21), but
    then it
    doesn't use the value. I think it should be using the value in
    the for
    loop:
    
    
    
    for ( ; (j ?= ezert$$21); j = (j + 1) )
    
    
    
    Currently, the code is evaluating the 'to' index before entering
    the
    loop and on every iteration through the loop. It should only
    evaluate it
    before entering the loop.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    The JavaScript generated from a "for" loop is incorrect when
    the "to" value contains a function call.  The function will
    incorrectly be called one extra time, before the beginning
    of the loop.
    

Problem conclusion

  • The extra function call is no longer generated.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM46251

  • Reported component name

    RATL BUS DEV

  • Reported component ID

    5724S5000

  • Reported release

    801

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-08-23

  • Closed date

    2012-01-27

  • Last modified date

    2012-01-27

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    RATL BUS DEV

  • Fixed component ID

    5724S5000

Applicable component levels

  • R801 PSN

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSMQ79","label":"Rational Business Developer"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0.1","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
27 January 2012