[emma-maven-plugin] String index out of range: -1
-------------------------------------------------

                 Key: MOJO-1271
                 URL: http://jira.codehaus.org/browse/MOJO-1271
             Project: Mojo
          Issue Type: Bug
         Environment: Linux who 2.6.27-7-generic #1 SMP Tue Nov 4 19:33:20 UTC 
2008 i686 GNU/Linux

java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
            Reporter: Matthijs Wensveen
         Attachments: EmmaCheckMojo.java.patch

When running the emma:check goal, the build fails with "String index out of 
range: -1". After investigating this, I found that coverage.xml contains 
elements:
<method name="&lt;static initializer&gt;">

EmmaCheckMojo.java, however, expects the name attribute to be in the form of: 
"methodName (ArgumentType): ReturnType", and extracts the method name like:
        final String name = elem.getAttributeValue( "name" );
        final int i = name.indexOf( " (" );
        final String methodName = name.substring( 0, i );
        return fullClassName( classElem ) + "." + methodName;

This will fail when the string " (" is not in the name attribute, as is the 
case with "&lt;static initializer&gt;".

A patch that fixes this is included.

-- 
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