AbstractClirrMojo.reportDiffs crashes with ArrayIndexOutOfBoundsException while 
handling CheckerException
---------------------------------------------------------------------------------------------------------

                 Key: MCLIRR-36
                 URL: http://jira.codehaus.org/browse/MCLIRR-36
             Project: Maven 2.x Clirr Plugin
          Issue Type: Bug
    Affects Versions: 2.3
            Reporter: SebbASF


Sample crash analysing Commons Math trunk:

{code}
[INFO] [clirr:clirr {execution: default-cli}]
[INFO] Comparing to version: 2.1
[ERROR] Unable to find information in class 
org.apache.commons.math.analysis.solvers.LaguerreSolver referring back to 
nested class org.apache.commons.
math.analysis.solvers.LaguerreSolver$1
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 558
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.ArrayIndexOutOfBoundsException: 558
        at 
org.codehaus.mojo.clirr.AbstractClirrMojo.reportDiffs(AbstractClirrMojo.java:666)
        at 
org.codehaus.mojo.clirr.AbstractClirrMojo.executeClirr(AbstractClirrMojo.java:263)
        at org.codehaus.mojo.clirr.ClirrReport.doReport(ClirrReport.java:243)
        at org.codehaus.mojo.clirr.ClirrReport.generate(ClirrReport.java:219)
        at org.codehaus.mojo.clirr.ClirrReport.generate(ClirrReport.java:355)
        at org.codehaus.mojo.clirr.ClirrReport.doExecute(ClirrReport.java:182)
        at 
org.codehaus.mojo.clirr.AbstractClirrMojo.execute(AbstractClirrMojo.java:200)
{code}

The source code at this point is:

{code}
// remove class with errors
JavaType[] origClasses2 = new JavaType[origClasses.length - 1];
int j = 0;
for ( int i = 0; i < origClasses.length; i++ )
{
    if ( !e.getMessage().endsWith( origClasses[i].getName() ) )
    {
        origClasses2[j++] = origClasses[i]; // <== Line 666
    }
}
{code}

It's not clear why the output array is sized one less than the input array, but 
if every class passes the test and is stored, the output array will run off the 
end.

The code immediately following has the same issue - the allocation of the 
output array is one less that the theoretical maximum required.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to