private void checkStrictPatchCompliance()

in src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java [381:426]


    private void checkStrictPatchCompliance( List foundPatchFiles )
        throws MojoExecutionException
    {
        if ( strictPatching )
        {
            List ignored = new ArrayList();

            if ( ignoredPatches != null )
            {
                ignored.addAll( ignoredPatches );
            }

            if ( useDefaultIgnores )
            {
                ignored.addAll( DEFAULT_IGNORED_PATCHES );
            }

            List limbo = new ArrayList( foundPatchFiles );

            for ( Object anIgnored : ignored )
            {
                String ignoredFile = (String) anIgnored;

                limbo.remove( ignoredFile );
            }

            if ( !limbo.isEmpty() )
            {
                StringBuilder extraFileBuffer = new StringBuilder();

                extraFileBuffer.append( "Found " ).append( limbo.size() ).append( " unlisted patch files:" );

                for ( Object foundPatchFile : foundPatchFiles )
                {
                    String patch = (String) foundPatchFile;

                    extraFileBuffer.append( "\n  \'" ).append( patch ).append( '\'' );
                }

                extraFileBuffer.append( "\n\nEither remove these files, "
                    + "add them to the patches configuration list, " + "or relax strictPatching." );

                throw new MojoExecutionException( extraFileBuffer.toString() );
            }
        }
    }