You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@joshua.apache.org by "JC (JIRA)" <ji...@apache.org> on 2017/02/02 21:08:51 UTC

[jira] [Closed] (JOSHUA-330) A suspicious use of an incrementer in a for loop

     [ https://issues.apache.org/jira/browse/JOSHUA-330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

JC closed JOSHUA-330.
---------------------
    Resolution: Invalid

> A suspicious use of an incrementer in a for loop
> ------------------------------------------------
>
>                 Key: JOSHUA-330
>                 URL: https://issues.apache.org/jira/browse/JOSHUA-330
>             Project: Joshua
>          Issue Type: Bug
>            Reporter: JC
>            Priority: Trivial
>
> In a recent github snapshot, I've found a suspicious use of an incrementer in for loop.
> src/org/apache/xalan/xsltc/compiler/util/MethodGenerator.java
> {code:java}
> 501                 for (int i = 0; i < slotCount; i++) {
> 502                     Object slotEntries = _variables.get(i);
> 503                     if (slotEntries != null) {
> 504                         if (slotEntries instanceof ArrayList) {
> 505                             ArrayList slotList = (ArrayList) slotEntries;
> 506 
> 507                             for (int j = 0; j < slotList.size(); j++) {
> 508                                 allVarsEverDeclared.add(slotList.get(i));
> 509                             }
> 510                         } else {
> 511                             allVarsEverDeclared.add(slotEntries);
> 512                         }
> 513                     }
> 514                 }
> {code}
> In Line 508, slotList.get( i) should be slotList.get(j)? I have no idea if slotCount is always same as or less than slotList.size(). However, I thought it's worth to report just in case.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)