samoa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "JC (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SAMOA-63) A suspicious use of incrementer in a for loop
Date Thu, 02 Feb 2017 20:44:53 GMT
JC created SAMOA-63:
-----------------------

             Summary: A suspicious use of incrementer in a for loop
                 Key: SAMOA-63
                 URL: https://issues.apache.org/jira/browse/SAMOA-63
             Project: SAMOA
          Issue Type: Bug
            Reporter: JC
            Priority: Trivial


In recent github snapshot, I've found a suspicious incrementer in foo loop.

samoa-api/src/main/java/org/apache/samoa/evaluation/measures/CMM_GTAnalysis.java
{code:java}
652         for (int c = 0; c < gt0Clusters.size(); c++) {
653           System.out.print("C" + gt0Clusters.get(c).label + " --> ");
654           for (int c1 = 0; c1 < gt0Clusters.get(c).connections.size(); c1++) {
655             System.out.print(" C" + gt0Clusters.get(c1).label + ": " + gt0Clusters.get(c).connections.get(c1));
656           }
657           System.out.println("");
658         }
{code}
In Line 655, gt0Clusters.get(c1).label should be gt0Clusters.get(c).label?
Sine the line just prints out, it could a minor issue. However,  when gt0Clusters.size() is
less than gt0Clusters.get(c).connections.size(), there would be IndexOutOfBoundException.
So reporting this just in case.



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

Mime
View raw message