Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 6.38.0.

Duplications

File Line
org/codehaus/mojo/wagon/shared/SelectorUtils.java 57
org/codehaus/mojo/wagon/shared/SelectorUtils.java 130
public static boolean matchPatternStart( String pattern, String str, boolean isCaseSensitive )
    {
        // When str starts with a separator, pattern has to start with a
        // separator.
        // When pattern starts with a separator, str has to start with a
        // separator.
        if ( str.startsWith( "/" ) != pattern.startsWith( "/" ) )
        {
            return false;
        }

        Vector patDirs = tokenizePath( pattern );
        Vector strDirs = tokenizePath( str );

        int patIdxStart = 0;
        int patIdxEnd = patDirs.size() - 1;
        int strIdxStart = 0;
        int strIdxEnd = strDirs.size() - 1;

        // up to first '**'
        while ( patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd )
        {
            String patDir = (String) patDirs.elementAt( patIdxStart );
            if ( patDir.equals( "**" ) )
            {
                break;
            }
            if ( !match( patDir, (String) strDirs.elementAt( strIdxStart ), isCaseSensitive ) )
            {
                return false;
            }
            patIdxStart++;
            strIdxStart++;
        }

        if ( strIdxStart > strIdxEnd )
        {