Fork me on GitHub

CPD Results

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

Duplications

File Line
net/sf/maventaglib/TagreferenceMojo.java 91
net/sf/maventaglib/ValidateMojo.java 97
}

    /**
     * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
     */
    @Override
    protected void executeReport(Locale locale) throws MavenReportException
    {
        if (!srcDir.isDirectory())
        {
            throw new MavenReportException(MessageFormat.format(
                Messages.getString("Taglib.notadir"), //$NON-NLS-1$
                    srcDir.getAbsolutePath()));
        }

        getLog().debug(
            MessageFormat.format(Messages.getString("Taglib.validating"), srcDir.getAbsolutePath())); //$NON-NLS-1$

        DocumentBuilder builder;

        try
        {
            builder = XmlHelper.getDocumentBuilder();
        }
        catch (MojoExecutionException e)
        {
            throw new MavenReportException(e.getMessage(), e);
        }
        List<File> tlds;
        try
        {
            tlds = FileUtils.getFiles(srcDir, "**/*.tld", null);
        }
        catch (IOException e)
        {
            throw new MavenReportException(e.getMessage(), e);
        }
        List<Tld> tldList = new ArrayList<>();
        for (File current : tlds)
        {
            Document tldDoc;
            try
            {
                tldDoc = builder.parse(current);
            }
            catch (Exception e)
            {
                throw new MavenReportException(MessageFormat.format(Messages.getString("Taglib.errorwhileparsing"), //$NON-NLS-1$
                    current.getAbsolutePath()), e);

            }

            Tld tld = TldParser.parse(tldDoc, current.getName());
            tldList.add(tld);

        }

        if (tldList.size() == 0)
        {
            getLog().info(
                MessageFormat.format(Messages.getString("Taglib.notldfound"), srcDir.getAbsolutePath())); //$NON-NLS-1$
            return;
        }