[ 
https://jira.codehaus.org/browse/MCHECKSTYLE-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=288267#comment-288267
 ] 

Robert Scholte commented on MCHECKSTYLE-170:
--------------------------------------------

This method is causing trouble
{code}
/** {@inheritDoc} */
    public void fileStarted( AuditEvent event )
    {
        for ( File sourceDirectory : sourceDirectories )
        {
            String sourceDirectoryPath = sourceDirectory.getPath();
            String fileName = StringUtils.replace( event.getFileName(), "\\", 
"/" );
            if ( fileName.startsWith( sourceDirectoryPath + "/" ) )
            {
                currentFile = StringUtils.substring( fileName, 
sourceDirectoryPath.length() + 1 );

                events = getResults().getFileViolations( currentFile );
            }
        }

        if ( events == null )
        {
            events = new ArrayList<AuditEvent>();
        }
    }
{code}

The line {{if ( fileName.startsWith( sourceDirectoryPath + "/" ) )}} uses 
different path separators for fileName and sourceDirectoryPath under Windows
                
> Test errors and failures on Windows
> -----------------------------------
>
>                 Key: MCHECKSTYLE-170
>                 URL: https://jira.codehaus.org/browse/MCHECKSTYLE-170
>             Project: Maven 2.x Checkstyle Plugin
>          Issue Type: Bug
>    Affects Versions: 2.9
>            Reporter: Dennis Lundberg
>            Assignee: Robert Scholte
>
> The current trunk has test errors and failures on Windows 7 with Java 5 and 
> Maven 2.2.1/3.0.3.
> On Ubuntu with Java 5 and Maven 2.2.1/3.0.3 it works though.
> {noformat}
> Failed tests:
>   
> testListeners(org.apache.maven.plugin.checkstyle.CheckstyleReportListenerMultiSourceTest):
>  Test total files expected:<4> but was:<1>
>   
> testListeners(org.apache.maven.plugin.checkstyle.CheckstyleReportListenerTest):
>  Test total files expected:<4> but was:<1>
> Tests in error:
>   
> testMinConfiguration(org.apache.maven.plugin.checkstyle.CheckstyleAggregateReportTest)
>   
> testMinConfiguration(org.apache.maven.plugin.checkstyle.CheckstyleReportTest)
>   
> testCustomConfiguration(org.apache.maven.plugin.checkstyle.CheckstyleReportTest)
>   testUseFile(org.apache.maven.plugin.checkstyle.CheckstyleReportTest)
>   testNoRulesSummary(org.apache.maven.plugin.checkstyle.CheckstyleReportTest)
>   
> testNoSeveritySummary(org.apache.maven.plugin.checkstyle.CheckstyleReportTest)
>   testNoFilesSummary(org.apache.maven.plugin.checkstyle.CheckstyleReportTest)
>   
> testTestSourceDirectory(org.apache.maven.plugin.checkstyle.CheckstyleReportTest)
> Tests run: 22, Failures: 2, Errors: 8, Skipped: 0
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to