CPD Results

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

Duplications

File Line
org/jomc/mojo/MainJavaClassesMojo.java 99
org/jomc/mojo/TestJavaClassesMojo.java 99
                                             this.getMavenProject().getBuild().getTestOutputDirectory() );

            }

            final JavaClasses tool = this.getJavaClassesTool();
            final ModelContext context = this.getModelContext();
            final JAXBContext jaxbContext = context.createContext();
            final Marshaller marshaller = context.createMarshaller();
            final Unmarshaller unmarshaller = context.createUnmarshaller();
            final Schema schema = context.createSchema();

            marshaller.setSchema( schema );
            unmarshaller.setSchema( schema );

            final ModelValidationReport validationReport = context.validateModel( new JAXBSource(
                jaxbContext, new ObjectFactory().createModules( tool.getModules() ) ) );

            this.log( validationReport.isModelValid() ? Level.INFO : Level.SEVERE, validationReport );

            if ( validationReport.isModelValid() )
            {
                this.logSeparator( Level.INFO );
                final Module module = tool.getModules().getModule( this.getJomcTestModuleName() );

File Line
org/jomc/mojo/MainJavaClassesMojo.java 73
org/jomc/mojo/ValidateMainJavaClassesMojo.java 63
    public ValidateMainJavaClassesMojo()
    {
        super();
    }

    @Override
    protected String getToolName()
    {
        return "JavaClasses";
    }

    @Override
    protected ClassLoader getToolClassLoader() throws MojoExecutionException
    {
        return this.getMainClassLoader();
    }

    @Override
    protected void executeTool() throws Exception
    {
        if ( this.isJavaClassProcessingEnabled() )
        {
            File classesDirectory = new File( this.getMavenProject().getBuild().getOutputDirectory() );
            if ( !classesDirectory.isAbsolute() )
            {
                classesDirectory = new File( this.getMavenProject().getBasedir(),
                                             this.getMavenProject().getBuild().getOutputDirectory() );

            }

            final JavaClasses tool = this.getJavaClassesTool();
            final ModelContext context = this.getModelContext();
            final JAXBContext jaxbContext = context.createContext();
            final Unmarshaller unmarshaller = context.createUnmarshaller();

File Line
org/jomc/mojo/AbstractJomcMojo.java 347
org/jomc/mojo/AbstractJomcMojo.java 408
        for ( final Iterator it = this.getMavenProject().getTestArtifacts().iterator(); it.hasNext(); )
        {
            final Artifact a = (Artifact) it.next();

            if ( a.getFile() == null )
            {
                this.log( Level.WARNING, this.getIgnoredMessage( a.toString() ), null );
                continue;
            }

            if ( a.getGroupId().equals( "org.jomc" ) &&
                 ( a.getArtifactId().equals( "jomc-util" ) || a.getArtifactId().equals( "jomc-model" ) ||
                   a.getArtifactId().equals( "jomc-tools" ) ) )
            {
                continue;
            }

            final String element = a.getFile().getAbsolutePath();
            this.log( Level.FINE, this.getTestElementMessage( element ), null );

File Line
org/jomc/mojo/MainJavaSourcesMojo.java 88
org/jomc/mojo/TestJavaSourcesMojo.java 88
                                                this.getMavenProject().getBuild().getTestSourceDirectory() );

            }

            final JavaSources tool = this.getJavaSourcesTool();
            final ModelContext context = this.getModelContext();
            final JAXBContext jaxbContext = context.createContext();

            final ModelValidationReport validationReport = context.validateModel( new JAXBSource(
                jaxbContext, new ObjectFactory().createModules( tool.getModules() ) ) );

            this.log( validationReport.isModelValid() ? Level.INFO : Level.SEVERE, validationReport );

            if ( validationReport.isModelValid() )
            {
                this.logSeparator( Level.INFO );
                final Module module = tool.getModules().getModule( this.getJomcTestModuleName() );

File Line
org/jomc/mojo/TestJavaClassesMojo.java 110
org/jomc/mojo/ValidateTestJavaClassesMojo.java 97
            final Schema schema = context.createSchema();

            unmarshaller.setSchema( schema );

            final ModelValidationReport validationReport = context.validateModel( new JAXBSource(
                jaxbContext, new ObjectFactory().createModules( tool.getModules() ) ) );

            this.log( validationReport.isModelValid() ? Level.INFO : Level.SEVERE, validationReport );

            if ( validationReport.isModelValid() )
            {
                this.logSeparator( Level.INFO );
                final Module module = tool.getModules().getModule( this.getJomcTestModuleName() );
                if ( module != null )
                {
                    this.logProcessingModule( module );
                    tool.validateClasses( module, unmarshaller, classesDirectory );

File Line
org/jomc/mojo/TestJavaClassesMojo.java 91
org/jomc/mojo/ValidateTestJavaClassesMojo.java 81
    protected void executeTool() throws Exception
    {
        if ( this.isJavaClassProcessingEnabled() )
        {
            File classesDirectory = new File( this.getMavenProject().getBuild().getTestOutputDirectory() );
            if ( !classesDirectory.isAbsolute() )
            {
                classesDirectory = new File( this.getMavenProject().getBasedir(),
                                             this.getMavenProject().getBuild().getTestOutputDirectory() );

            }

            final JavaClasses tool = this.getJavaClassesTool();
            final ModelContext context = this.getModelContext();
            final JAXBContext jaxbContext = context.createContext();
            final Unmarshaller unmarshaller = context.createUnmarshaller();